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

Support deserialization of immutable dictionaries from avro maps #59

Merged

Conversation

kingwill27
Copy link
Contributor

Adds special handling for immutable dictionaries, which cannot be directly assigned to from dictionaries.

Copy link
Member

@dstelljes dstelljes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! Just one small change and I think we’re good to go.

In the future, we may also want to look at altering BinaryCodec so that we aren’t creating both a Dictionary<K, V> and an ImmutableDictionary<K, V> each time.


if (target.Equals(immutableDictionary))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the array case, we override GenerateConversion: https://github.com/ch-robinson/dotnet-avro/blob/development/src/Chr.Avro.Binary/BinaryDeserializerBuilder.cs#L468

for consistency, it’s probably best to do the same here

@kingwill27
Copy link
Contributor Author

@dstelljes thanks for the feedback! let me know if that's what you had in mind. I agree it's not ideal to create an intermediate dictionary, although from what I've seen there isn't a great way to construct immutable dictionaries from lists or other data structures.

@dstelljes dstelljes merged commit a01945e into ch-robinson:development Jan 11, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants