SF Developer
SF Developer

Reputation: 5384

WCF call needs to receive a GENERIC param that can receive a list of different "Types"

What is the recommended way to provide a WCF call that has a "Generic" param... something like this.

[ServiceContract]
public interface IDbSync
{
   [OperationContract]
   void UploadTable(Data<T> table);
}

...where
one client might upload Data<User_Entity>,
another client might upload Data<Address_Entity>

...all using the same procedure call

Is this possible with Generics or am I supposed to create one OperationContract x List ??

Upvotes: 2

Views: 200

Answers (1)

Wouter de Kort
Wouter de Kort

Reputation: 39888

It is not possible to have a method that takes an open generic type. You can have methods that take a closed generic type.

If you want to have overloading in your WCF methods you should make sure that the operation name is unique (by using the [OperationContract(Name=...)] attribute)

Upvotes: 2

Related Questions