I have several different applications, among which I would like to share a C # listing. I cannot figure out how to share the enum declaration between a regular application and a WCF service.
Here is the situation. I have 2 lightweight C # removal apps and a WCF web service that all need to share enum values.
Client 1 has
Method1( MyEnum e, string sUserId );
Client 2 has
Method2( MyEnum e, string sUserId );
Webservice has
ServiceMethod1( MyEnum e, string sUserId, string sSomeData);
My first was to create the Common.dll library to encapsulate an enumeration, and then just link to this library in all projects where enumeration is required. However, WCF complicates the job because you need to mark up the listing so that it becomes an integral part of the service. Like this:
[ServiceContract] [ServiceKnownType(typeof(MyEnum))] public interface IMyService { [OperationContract] ServiceMethod1( MyEnum e, string sUserId, string sSomeData); } [DataContract] public enum MyEnum{ [EnumMember] red, [EnumMember] green, [EnumMember] blue };
So ... Is there a way to share the enumeration between the WCF service and other applications?
enums c # wcf
Keith G Oct 09 '08 at 14:25 2008-10-09 14:25
source share