Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map to Dictionary Support #53

Open
nareshkumar66675 opened this issue Apr 18, 2017 · 0 comments
Open

Map to Dictionary Support #53

nareshkumar66675 opened this issue Apr 18, 2017 · 0 comments

Comments

@nareshkumar66675
Copy link

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 = 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 ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant