你可以做的,如下图所示。
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<ApplicationUser>(entity =>
{
entity.ToTable(name:"User");
});
}
2.
public class ApplicationUser : IdentityUser
{
......................
......................
public string DisplayName {get; set;}
}
我想建议你把那您ViewModel
而不是Core model (i.e. ApplicationUser)
,如下图所示。
using Microsoft.AspNet.Mvc;
using System.ComponentModel.DataAnnotations;
public class LoginViewModel
{
[Required]
[EmailAddress]
[Remote("Foo", "Home", ErrorMessage = "Remote validation is working for you")]
public string Email { get; set; }
}
4.因此你只有很少的属性,你可以保持ASPNETUsers
表本身内部的这些属性。哪个易于维护:)