UserReplyMap.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System.ComponentModel.DataAnnotations.Schema;
  2. using System.Data.Entity.ModelConfiguration;
  3. namespace YZXYH.Repository.Models.Mapping
  4. {
  5. public class UserReplyMap : EntityTypeConfiguration<UserReply>
  6. {
  7. public UserReplyMap()
  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.TypeReplyId)
  16. .IsRequired()
  17. .IsFixedLength()
  18. .HasMaxLength(10);
  19. this.Property(t => t.ParentId)
  20. .IsRequired()
  21. .HasMaxLength(50);
  22. this.Property(t => t.ContentReply)
  23. .IsRequired();
  24. this.Property(t => t.IsLocked)
  25. .IsRequired()
  26. .IsFixedLength()
  27. .HasMaxLength(1);
  28. // Table & Column Mappings
  29. this.ToTable("UserReply");
  30. this.Property(t => t.Id).HasColumnName("Id");
  31. this.Property(t => t.TypeReplyId).HasColumnName("TypeReplyId");
  32. this.Property(t => t.ParentId).HasColumnName("ParentId");
  33. this.Property(t => t.ContentReply).HasColumnName("ContentReply");
  34. this.Property(t => t.TimeReply).HasColumnName("TimeReply");
  35. this.Property(t => t.IsLocked).HasColumnName("IsLocked");
  36. }
  37. }
  38. }