silverlightsilverlight-4.0entity-framework-4silverlight-3.0wcf-ria-services

How can i prevent RIA service change tracking for certain fields?


How can i prevent RIA service change tracking on certain properties. I have a partial class and i want that RIA service should not track changes to it. How can i do that?

Currently if i see in generated code, i can methods like OnXXXChanging() nad OnXXXChanged() etc etc. I want these should not be generated for my custom properties.

Thanks in advance :)


Solution

  • To stop RIA Services tracking (or even generating) a property, just add the [Exclude] attribute to the property (either in the .shared.cs or in a metadata class.

    If you then add a [DataMember] attribute, WCF will still serialize/deserialize it, but RIA Services won't care about it.