你可以做的,如下圖所示。
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
表本身內部的這些屬性。哪個易於維護:)