Rob Sedgwick
Rob Sedgwick

Reputation: 4514

Expose Serializable Enum attributes in WCF

I am trying to to expose an Enum from my WCF class (basically as a mechanism for passing a constant). When I look at the service reference code or the WSDL there is no sign of the Enum and I cannot use it. Why not?

[Serializable]
[DataContract]
public class MyRequest
{
    [DataContract]
    public enum Constants
    {
        [EnumMember]
        MaxMaxArticles = 1000
    } 
}

Upvotes: 2

Views: 70

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1062770

I suspect you haven't used the enum anywhere in the contract. Unless you have, there is no reason that it would be included in the graph that it builds by walking members from the root contract type. It will not be included just because it is nested: it needs to be actually used somewhere.

Upvotes: 1

Related Questions