我有一个MVC 5应用程序,它使用默认身份验证.用户配置文件是我们模型的一部分,这意味着有几个类具有UserInfo的外键.有2个DbContext,一个用于模型,另一个用于UserInfo.
public class ApplicationDbContext : IdentityDbContext<UserInfo>
{
public ApplicationDbContext()
: base("Profile")
{
}
}
public class UserInfo : IdentityUser
{
public UserInfo ()
{
LibraryItems = new List<LibraryItem>();
if (UserGroup == UserGroupEnum.ANALYST)
{
Companies = new List<Company>();
}
DateCreate = DateTime.Now;
DateUpdate = DateTime.Now;
DateDelete = DateTime.Now;
}
[DisplayColumnInIndex]
[DisplayName("Is Active ?")]
public bool IsActive { get; set; }
[Timestamp]
public byte[] RowVersion { get; set; }
//[ValidateFile(ErrorMessage = "Please select a PNG image smaller than 1MB")]
//[DisplayFormat(ApplyFormatInEditMode = …Run Code Online (Sandbox Code Playgroud)