Here is details of the error:
There was an error running the selected code generator: 'Unable to retrive metadata for 'Models.ApplicationUser'. Multiple object sets per type are not supported. The objects sets 'ApplicationUsers' and 'Users' can both contain instances of type 'Models.ApplicationUser'.
I am getting this while scaffolding a view in MVC project. I got the same error if i try to scafford a controller. I have seen a few of this error on SO but it seems those don't apply to my case.
Here is my DbContext. It is just the one comes with default MVC projects with few more DbSets. I don't have any DbSet for ApplicationUsers or Users or anything like that on my context or anywhere in the project. But why am i getting this error?
public class ApplicationUser : IdentityUser
{
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
public virtual DbSet<ItemType> ItemTypes { get; set; }
public virtual DbSet<Item> Items { get; set; }
public virtual DbSet<Category> Categories { get; set; }
public virtual DbSet<List> Lists { get; set; }
public virtual DbSet<Level> Levels { get; set; }
}
Here is my List class. I suspect this error has something to do with it. But why?
public class List
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
public string UserId { get; set; }
public virtual ICollection<Item> Items { get; set; }
public virtual ApplicationUser User { get; set; }
}
This is the only place that has reference to ApplicationUser in all entities. One more question, a bit off topic is 'was it bad decision to extend IdentityDbContext rather than creating a new DbContext in the application?
Environment: MVC5, EF6 Code First, VS2013 Ultimate, C#.