When creating a database, I use Identity for authorization. In the default file IdentityModels.cs created a user-class ApplicationUser inherited from IdentityUser and, in fact, the context public class ApplicationUserDbContext : IdentityDbContext<ApplicationUser> (all by guide).
Next, I need another entity Subject . I added it as a new class, and here's the bad luck: I don’t know how to form a new table from it. I create a migration, but not a word about my Subject . I understand that you can add it manually, but why is it not added by itself ?? For some reason, the migration config was automatically closed by that context, and as if it does not know about the new entity: internal sealed class Configuration : DbMigrationsConfiguration<Models.ApplicationUserDbContext>
I already zadolbalsya sit with it, maybe something is not so understand? I ask for help, waiting for leading questions, if I wrote something incomprehensibly

  • one
    added a property to ApplicationUserDbContext ? public DbSet<Subject> Subjects{ get; set; } public DbSet<Subject> Subjects{ get; set; } ? - Andrei
  • @Andrei, no .. If you can, please explain. I no longer taste it, my head swells from the amount of dug-in information :( - guitarhero

1 answer 1

By trial and error, I realized that it was impossible to add collections of type DbSet<> to an entity class ... It was worth replacing it with List<> , and the correct table I needed was created