When setting up the connection string for the Entity framework code first as default to use, the connection name should be the FULL namespace to the context.
For Eg.
<add name="EFWebTest.Models.BlogContext" providerName="System.Data.SqlClient" connectionString="Data Source=.;Integrated Security=SSPI;Initial Catlog=aspnet-EFWebTest" />
The connection string is using sql server. So when the context is loaded, the default database structure will be created in sql server.
Another option is to pass the connection string name in the dbcontext constructor such as,
public sampleDbContext : base("DefaultConnection") {}
No comments:
Post a Comment