svcutil和指定的字段

adr*_*anm 6 c# wsdl svcutil.exe

我正在使用来自webservice的svcutil生成datacontract.

svcutil /language:cs /noConfig /targetclientversion:Version35 
        /out:Generated\ProductService.cs http://example.com/ProductService.svc?wsdl
Run Code Online (Sandbox Code Playgroud)

生成的字段如下所示:

private System.Nullable<System.DateTime> createdField;
private bool createdFieldSpecified;
Run Code Online (Sandbox Code Playgroud)

字段如何既可以为空又具有指定字段?

Ste*_*e B 6

这取决于源Wsdl.我打赌这有一些东西(不确定语法):

<xsd:element name="created" type="xsd:datetime" minOccurs="0" xsd:nil="true" />
Run Code Online (Sandbox Code Playgroud)

svcutil.exe用于nillable生成Nullable<>字段,并minOccurs生成字段+指定的组合.

我还打赌WSDL不是.Net生成的WSDL!