I had problems understanding the whole ASP.Net Identity framework, I first tried to integrate Identity 1.0 into an existing application, but in the end I had 2 DbContext classes, my application data was in MyDbContext and Identity user data in IdentityDbContext.
I want to use one DbContext for both my application data and for identification related data, and I found on another issue that I can use IdentityDbContext the same way I use DbContext; however, I think I missed something.
I am using a sample project from the Identity team
PM> Install-Package Microsoft.AspNet.Identity.Samples -Pre
and tried to insert DbSet properties in ApplicationDbContext
public class ApplicationDbContext : IdentityDbContext { public ApplicationDbContext() : base("DefaultConnection") { } static ApplicationDbContext() {
I use the ApplicationDbInitializer seed method to populate these two tables, for example:
Student s = new Student { Name = "John" ... }; db.students.Add(s); db.SaveChanges();
But EF does not seem to create these 2 tables, and the seed method is not called, what happens?
EDIT:
Well, I need to run code that uses the database for EF to delete and recreate the database.
Is there any overhead when using IdentityDbContext to manage all the data in my application? What is the difference between using IdentityDbContext and using the generic version of IdentityDbContext <IdentityUser>?