0

I have a WCF web service with data contract as

[DataContract]
public class Employee
{
    [DataMember(IsRequired = true)]        
    public int EmployeeNumber {get;set;}

    [DataMember(IsRequired = true)]        
    public string EmployeeName {get;set;}     

    [DataMember (IsRequired = true)]        
    public int DepartmentNumber{ get; set; }
}

I want to make DepartmentNumber field nullable. Because not always I will provide DepartmentNumber.

I tried the below mentioned code to achieve this

   [DataMember (IsRequired = true)]        
    public int? DepartmentNumber{ get; set; }

When I tried to test this using WCF client, it is not allowing me to enter anything for DepartmentNumber field.

Can anyone help me with this.

0 Answers0