I'm having issues to configure LocalDB properly. This is the setup:
- Project "DataAccess", containing an EF6 DbContext with code first migrations enabled. No app.config, instead referring to the project below via StartUpProject parameter.
Project "Web", an MVC application that contains the following connection string:
<add name="devDatabase" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;Integrated Security=True;AttachDbFilename=c:\Temp\devDB.mdf" providerName="System.Data.SqlClient"/>
When calling Update-Database
in the data project, an MDF file DataAccess.DataContext.mdf
is created in the App_Data directory of the MVC project. This is the first problem, as it's not what I'd expect from the configuration above.
The second problem is that when actually starting the MVC application and accessing the database, another set of MDF files is created. In my case this will result in two more files:
DataAccess.DataContext`1[Entity1].mdf
DataAccess.DataContext`1[Entity2].mdf
So now I have my data scattered over a bunch of files, which is totally useless of course. Can anyone point me in the right direction what I'm missing here?