You need to have a context class that derives from DbContext when you're using Entity Framework.
Asp.net Identity uses EF and the default template creates the below class:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
This class does not derive directly from DbContext. For my own data (my classes that I want to persist to the db) should I create my own db context class?
If I want to do an operation that will update both the identity user and one of my own classes, I need to use both contexts. So this does not feel very natural.
Should I keep using the ApplicationDbContext class as context for my own classes as well? Would that work?
What is the best method to use EF for my own classes while using identity?