I am having trouble sending a collection of Enums to a WCF service method. I used this post as a guide: Sharing Enum with WCF Service
[ServiceContract]
[ServiceKnownType(typeof(MyEnum))]
[ServiceKnownType(typeof(List<MyEnum>))]
public interface IMyService{
[OperationContract]
MyEnum ServiceMethod1( );
[OperationContract]
IList<MyEnum> ServiceMethod2( );
[OperationContract]
IList<MyEnum> ServiceMethod3( MyEnum e );
[OperationContract]
IList<MyEnum> ServiceMethod4( IList<MyEnum> e );
}
[Serializable]
[DataContract]
public enum MyEnum{
[EnumMember] red,
[EnumMember] green,
[EnumMember] blue
};
ServiceMethod1, ServiceMethod2, and ServiceMethod3 work correctly. I get the following error when attempting to send a list of Enums to ServiceMethod4.
Operation 'ServiceMethod4' in contract 'IMyService' has a query variable named 'e' of type 'System.Collections.Generic.IList`1[MyEnum]', but type 'System.Collections.Generic.IList`1[MyEnum]' is not convertible by 'QueryStringConverter'. Variables for UriTemplate query values must have types that can be converted by 'QueryStringConverter'.
Do I need to create a custom QueryStringConverter?
Thanks!