WCF chokes on properties with no “set ”. Any workaround?

后端 未结 9 748
别跟我提以往
别跟我提以往 2020-12-02 11:34

I have some class that I\'m passing as a result of a service method, and that class has a get-only property:

[DataContract]
public class ErrorBase
{
  [DataM         


        
9条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 12:13

    If your serializer is of type DataContractJsonSerializer (or any DataContractSerializer) you can also use DataContractSerializerSettings in the constructor, with the SerializeReadOnlyTypes property set to true.

提交回复
热议问题