I have the following (abbreviated) class that is sent and received to/from the client via WCF:
public class Sparetime : ChartConfigurationBase, IChartConfiguration
{
[DataMember]
public int SparetimeConfigurationId { get; set; }
public Single FeederOffRate { get; set; }
}
Notice the first property uses the DataMember attribute and the second doesn't. Am I correct that only the first property would get serialized and sent to the client when a WCF call is made?
Yes, you are right, the MSDN documentation specifies it :
When applied to the member of a type, specifies that the member is part of a data contract and is serializable by the DataContractSerializer.
You should add DataContract attribute to your class to make it serializable :
[DataContract]
public class Sparetime : ChartConfigurationBase, IChartConfiguration
{
}
Note that FeederOffRate will be set to its default value (null for reference types).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With