QuestionnaireMap.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.ComponentModel.DataAnnotations.Schema;
  2. using System.Data.Entity.ModelConfiguration;
  3. namespace YZXYH.Repository.Models.Mapping
  4. {
  5. public class QuestionnaireMap : EntityTypeConfiguration<Questionnaire>
  6. {
  7. public QuestionnaireMap()
  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.Title)
  16. .IsRequired()
  17. .HasMaxLength(150);
  18. this.Property(t => t.QuestionContent)
  19. .HasMaxLength(int.MaxValue);
  20. this.Property(t => t.Footer)
  21. .HasMaxLength(int.MaxValue);
  22. this.Property(t => t.CreateUserNo)
  23. .HasMaxLength(50);
  24. this.Property(t => t.ModifyUserNo)
  25. .HasMaxLength(50);
  26. this.Property(t => t.Remark)
  27. .HasMaxLength(500);
  28. this.Property(t => t.IsLocked)
  29. .IsRequired()
  30. .IsFixedLength()
  31. .HasMaxLength(1);
  32. // Table & Column Mappings
  33. this.ToTable("Questionnaires");
  34. }
  35. }
  36. }