AlumUserMap.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System.ComponentModel.DataAnnotations.Schema;
  2. using System.Data.Entity.ModelConfiguration;
  3. namespace YZXYH.Repository.Models.Mapping
  4. {
  5. public class AlumUserMap : EntityTypeConfiguration<AlumUser>
  6. {
  7. public AlumUserMap()
  8. {
  9. // Primary Key
  10. this.HasKey(t => t.Id);
  11. // Properties
  12. this.Property(t => t.Id)
  13. .IsRequired()
  14. .HasMaxLength(50);
  15. this.Property(t => t.Mobile)
  16. .IsRequired()
  17. .HasMaxLength(15);
  18. this.Property(t => t.Password)
  19. .HasMaxLength(50);
  20. this.Property(t => t.Name)
  21. .IsRequired()
  22. .HasMaxLength(50);
  23. this.Property(t => t.NickName)
  24. .HasMaxLength(50);
  25. this.Property(t => t.Gender)
  26. .IsRequired()
  27. .IsFixedLength()
  28. .HasMaxLength(1);
  29. this.Property(t => t.Class)
  30. .HasMaxLength(20);
  31. this.Property(t => t.Email)
  32. .HasMaxLength(50);
  33. this.Property(t => t.CityNo)
  34. .HasMaxLength(50);
  35. this.Property(t => t.GraduationYear)
  36. .IsFixedLength()
  37. .HasMaxLength(4);
  38. this.Property(t => t.WeChat)
  39. .HasMaxLength(50);
  40. this.Property(t => t.QQ)
  41. .HasMaxLength(15);
  42. this.Property(t => t.Mobile2)
  43. .HasMaxLength(15);
  44. this.Property(t => t.IsAudited)
  45. .IsRequired()
  46. .IsFixedLength()
  47. .HasMaxLength(1);
  48. this.Property(t => t.IsPublic)
  49. .IsRequired()
  50. .IsFixedLength()
  51. .HasMaxLength(1);
  52. this.Property(t => t.IsLocked)
  53. .IsRequired()
  54. .IsFixedLength()
  55. .HasMaxLength(1);
  56. this.Property(t => t.Vip)
  57. .IsFixedLength()
  58. .HasMaxLength(10);
  59. this.Property(t => t.Remark)
  60. .HasMaxLength(250);
  61. // Table & Column Mappings
  62. this.ToTable("AlumUsers");
  63. this.Property(t => t.Id).HasColumnName("Id");
  64. this.Property(t => t.Mobile).HasColumnName("Mobile");
  65. this.Property(t => t.Password).HasColumnName("Password");
  66. this.Property(t => t.Name).HasColumnName("Name");
  67. this.Property(t => t.NickName).HasColumnName("NickName");
  68. this.Property(t => t.Gender).HasColumnName("Gender");
  69. this.Property(t => t.Class).HasColumnName("Class");
  70. this.Property(t => t.Email).HasColumnName("Email");
  71. this.Property(t => t.Birthday).HasColumnName("Birthday");
  72. this.Property(t => t.CityNo).HasColumnName("CityNo");
  73. this.Property(t => t.GraduationYear).HasColumnName("GraduationYear");
  74. this.Property(t => t.ContactAddress).HasColumnName("ContactAddress");
  75. this.Property(t => t.HomeAddress).HasColumnName("HomeAddress");
  76. this.Property(t => t.Workunit).HasColumnName("Workunit");
  77. this.Property(t => t.WeChat).HasColumnName("WeChat");
  78. this.Property(t => t.QQ).HasColumnName("QQ");
  79. this.Property(t => t.Mobile2).HasColumnName("Mobile2");
  80. this.Property(t => t.DetaileInfo).HasColumnName("DetaileInfo");
  81. this.Property(t => t.IsAudited).HasColumnName("IsAudited");
  82. this.Property(t => t.IsPublic).HasColumnName("IsPublic");
  83. this.Property(t => t.IsLocked).HasColumnName("IsLocked");
  84. this.Property(t => t.Vip).HasColumnName("Vip");
  85. this.Property(t => t.TimeCreate).HasColumnName("TimeCreate");
  86. this.Property(t => t.TimeModify).HasColumnName("TimeModify");
  87. this.Property(t => t.Remark).HasColumnName("Remark");
  88. }
  89. }
  90. }