Sharing types between WCF services and clients

I just submitted my first article to CodeProject, on sharing types between WCF (Windows Communication Foundation) services and clients.  As I mention in the article, there is already a CodeProject article on sharing types, but it addressed only the basic concepts.  As I actually tried to share types between a client and service, especially trying to share collections, I ran into a fair number of things I needed to figure out.   Since I often find information on CodeProject, I thought I'd document what I found and put it out there.  Hopefully it will help people trying to share types between WCF services and clients.  If you're interested in the topic, you can check out my article here.

2 comments: (+add yours?)

Malcolm Jack said...

Is sharing types with the client possible when the client is running a different .NET framework to the service? (eg: Silverlight client)

Joe Wirtley said...

The short answer is that I have never tried this, so I have no idea. My longer answer (okay, guess) would be that if the two platforms can access the same .NET assembly, then types can be shared between them. And even if the same assemblies cannot be shared, the time you should be sharing types is when you control the source code, so you should be able to build the types on both client and server and share the same source (putting aside any issues of types not being supported in Silverlight; I haven't developed with Silverlight).