DataContract for enums in WCF
I have a enum that I use via a WCF service in a .Net project. Now I want to add another enum, specified in the same way as the first. But the second one does not get registered in Reference.cs, and therefore is not recognized from the project consuming the WCF service.
I have tried to re-write everything as I read that there is an automatic count that is confused if one copy-pastes the enum members. I checked that the service reference is not re-using types in referenced assemblies.
[DataContract]
public enum SecondEnum
{
[EnumMember(Value = "WWW")]
WWW = 0x0,
[EnumMember]
VVV= 0x1,
}
I have tried to add Name and Namespace, without result. I have checked so there are no more references to the FirstEnum, that I would have missed开发者_运维问答 when writing the SecondEnum. Thwy seem to have been written the same way.
So, why is a DataContract not recognized in the Reference.cs class? I guess that if I can figure this out, the rest will solve itself.
Thanks for any ideas.
Is the second enumeration referenced in any operations on the service contract? WCF will only add to the metadata types which are part of the contract.
精彩评论