Reputation: 1159
I've created WCF service application
where I am using Entity Framework
to access data. I created new Console application
and added reference to my WCF service application
.
I don't understand two things:
web.config
from WCF Service Application
to my Console application
?Entity Framework Package
to my Console Application
?My intention was have data access in separated project. Now I have to add configs and EF
references to every project which wants to access data. That is inconvinient. Is there any way to get rid of that?
Upvotes: 2
Views: 49
Reputation: 273199
and added reference to my WCF service application
That is possible but not the right thing to do.
It is better to put your Db related code in a separate Class Library and reference that from both projects. And maybe another Class Library for shared business logic.
Why I have to copy web.config
I'm surprised if that even works. Every end project (.EXE) needs to provide the configuration. No way around that. You probably have to copy the ConnectionString part to both the Web.Config and App.Config files of the end projects.
Why I have to add Entity Framework Package
Not always necessary but in this case probably for the configuration and setup. For most packages, it would be enough to add it once to the class library.
I wouldn't consider this a big deal. See "Manage Packages for Solution" when you right-click the solution node.
Upvotes: 1