Is there a way to build Entity Framework connection string to connect to a file-Database in a standalone c# application?
2 Answers
Something like this ?
<add name="ConnectionName"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|DatabaseName.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
1 Comment
Kishan
add @ before connection string connectionString=@""
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.