The entity type ApplicationUser is not part of the model for the current context

I was having this same problem. I’m doing database first development with an EDMX file.
If you are using the connection string generated when adding the EDMX file in :base(“EDMXConnString”) you will most likely have this problem.

I fixed this by creating a standard connection string that pointed to the database where the ASP.NET Identity tables are.

<add name="MyConnString" connectionString="Data Source=server; Initial Catalog=db_name; User ID=user_id; Password=password; Connect Timeout=60;" providerName="System.Data.SqlClient" />

And then used that connection string in :base, and it worked!

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
    public ApplicationDbContext()
        : base("MyConnString")
    {
    }
}

Leave a Comment