我正在创建 WCF 服务,这里是服务的 DataContract 部分,我将Fromdate
字段设置为必需属性。
[DataContract(Name = "PriceCalculationRequest")]
public class PriceReq
{
[DataMember(Name = "PickupDate", Order = 1, IsRequired = true , EmitDefaultValue=true)]
private DateTime FromDate { get; set; }
[DataMember(Name = "ReturnDate", Order = 3)]
public DateTime ToDate { get; set; }
[DataMember(Order = 2)]
public string PickupLocation { get; set; }
[DataMember(Order = 4)]
public string ReturnLocation { get; set; }
public string CarType { get; set; }
}
这是wsdl
从上面的代码生成的文件,我怎样才能确定哪个属性是必需的属性,
<xs:sequence>
<xs:element minOccurs="0" name="pickupDate" type="xs:dateTime"/>
<xs:element minOccurs="0" name="returnDate" type="xs:dateTime"/>
<xs:element minOccurs="0" name="pickupLocation" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="vehiclePreference" nillable="true" type="xs:string"/>
</xs:sequence>