开发者

single table with multiple models mapping in code first

开发者 https://www.devze.com 2023-03-26 10:04 出处:网络
i just looking for 2 weeks on this situation. i wanna make like those models: public class ChangePasswordModel

i just looking for 2 weeks on this situation. i wanna make like those models:

public class ChangePasswordModel
{
    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "Current password")]
    public string OldPassword { get; set; }

    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "New password")]
    public string NewPassword { get; set; }

    [DataType(DataType.Password)]
    [Display(Name = "Confirm new password")]
    [Compare("NewPassword", ErrorMessage = " ")]
    public string ConfirmPassword { get; set; }
}

public class LogOnModel
{
    [Required]
    [Display(Name = "User name")]
    public string UserName { get; set; }

    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [Display(Name = "Remember me?")]
    public bool RememberMe { get; set; }
}

public class 开发者_如何学编程RegisterModel
{
    [Required]
    [Display(Name = "User name")]
    public string UserName { get; set; }

    [Required]
    [DataType(DataType.EmailAddress)]
    [Display(Name = "Email address")]
    public string Email { get; set; }

    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [DataType(DataType.Password)]
    [Display(Name = "Confirm password")]
    [Compare("Password", ErrorMessage = " ")]
    public string ConfirmPassword { get; set; }
}

on the same table with code first. how this can be possible?

0

精彩评论

暂无评论...
验证码 换一张
取 消