WCF: is there an attribute to make parameters in the OperationContract required?

后端 未结 2 1259
遇见更好的自我
遇见更好的自我 2020-12-19 03:08

I use [DataMember(IsRequired=true)] to make the DataContract properties required. There doesn\'t seem to be some IsRequired for the OperationContract parameters

2条回答
  •  一生所求
    2020-12-19 03:54

    No. Just like any regular method, you'll need to check whether reference type parameters have a value or are null.

    Just apply your normal defensive programming patterns, checking reference types before accessing their properties.

提交回复
热议问题