Hey everyone,
I whould like to creat a serialization mechanism, to work on a variety of entities, all of which are based on a few base-classes. Now I want to work with DataContractSerializer, so I need to mark all my classes with [DataContract]. but I dont want to do that because that is a big room for error for other members of my team. instead I want to place a singel attribute on my base-class(es), and not to worry about every calss I add.
I would actually prefer to inherit from [DataContract], should I ever wish to change the mechanism I will need to change only my inheriting attribute and not all my classes (the same goes for the [DataMember]). Now the problem is that DataContractAttribute is a seald class.
I thought up 3 solution, but i dont know how to implement any of them...
First, I heard a rommer that there is a way to inherit from a seald class, that will be greate and save me a lot of fuzz.
Second, I know that with reflection it's possible to change a class in runtime and re-compile back to runtime,
so I thought to create my on attribute and at runtime replace all my custom attribute with
[DataContract]
Third, to use some sort of pre-compile tool that will replace my attribute with [DataContract]
So if you have an idea how to implement any of these three (first and third preferred), or if you have an other idea it'll be great.
Thank you.