Kuckucksei
Kuckucksei

Reputation: 221

Hard code Entity Framework connection string

When I add an Entity Framework Model to a class library, it creates an app.config file where the connection string is stored.

What do I have to do, to bake the connection string into the project output (*.dll)?

Upvotes: 3

Views: 1760

Answers (1)

agent-j
agent-j

Reputation: 27943

Store it in a constant or compute it in a variable dbConnect, then pass into the constructor.

MyDatabaseEntities = new MyDatabaseEntities(dbConnect);

Upvotes: 5

Related Questions