I\'m creating a simple application for university where a student can make some type of request which is then processed by an employee of particular speciality.
I wo
@Dragonheart: I tried this repro and it would work fine if you remove the DBSet declarations in you context class. The IdentityDbContext would handle you TPH pattern and add a Discriminator column in the table to differentiate the child classes.
As ApplicationUser
is inherited from IdentityUser
, remove it from your DbContext
class. On the other hand, there is no need to create an abstract
class (you can create if you prevent from creating a user except from Student
or Employee
classes. For more information you might have a look at Table-per-Hierarchy.
For Register
part, try something like that:
Student user = new Student
{
UserName = model.UserName,
FirstName = model.FirstName,
LastName = model.LastName,
Email = model.Email
};
var result = UserManager.Create(user, model.Password);
Hope this helps...