parapura rajkumar
parapura rajkumar

Reputation: 24423

is changing underlying type of an enum breaking change for wcf contract?

Assume I have a simple wcf service like so

[DataContract]
public enum VMType : int
{
    [EnumMember]
    Unknown = 0,

    [EnumMember]
    Virtual = 1,

    [EnumMember]
    Physical = 2,
}

[DataContract]
public class ClientRequest
{
    [DataMember]
    public string Code { get; set; }

    [DataMember]
    public VMType VMType { get; set; }
}

[ServiceContract]
public interface IService
{
    [OperationContract]
    int GetStatus(ClientRequest request);
}

and if change the enum VMType to

public enum VMType : byte
{

Is this considered a breaking change ? Will old WCF clients still be able to connect to the new service host ?

As per Enumeration Types in Data Contracts

Generally the data contract includes enumeration member names, not numerical values

Upvotes: 2

Views: 842

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564861

Is this considered a breaking change ?

Yes. This will change the serialization, which would be a breaking change.

Will old WCF clients still be able to connect to the new service host ?

This depends a lot on the type of connection - in particular, which serializer is being used to map data. Depending on the binding being used, this may or may not work.

Upvotes: 1

Related Questions