I am writing an ASP MVC 3 application. I am using Sql Server 2008 R2 for my database.
I created my data model and my DbContext called EFDbContext.
I created my database which is named SportsStore.
My connection string is:
<add name="EFDbContext" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=SportsStore;Integrated Security=True;Pooling=False" providerName="System.Data.SqlClient" />
I run the app and no data is shown.
I figured out that EF automatically generates a new database SportsStore.Domain.Concrete.EFDbContext, but I want it to use SportsStore which I have previously created, and to automatically map my model properties to table columns.
If I disable the autogenerate database feature I get the following error:
Cannot open database "SportsStore.Domain.Concrete.EFDbContext" requested by the login
Shouldn't Entity Framework try to open SportsStore database? Why is it trying to open that one? Do I have a mistaken connection string?