While using Code first in EF 4.3 the default generated db name will look like your namespace something.datacontext.
To change this behavior and use a custom name:
To change this behavior and use a custom name:
public class StockWatchDataContext:DbContext
{
public StockWatchDataContext(): base("StockWatch") //add your db name and override the base constructor
{ }
public DbSet Security { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove();
}
}
Also make sure that you are not using localdb as the db server instance or you wont see that in SQL management studio.
No comments:
Post a Comment