我想知道如何在WCF的OperationContract方法中将参数指定为必需,以便生成的xsd包含minOccurs="1"而不是minOccurs="0"。
示例:
生成此XSD:
示例:
[ServiceContract(Namespace = "http://myUrl.com")]
public interface IMyWebService
{
[OperationContract]
string DoSomething(string param1, string param2, string param3);
}
生成此XSD:
<xs:element name="DoSomething">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="param1" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="param2" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="param3" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
但我希望在代码中定义minOccurs="1",而无需手动在xsd文件中修复它。