-
Hi! I chose DataContract to make the code cleaner but I came across a situation. If you want to group common properties between several classes, in a base class, how does the DataContract attribute work in these cases? It's just that in this case I only want the base class to group common data and it won't be the one that will end up being deserialized, but its subclasses. In this case, how should I apply the DataContract? Should the base class and its members that will be inherited contain DataContract and DataMember respectively? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As long as the derived class has |
Beta Was this translation helpful? Give feedback.
As long as the derived class has
DataContract
, Chr.Avro should use anyDataMember
annotations on both that class and the base class. Whether you addDataContract
on the base class is up to you.