Set required datamember string in wcf
I want to set the DataMember string as required, I set "IsRequired = true", but it appears as optional in the XML request.
[MessageContract(WrapperName = "tourinforequest")]
public class TourInfoRequest
{
public TourInfoRequest()
{
Request = new TourInfoRequestRequestData();
}
[MessageBodyMember]
public TourInfoRequestRequestData Request;
}
public class TourInfoRequestRequestData : BaseRequest
{
[DataMember(Order = 1, IsRequired = true ), XmlElement(ElementName = "tourcode")]
public string TourCode { get; set; }
[DataMember(Order = 2, IsRequired = true), XmlElement(ElementName = "depdate")]
public DateTime DepartureDate { get; set; }
}
+3
source to share
No one has answered this question yet
Check out similar questions: