1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| namespace MyWeb.Models.Data { using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema;
public partial class User {
[Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int UserID { get; set; } [Required(ErrorMessage = "姓名不能为空")] [Display(Name = "用户名")] public string Username { get; set; } [Required(ErrorMessage = "用户名不能为空")] [Display(Name = "用户名")] [StringLength(20, MinimumLength = 6, ErrorMessage = "用户名必须为{2}到{1}个字符")] public string LoginUser { get; set; } [Required(ErrorMessage = "密码不能为空")] [Display(Name = "密码")] [StringLength(50, MinimumLength = 6, ErrorMessage = "密码必须为{2}到20个字符")] [DataType(DataType.Password)] public string LoginPwd { get; set; } [Display(Name = "邮箱")] [Required(ErrorMessage = "邮箱必填")] [RegularExpression(@"^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$", ErrorMessage = "请输入正确的Email格式")] public string UserEmail { get; set; } [Display(Name = "手机")] [Required(ErrorMessage = "电话不能为空")] [RegularExpression(@"^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,2,3,8,9]))[0-9]{8}$", ErrorMessage = "请输入正确的手机格式")] public string UserPhone { get; set; } [Display(Name = "地址")] [Required(ErrorMessage = "地址不能为空")] [DataType(DataType.MultilineText)] public string UserSite { get; set; } } }
|