Reputation: 21304
So I have a project I've inherited that has a WCF Service Reference and the corresponding Reference.cs
generated proxy classes. In the existing proxy classes I can see an enum
defintion:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="MyRecord.ColorAction", Namespace="http://schemas.datacontract.org/2004/07/DocumentsDataAccess.DataClasses")]
public enum ColorAction : int {
[System.Runtime.Serialization.EnumMemberAttribute()]
NONE = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
GREEN = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
RED = 2,
}
Here is the corresponding WCF code:
[DataContract]
public enum ColorAction
{
[EnumMember]
NONE = 0,
[EnumMember]
GREEN = 1,
[EnumMember]
RED = 2,
}
I can verify this is exposed by looking at the wsdl
in a browser and I can see the enum
types listed.
However, when I either 'refresh' or 'Add Service Reference' (as a new reference by deleting and re-adding), this enum
along with a lot of other methods and enums are missing. The download and creation of the proxy classes is successful so it's not an issue of an error.
I have tried adjusting all of the 'Advanced' settings in the Add Service Reference
dialog, but it seems to make no difference. The net result is since existing code is expecting to be able to call and use the enums
among other code that's missing, the code will not compile after refreshing or re-adding the service reference.
I've already tried unchecking Reuse types in all referenced assemblies
but that did not change the outcome.
I'm wondering, did the original person that created the proxy classes I'm looking at not use the Add Service Reference
wizard and went directly to use SvcUtil.exe
instead? I've used it before myself, but wondering is that what I need to use that will generate everything the WCF service is exposing? What switches would I need to get everything the service has to publicly offer? (FYI, I'm targeting .NET 4.0).
Upvotes: 1
Views: 1396
Reputation: 778
Can you post the hosting WCF service code for the Enum class?
Add Service Reference
may not create a complete reference file SO-SvcUtil.exe vs Add Reference. It's possible that SvcUtil.exe
was used instead. Try that and see if that builds a better proxy.
Upvotes: 1