WCF DataContract with readonly properties

Posted by Asaf R on Stack Overflow See other posts from Stack Overflow or by Asaf R
Published on 2010-03-22T18:54:50Z Indexed on 2010/03/22 19:01 UTC
Read the original article Hit count: 774

Filed under:
|
|
|

Hi,

I'm trying to return a complex type from a service method in WCF. I'm using C# and .NET 4. This complex type is meant to be invariant (the same way .net strings are).

If I try to define only getters on properties I get a run time error. I guess this is because no setters causes serialization to fail. Still, I think this type should be invariant.

Is there a way to make readonly properties on a WCF DataContract? Is, how? If not, what would you suggest for this problem?

Thanks,
Asaf

© Stack Overflow or respective owner

Related posts about wcf

Related posts about datacontract