【发布时间】:2019-04-15 02:40:23
【问题描述】:
我正在实施 wcf 服务。 我的班级结构如下:
[DataContract]
public class NotificationsSapInfo
{
[DataMember]
[Required]
[StringLength(3)]
public string ID_CLIENT { get; set; }
[DataMember]
[Required]
[StringLength(60)]
public string ID_OBJECT_CODE { get; set; }
[DataMember]
[Required]
[StringLength(60)]
public string ID_TYPE { get; set; }
[DataMember]
[StringLength(60)]
public string ID_SUB_TYPE { get; set; }
[DataMember]
[StringLength(4)]
public string ID_DIVISION { get; set; }
[DataMember]
[StringLength(50)]
public string ID_LINE { get; set; }
}
出现的问题是在生成的 WSDL 中似乎忽略了 Required 和 StringLength 属性。
这是生成的 WSDL 部分。
<xs:complexType name="NotificationsSapInfo">
<xs:sequence>
<xs:element name="ID_CLIENT" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="ID_DIVISION" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="ID_LINE" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="ID_OBJECT_CODE" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="ID_SUB_TYPE" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="ID_TYPE" type="xs:string" nillable="true" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
我错过了什么?
提前致谢
【问题讨论】:
标签: c# web-services wcf soap wsdl