Reputation: 4513
I've create a DAL layer using EF 4.1 and now want to use it in a class library. When I run the project it asks for the connection string in the config file, but there is no config file in a class project. When I use the DAL in my Web project - it would work just fine. (I've got the connection string there, because I started the EF inside the web project and moved it to a seperate project).
Ideas? :)
Thanks
Upvotes: 0
Views: 98
Reputation: 52280
you have to copy the connectsting string section into each project you end using your library. Or you redesing your DAL to pass in a Connection/Connectionsstring as a parameter for creation.
Or so I read your question, as you cannot start a DLL I guess you referenced it into a new project ... so in the new project you have to duplicate the connections string too.
BTW: you can put a App.config into a DLL (and EF will do so if you use the wizard) - but I don't like this approach very much - I go with the parameter for creation in my projects (or with a ConfigInfo object that can be injected easier)
Upvotes: 2