Reputation: 506
Is there a way to build Entity Framework connection string to connect to a file-Database in a standalone c# application?
Upvotes: 2
Views: 123
Reputation: 2422
Something like this ?
<add name="ConnectionName"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|DatabaseName.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
Upvotes: 1
Reputation: 19101
You might take a look at Sql Express, which can be embedded directly into your application.
Quote from the page:
Do you need to embed SQL Server Express into an application? LocalDB is a lightweight version of Express that has all its programmability features yet runs in user mode and has a fast, zero-configuration installation. (...) LocalDB runs in-process with applications and not as a service.
You can download the installer from that same page.
Upvotes: 0