I've created an mvc project with following connection string (which is a default):
<add name="TestDb"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
I would like to switch from SQL Server Express to one of the file databases, so that I can store my db in same repository. How can I do this (steps/connection string) ?
I'm using MVC code first approach. Thank you.
Change your connection string to this:
<add name="TestDb" providerName="System.Data.SqlServerCe.4.0" connectionString= "Data Source=|DataDirectory|\aspnetdb.sdf" />
With Code First, you typically use the context class name as your connection string name.