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

Can't map property of type Dictionary<int, Decimal> to the same prop. #92

Closed
alexeyosipov opened this issue Dec 1, 2016 · 1 comment

Comments

@alexeyosipov
Copy link

Imagine, I have class

class A {
   public Dictionary<int, Decimal> Prop { get; set; }
}

Such code will rise an error:

TypeAdapter.Adapt<A, A>(new A { Prop = new Dictionary<int, Decimal>{ { 1, 2m } }});

Looks like ConversionDictionary rule applied here and rises exception.

@chaowlert
Copy link
Collaborator

Sorry for bug, I will fix this in this weekend. For now, could you please map manually?

            TypeAdapterConfig<Dictionary<int, decimal>, Dictionary<int, decimal>>.NewConfig()
                .MapWith(dict => dict.ToDictionary(kvp => kvp.Key, kvp => kvp.Value));

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

2 participants