I know that WCF doesn't support open generic types. But my example uses
closed generic types, i.e. IGeneric<int> and IGeneric<string>. This is not
The problem is not being able to differentiate the names of two closed
generic methods resulting in deriving an interface from a generic interface.
The following is closed:
public interface IAggregate : IGeneric<int>, IGeneric<string>
It has two methods called Get(), one that takes an int and the other a
string. They will be named GetOf_Int32 and GetOf_String by the runtime. But
I can't see a way to "get at" these methods so that they can have a Name
assigned. For example, if they were overloads you could do this:
public interface IAggregate
int Get( int value );
int Get( string value );
Unfortunately, the serializer doesn't seem to be aware of the fact that it's
possible to derive an interface multiple times from different closed
"versions" of a single generic interface. If it did, it could differentiate
the names itself.
"Arkady Frenkel" <firstname.lastname@example.org> wrote in message
> WCF doesn't not support open generic types , so the only way to use
> public interface ISomeInterface<SomeConcreteType>
> T Get();
> "Mike Scott" <email@example.com> wrote in message
>>I seem to have found a limitation in WCF when using generic interfaces.
>> public interface IGeneric<T>
>> T Get();
>> public interface IAggregate : IGeneric<int>, IGeneric<string>
>> Trying to use IAggregate fails because there are two Get() methods, one
>> which takes an int and one which takes a string. WCF's exception message
>> helpfully suggests adding a Name="xxx" parameter to the
>> OperationContract. However, since the Get() method is defined in
>> IGeneric<T>, it's not possible to put separate Name="xxx" parameters of
>> the closed generic methods.