Reuse Collection types Issue

In VS 2008, there is a problem with reusing collection types when you configure a WCF service and wish to ‘Reuse types in all referenced assemblies’. If you want to pass collections around via your WCF service, a Visual Studio will create a proxy class for each collection type regardless whether your collection type is included within referenced assemblies or not.

Solution:

I will show you how to bypass this shortcoming.

First, locate the Reference.svcmap file for the WCF service reference you are having problems with. If you can’t see it, ensure your project has “Show All Files” enabled.

If you open the Reference.svcmap, you’ll find that it is written in XML. Locate the CollectionMappings node. Within CollectionMappings, add your collection type so when you update your service reference, it recognizes it as a known type and will not generate a proxy class for you.

Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.