DataContract Serialization - Base class property names not working?

It is because you have declared that setter for the property as private since it is private, the DataContractSerializer is serializing the backing field and using its name rather then the property The DataContractSerializer will happily serialize any members that you ask it to but with respect to the semantics of the language. It is usually best to declare your data contracts simply and without a lot of visibility control like this because the message contract between a service and a client should be straightforward and easy to consume. Create open and unrestricted data contracts but lock down your operation contracts.

It is because you have declared that setter for the property as private - since it is private, the DataContractSerializer is serializing the backing field and using its name rather then the property. The DataContractSerializer will happily serialize any members that you ask it to but with respect to the semantics of the language. It is usually best to declare your data contracts simply and without a lot of visibility control like this because the message contract between a service and a client should be straightforward and easy to consume.

Create open and unrestricted data contracts but lock down your operation contracts.

Reason for this is because I don't really want to allow the users to edit the ID field. – James Feb 2 '10 at 14:43 If you really want to keep it private with a name you define then explicitly declare a backing field and don't use C#'s automatically implemented properties. – Andrew Hare Feb 2 '10 at 14:44 Thanks using a private field did the trick.

– James Feb 2 '10 at 14:51.

I have that on my contracts and things serialize/deserialize quite nicely.

Ben nope doesn't seem to work using internal setter. – James Feb 2 '10 at 15:11 doesn't work for me either – Schneider Oct 5 at 8:08.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions