添加服务引用不为可选值类型生成指定字段

时间:2014-10-10 12:32:23

标签: wcf visual-studio service-reference xsd.exe

我在xsd -

中有以下内容
 <xsd:complexType name="isPermissableRq_Type">
    <xsd:sequence>
      <xsd:element name="accNr" type="ObjectId_Type" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="bankNr" type="BankNr_Type" minOccurs="0" maxOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>

<xsd:simpleType name="BankNr_Type">
    <xsd:restriction base="xsd:long">
      <xsd:totalDigits value="10"/>
    </xsd:restriction>
  </xsd:simpleType>

生成的参考 -

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="isPermissableRq", WrapperNamespace="http://contracts.co.za/TransactionMgmnt", IsWrapped=true)]
public partial class isPermissableRequest {

    [System.ServiceModel.MessageHeaderAttribute(Namespace="http://contracts.co.za/Infrastructure/2008/09/EnterpriseContext")]
    public Services.Svc2014.EnterpriseContext_Type EnterpriseContext;

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://contracts.co.za/services/2014-12-16/TransactionMgmnt", Order=0)]
    public string accNr;

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://contracts.co.za/services/2014-12-16/TransactionMgmnt", Order=1)]
    public long bankNr;


    public isPermissableRequest() {
    }

    public isPermissableRequest(Services.Svc2014.EnterpriseContext_Type EnterpriseContext, string accNr, long bankNr) {
        this.EnterpriseContext = EnterpriseContext;
        this.accNr= accNr;
        this.bankNr = bankNr;
    }
}

当我使用vs 2013添加服务引用时,我希望为bankNr生成一个指定的字段,因为minOccurs为0,但这不会发生。有任何想法吗?该字段需要接受null。

0 个答案:

没有答案