Another interesting thing to notice: if you decorate your DataContract code, you have a lot of control over what the client can see and must send back to your service. For example:
[DataContract] public class SampleClass { [DataMember(IsRequired=true)] public int MyRequiredProperty { get; set; } [DataMember] public int MyOptionalProperty { get; set; } public int MyInternalProperty { get; set; } }
In the above example, you have determined that when receiving data you MUST have MyRequiredProperty, and you may or may not have MyOptionalProperty. In addition, the client will never see MyInternalProperty (it may be, for example, some property that helps your logic internally, but you do not want it to be displayed at the client level).
Wagner Silveira Nov 20 '08 at 9:26 a.m. 2008-11-20 09:26
source share