Sunday, June 08, 2008 4:35 PM
Reusing types in WCF
For those of you who ever wrote a web service (I guess most of you have), sharing types was an impossible mission. If you had defined a type in the server side (the web service side), when consuming it on the client side, the proxy generated for you contained the same type but under a different namespace. Do you know that problem?!
When WCF shipped, a new possibilities emerged. One can now share types and reuse them.
In order to do so, all you need to do is get into the "Configure Service Reference.."
Now verify that the "Reuse types in all referenced assemblies" is checked.
By default it will be checked!
The only issue with this mechanism is the fact that Data Contracts (Interfaces) are not being shared! I do not know what is the reason, but in order to overcome this "Bug", you have to manually delete the contract from the generated proxy and replace it with the shared contarct.