views:

27

answers:

1

Hi

We are developing an Silverlight with Wcf business application. We are using Wcf DataContract and DataMember.

We are setting DataMember at all 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.

A: 

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.

PS- 0% accept rate? You'll get better answers if you go back and mark some as accepted so people get credit for their trouble.

nitzmahone
Well I would have done that if I weren't using Silverlight [Serializeable] isn't supported by Silverlight so I am forced to use DataContract/DataMember, but your'e right I want exactly that behaviour.
NPehrsson
This behavior has nothing to do with Serializable, and it works exactly the same way in Silverlight 3 and 4 as it does on 3.5SP1.
nitzmahone
well I will test that approach tomorrow :)
NPehrsson