Reputation: 1387
I have created a WCF web service which is referenced in a Winforms UI and both projects reference a common class library with POCOs.
The service reference is configured to reuse types and everything works perfectly until I make a property's setter in one of the POCOs private. When passing that POCO as a parameter from the client to the server the property becomes null even though it was not null on the client.
As a workaround I had to explicitly declare [DataContract]
and [DataMember]
attributes on that particular POCO to get the property working again. (The other POCOs - all with public getters and setters - did not need any attributes).
Does anyone know:
1) why this happens (i.e. is this a bug or is it documented behaviour and if so what is the reasoning)?
and
2) whether there is a simpler work-around than decorating the class with attributes (e.g. some setting on the service etc.)?
Upvotes: 0
Views: 379
Reputation: 11470
Upvotes: 1