Open nareshkumar66675 opened 7 years ago
I am trying to map Dapper Data to an Object. But am facing problem while mapping to Dictionary objects.
The Requirement is to map a Data Row to an Object. Data Row 1 | Key1 | Value1 1 | Key2 | Value2
Expected Values Id -> 1 Data -> {{"Key1","Value1" }, { "Key2","Value2"}}
Id -> 1
Data -> {{"Key1","Value1" }, { "Key2","Value2"}}
Map Code:
IDictionary<string, object> entity = new Dictionary<string, object>(); entity.Add("Id", "1"); entity.Add("Data_Key", new List<string>() { "Key1", "Key2" }); entity.Add("Data_Value", new List<string>() { "Value1", "Value2" }); var result=Slapper.AutoMapper.Map<TestEntity>(entity);
Entity Object
public class TestEntity { public int Id { get; set; } public Dictionary<string,string> Data { get; set; } }
Is there a way to achieve this ??
I am trying to map Dapper Data to an Object. But am facing problem while mapping to Dictionary objects.
The Requirement is to map a Data Row to an Object. Data Row 1 | Key1 | Value1 1 | Key2 | Value2
Expected Values
Id -> 1
Data -> {{"Key1","Value1" }, { "Key2","Value2"}}
Map Code:
Entity Object
Is there a way to achieve this ??