简体   繁体   中英

Is changing a WCF data member to nullable a breaking change?

I have a WCF Service that is called by the client.

If my current data contract for the return value is:

[Serializable]
[DataContract]
public class StatisticsDto
{
    [DataMember]
    public int EmployeeId { get; set; }
}

and I change only the server implementation to:

[Serializable]
[DataContract]
public class StatisticsDto
{
    [DataMember]
    public int? EmployeeId { get; set; }
}

does this result in incompatibility until I update the client? or is the value automatically cast to int unless it is null?

Agree with commenter @Selvin. It is certainly a breaking change for the client until you update the client to handle null values in EmployeeId field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM