1

How can I send a generic list of the type of an interface to a WCF method? the problem I have is that the client generated the list as List<object> instead of using the interface.

Andrew Hare
  • 320,708
  • 66
  • 621
  • 623
ryudice
  • 33,818
  • 31
  • 103
  • 154

1 Answers1

6

That's probably because the client doesn't know what implementations exist for this interface as they are not part of the exposed metadata. You could use known types to include those possible implementation in the WSDL.

Darin Dimitrov
  • 960,118
  • 257
  • 3,196
  • 2,876
  • Where should I place the knowtype attribute? Should I create a class that implements my interface and define is a datacontract and the apply the knowtypeattribute with the interface type? and should I leave my parameter as List? – ryudice Mar 16 '11 at 22:48
  • @ryudice, there are many possibilities, all covered by the article on MSDN I linked to. Personally I do this in web.config as it is the least obtrusive way. – Darin Dimitrov Mar 16 '11 at 22:49