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:
IDictionary<string,object>entity=newDictionary<string,object>();entity.Add("Id","1");entity.Add("Data_Key",newList<string>(){"Key1","Key2"});entity.Add("Data_Value",newList<string>(){"Value1","Value2"});varresult=Slapper.AutoMapper.Map<TestEntity>(entity);Entity Object
publicclassTestEntity{publicintId{get;set;}publicDictionary<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 -> 1Data -> {{"Key1","Value1" }, { "Key2","Value2"}}Map Code:
Entity Object
Is there a way to achieve this ??