Search code examples
c#sql-serverwcfentity-frameworkservice-reference

Using WCF with EF in many projects


I have WCF service responsible for exposing services and connecting with local database MSSQL.

I generate client of this service in a few projects, e.g. Proj1 and Proj2. In Proj3 I have references to Proj1 and Proj2. I want to use types from database, but they are in different namespaces (Proj1.ServiceReference.TablePerson, Proj2.ServiceReference.TablePerson).

How can I resolve this problem? I suppose using sth like converted/adapter for each type (table) is not the best solution.


Solution

  • What you should do is create a separate project to create your service references in, and then have Proj1 Proj2 and Proj3 all reference that project. That way you will only have to generate one set of classes for your service reference.