-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
Mpc support for generic class unions #994
Conversation
- Added CollectGenericUnion method, which reads the union attributes on generic class definitions. - Formatter names are now created by using the MinimallyQualifiedFormat to support generic classes. e.g. AWrapper<IEnumerable<string>> would be called AWrapper_IEnumerable_string__Formatter This enables MessagePack-CSharp#964
Ok to add |
The template string was used to generate the formatter classes with a generic type definition. [MessagePackObject]
public class TreeNode<T>
{
[Key(0)]
public TreeNode<T> Parent { get; set; }
}
[MessagePackObject]
public class Leaf : TreeNode<Leaf> { }
[MessagePackObject]
public class Leaf2 : TreeNode<Leaf2> { } When you use mpc on this code it will generate the following: public sealed class TreeNodeFormatter<T> : IMessagePackFormatter<TreeNode<Leaf>>
{ ... }
public sealed class TreeNodeFormatter<T> : IMessagePackFormatter<TreeNode<Leaf2>>
{ ... } There will be two formatters created with the name public sealed class TreeNode_Leaf_Formatter : IMessagePackFormatter<TreeNode<Leaf>>
{ ... }
public sealed class TreeNode_Leaf2_Formatter : IMessagePackFormatter<TreeNode<Leaf2>>
{ ... } @neuecc I am not 100% that this will not break anything, what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the clarification.
okay to merge.
Mpc now supports generating formatters base on generic class unions.
Mpc will now recognize these Unions and generate the formatters accordingly
Issue
This enables #964