I'm using EF6 (6.1.3) code first and recently noticed that my OnModelCreating override in my DbContext class is not being called for some reason. I was trying to remove ManyToManyCascadeDeleteConvention from the default conventions and it wasn't working for some reason. When I put a breakpoint in OnModelCreating I noticed it was never even getting into that routine.
I checked this question -- EF 4.1 OnModelCreating not called -- and no I do'nt have an edmx file. Straight code first here.
public class DashboardDbContext : DbContext
{
public DashboardDbContext()
: base("DashboardDbContext")
{
Console.WriteLine("hi world"); // breakpoint DOES get hit here
}
//...
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder); // breakpoint DOESN'T get hit here
this.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
// more stuff...
}