WCF uses the original domain object instead of the generated proxy

I have a client website, WCF service, and domain object library (.cproj).

I want the client to use my domain object library directly, not a proxy generated version of the domain objects. Is there an easy way to do this?

+2


source to share


2 answers


Include the DLL reference in the client project. Then add a link to the service. When you add a service reference, it is possible to use the types in the dll and not create them in the .cs references.



+2


source


Include the library or DLL project in the client project instead of creating a service reference. You can create a service reference to create all the necessary WCF configurations to invoke the service, but just don't use the generated proxy or data types (like the code in Reference.cs) - use the types in the included DLL directly. You may have to write the client yourself, but this is simple and can basically be copied from the generated client in the help desk.



Thus, sharing data types directly between client and service causes breaks in service-oriented architectural patterns. Now both your client and service depend on the same DLL, not that the client just depends on the service.

0


source







All Articles