job44927

I have a wcf service. I have a datacontacts as a separate project that is reference by this wcf service. I have multiple clients that use the wcf service. This is a closed system.

Is it a best pratice to have each client reference the datacontract project or should each client just generate a proxy and get a reference to the datacontract thru the proxy.



Re: Windows Communication Foundation (Indigo) Best practise for DataContract sharing

Sajay - MSFT

You can share contracts, there is no limitation. That being said, you resort to assembly sharing techniques which might be a design decision. Do you want to tightly couple your clients with the contracts If you are comfortable with that then there is no point in creating proxies for each client but if your plan to distribute/develop your clients independently later then you probably want to redistribute proxy/wsdl's rather than data contract assemblies.






Re: Windows Communication Foundation (Indigo) Best practise for DataContract sharing

Michael Olivieri

In my opinion it is best to get a reference to the datacontract thru the proxy - for a few reasons:

  1. If you plan on doing any callback operations you will need to reference the datacontract thru the proxy anyway - this is the same has needing to referencing the local interface (located in the proxy).
  2. If you use the object from the assembly and not the proxy you are going to have to cast it as the local type anyway (overhead)
  3. WCF was designed to make everything go through the proxy for a reason - think about remoting..!!

Mike






Re: Windows Communication Foundation (Indigo) Best practise for DataContract sharing

Sha Sea

Hi,

I want to achive the same thing like i mentioned in scenario 2 but failed to do it.

Also how can proxy get the information when the DataContract is in separate project

scenario#1

I am using DataContractAttribute for FaultException classes in WCF.

Its working perfectly on client side.(2 tiers)

scenari#2

But now i want to make DataContractAttribute classes in separate dll.

Using that dll in my WCF and trying to catch on client side.(3 tiers)

But this time my code is not catching FaultException.

In both scenario cclasses are same but DataContract classes are compile as WCF service only.

Any genious can answer this question

Thanx,

sha