Reputation: 936
Just need some help with this.
I have written a WCF service which passes through a list of custom objects (these objects are marked as serializable, so they pass through fine).
What do I need to write in the client to be able to receive these objects? I'd like to be able to receive them without having a definition of the class locally. I tried getting them as an object but I get the error
Cannot implicitly convert type 'System.Collections.Generic.List<TestService.Member>' to 'System.Collections.Generic.List<object>'
Hope this is enough information, any pointers would be useful.
Upvotes: 0
Views: 1720
Reputation: 44971
I think you need to do a couple of things:
1) Create a custom class for this collection class that inherits from System.Collections.Generic.List
2) Decorate this new class with CollectionDataContract
3) In the client, edit reference.svcmap and add an entry for this new item to the CollectionMappings section. To find the svcmap, show all files in the project and expand the WCF service reference.
For the class:
[CollectionDataContract]
public class MemberCollection: List<Member>
For the svcmap:
<CollectionMapping TypeName="MyNameSpace.MemberCollection" Category="List" />
Upvotes: 0