Add DataMember and DataContract onbuild
We are developing an Silverlight with Wcf business application. We are using Wcf DataContract and DataMember.
We are setting DataMember at all 开发者_C百科fields and DataContract(IsReference=true) on all classes. Can we somehow set the compiler to automatically add DataMember and DataContract onbuild so we can skip to add DataMember and DataContract? :). In other words can we set a rule that adds DataContract on all classes and adds DataMember on all fields when building? But we wont se any changes in our code.
If you're using 3.5SP1, it's not necessary to attribute anything- all public members will be serialized on types that aren't otherwise serializable and aren't marked DataContract/DataMember (if it's marked at all, the auto-serialization is disabled). The reference preservation behavior can be set via config + custom serializer setup like this.
精彩评论