1. If I create new MVC project it has default connection string :
< add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial
Catalog=aspnet-OneVeryBad.Web-20130301153805;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-OneVeryBad.Web-20130301153805.mdf"
providerName="System.Data.SqlClient" />
2. I create my context inheriting from DbContext :
public class BadContext : DbContext
{
public BadContext() : base("BadContext")
{
}
/* DbSets */
}
3. Change connection string name to BadContext to work with EF:
< add name="BadContext" connectionString="Data Source=(LocalDb)\v11.0;Initial
Catalog=aspnet-OneVeryBad.Web-20130301153805;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-OneVeryBad.Web-
20130301153805.mdf" providerName="System.Data.SqlClient" />
Now I sucessfully can store data to LocalDb, but cannot register users :
CREATE DATABASE permission denied in database 'master'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'.
unless I change connection string back to original :
< add name="DefaultConnection" ...
I see my context tables and membership tables in local db through VS server explorer. But cannot make membership work with EF connection string. How can I solve this ? Originally I want to store all tables in localdb so that its always with me in the project wherever I go.