Reputation: 13
I am trying to initialize the database on first startup to create the database tables needed for identity.net. So then FluentMigrator can run without errors saying the tables don't exist.
So far in Global.aspx I have:
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
Migrator.Runner.MigrateToLatest();
but this doesn't seem to create the tables?
Any help would be much appreciated!
Upvotes: 1
Views: 107
Reputation: 37520
I don't think newing up the DbContext
is enough to trigger the initializer. Try to access something on the DbContext
...
var context = new ApplicationDbContext();
context.Users.Count();
Upvotes: 1