ASP.NET Identity - Multiple object sets per type are not supported c# entity-framework


Using ASP.NET Identity in my project resulted in an error.

Multiple object sets per type are not supported. The object sets 'Identity Users' and 'Users' can both contain instances of type 'Recommendation Platform.Models.ApplicationUser'.

In StackOverflow, I came across a few inquiries regarding this problem. each signal on twoDbSet identical objects of that class. though in myDbContext not the same varieties ofDbSets . An exception is raised onFindAsync() method used while login.

if (ModelState.IsValid)
    var user = await UserManager.FindAsync(model.UserName, model.Password);
    if (user != null && user.IsConfirmed)

The issue is that I do not have two.DbSets the same kind. My contexts are as follows:

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    public ApplicationDbContext()
        : base("DefaultConnection")

    public System.Data.Entity.DbSet<RecommendationPlatform.Models.ApplicationUser> IdentityUsers { get; set; }



public class RecContext : DbContext
    public RecContext()
        : base("RecConnection")
        Database.SetInitializer<RecContext>(new DropCreateDatabaseIfModelChanges<RecContext>());

    public DbSet<Recommendation> Recommendations { get; set; }
    public DbSet<Geolocation> Geolocations { get; set; }
    public DbSet<Faq> Faqs { get; set; }
    public DbSet<IndexText> IndexTexts { get; set; }

What might be the root of this issue? Perhaps a problem with the built-in ASP.NET Identity functionalities? However, what isUsers type? It's not on my app, either.

8/8/2018 12:19:31 PM

Accepted Answer

6/21/2014 3:54:17 PM

Popular Answer

Remove the line created automatically by scaffold last by reviewing the file "ApplicationDbContext.cs," which should read as follows:

public System.Data.Entity.DbSet<Manager.Models.ApplicationUser> IdentityUsers { get; set; }

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow