QuestionnaireItemMap.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System.ComponentModel.DataAnnotations.Schema;
  2. using System.Data.Entity.ModelConfiguration;
  3. namespace YZXYH.Repository.Models.Mapping
  4. {
  5. public class QuestionnaireItemMap : EntityTypeConfiguration<QuestionnaireItem>
  6. {
  7. public QuestionnaireItemMap()
  8. {
  9. // Primary Key
  10. this.HasKey(t => t.Id);
  11. // Properties
  12. this.Property(t => t.Id)
  13. .IsRequired()
  14. .HasMaxLength(32);
  15. this.Property(t => t.QuestionnaireNo)
  16. .IsRequired()
  17. .HasMaxLength(32);
  18. this.Property(t => t.QuestionnaireTitle)
  19. .IsRequired()
  20. .HasMaxLength(150);
  21. this.Property(t => t.FullName)
  22. .IsRequired()
  23. .HasMaxLength(50);
  24. this.Property(t => t.Gender)
  25. .IsRequired();
  26. this.Property(t => t.GraduationYear)
  27. .IsRequired();
  28. this.Property(t => t.Class1)
  29. .HasMaxLength(10);
  30. this.Property(t => t.Headmaster)
  31. .HasMaxLength(50);
  32. this.Property(t => t.Profession)
  33. .HasMaxLength(50);
  34. this.Property(t => t.WorkUnit)
  35. .HasMaxLength(50);
  36. this.Property(t => t.Duties)
  37. .HasMaxLength(30);
  38. this.Property(t => t.Industry)
  39. .HasMaxLength(50);
  40. this.Property(t => t.WorkUnitAddress)
  41. .HasMaxLength(500);
  42. this.Property(t => t.FamilyAddress)
  43. .HasMaxLength(500);
  44. this.Property(t => t.Speciality)
  45. .HasMaxLength(100);
  46. this.Property(t => t.Hobby)
  47. .HasMaxLength(100);
  48. this.Property(t => t.QQ)
  49. .HasMaxLength(20);
  50. this.Property(t => t.WeChat)
  51. .HasMaxLength(30);
  52. this.Property(t => t.PhoneNumber)
  53. .HasMaxLength(20);
  54. this.Property(t => t.Email)
  55. .HasMaxLength(50);
  56. this.Property(t => t.Remark)
  57. .HasMaxLength(500);
  58. // Table & Column Mappings
  59. this.ToTable("QuestionnaireItems");
  60. }
  61. }
  62. }