I want to utilize LocalDb since I am first learning to develop in EF5-code. How can I modify the LocalDb database file's default location? According to http://blogs.msdn.com/b/sqlexpress/archive/2011/10/28/localdb-where-is-my-database.aspx, the default location is the percent USERPROFILE percent directory.
The SqlCe DbConnectionFactory that allows a parameter for database path/name was what I was using before. When I use the AttachDbFileName option, if the database doesn't already exist (it's intended to build it! ), an error is raised.
This worked for me thanks to these words. There is an easy solution. In essence, I added
<connectionStrings> <add name="DataModel.Context" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=database;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\database.mdf" providerName="System.Data.SqlClient" />
Added the app.config's settings section, and it miraculously changed "database" with the name of my real database (DbContext). If the database is empty, EF code first also flawlessly creates it.