I have two projects:
- Console application
- Class Library
I want the Class library to define the classes, create edmx files and to have a partial connection string, like:
<add name="BlogEntities" connectionString="metadata=res://*/Blog.csdl|res://*/Blog.ssdl|res://*/Blog.msl;provider=System.Data.SqlClient;provider connection string='{0}'" providerName="System.Data.EntityClient" />
I want my Class Library to define the csdl, ssdl and msl files. My Console application doesn't care about the metadata, it will only define the database, user and password.
How can I split the connection string in two like this?
I found out that I can name all entities with the same name, e.g.
Entities. Myapp.configwill need to be on the Console Application, but I can use a singleConnectionString.The metadata can be set to
res://*/and it will work globally. From MSDN:I can also force that any plug-able module will use a
ConnectionStringpassing on the context constructor: