Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf 添加未为可选值类型生成指定字段的服务引用_Wcf_Visual Studio_Service Reference_Xsd.exe - Fatal编程技术网

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

Wcf 添加未为可选值类型生成指定字段的服务引用,wcf,visual-studio,service-reference,xsd.exe,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" m

我在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>

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

尝试添加xs:nillable=true@LukasKubis是否无法使minOccurs=0正常工作?这是我们的标准,我不确定。看看卢卡斯库比,嗯,我看到了。不过,我本以为它会起作用。这三种情况都得到满足-它是一个元素,maxOccurs设置为1,数据类型转换为值类型请向我们展示生成的类的外观
[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;
    }
}