下面是我的WCF服务中的DataContract及其在wsdl文件中显示的相应xsd架构。
[Serializable]
[XmlRoot(Namespace = "http://www.example.com/l0257/services/mgnt/datatypes/0/1",IsNullable = false)]
public partial class InstrumentData
{
private string _serialNo;
private string _model;
private int _pointsRecorded;
[XmlElement(ElementName = "SerialNo", IsNullable = false)]
public string SerialNo
{
get { return _serialNo; }
set { _serialNo = value; }
}
[XmlElement(ElementName = "Model", IsNullable = false)]
public string Model
{
get { return _model; }
set { _model = value; }
}
[XmlElement(ElementName = "PointsRecorded", IsNullable = false)]
public int PointsRecorded
{
get { return _pointsRecorded; }
set { _pointsRecorded = value; }
}
}
WSDl文件包含相应datacontract的以下信息:
<xs:complexType name="InstrumentData">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="SerialNo" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Model" type="xs:string" />
<xs:element minOccurs="1" maxOccurs="1" name="PointsRecorded" type="xs:int" />
</xs:sequence>
</xs:complexType>
有人可以让我知道我的数据合同中缺少什么,以获得“模型”&amp;的minOccurs = 1和maxOccurs = 1 Instrumentdata类的“SerialNo”属性。