Я делаю ASP.NET MVC Project с идентификатором пользователя. Мой класс User теперь наследуется от IdentityUser:
[Table("Users")]
public class User : IdentityUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Patronymic { get; set; } // Отчество
public string Avatar { get; set; }
public DateTime? DateOfBirth { get; set; } // Дата рождения
public DateTime? RegisterDate { get; set; } // Actualy it is a dateTime :)
public bool? Sex { get; set; }
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<User> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
Затем я сделал класс Доктора, который наследует от него:
[Table("Doctors")]
public class Doctor : User
{
[Key]
public int DoctorId { get; set; }
public string CurriculumVitae { get; set; }
}
Как видите, я добавил поле настраиваемого индекса DoctorId.
Но UserManager не может создать сущности
Итак, вопрос КАК ДОБАВИТЬ ИНДЕКС ПОЛЬЗОВАТЕЛЬСКОГО INT ID?