I have a .NET MVC 3 project where I use a sql member provider and entity infrastructure.
I created a new database on my SQL server and created all the objects for the membership provider using aspnet_regsql.exe , I changed the connection string and it works fine.
Now I want to use the framework entity for db interaction. I use Code-First, so I created a simple entity class, and I can save the data in db and get it.
The problem is that the place where the entity infrastructure stores data is mistery. I cannot find any database in my project, and there are no new tables in my SQL database.
If I add a second connection string to web.config (the first for a membership provider), my infrastructure entity stops working (I assume that it should create new tables in my database), but it does not.
My entity class is as follows:
public class MyEntities : DbContext { public DbSet<Business> Businesses { get; set; } }
And I get an Invalid object name 'dbo.Businesses'
Any help would be greatly appreciated.
my connection strings are as follows:
<add name="ApplicationServices" connectionString="Data Source=.; Initial Catalog=MyDbName; Persist Security Info=True; User ID=sa; Password=mypassword" providerName="System.Data.SqlClient" /> <add name="MyEntities" connectionString="data source=.; Initial Catalog=MyDbName; Persist Security Info=True; User ID=sa; Password=mypassword" providerName="System.Data.SqlClient" />
source share