SysLogMap.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.ComponentModel.DataAnnotations.Schema;
  2. using System.Data.Entity.ModelConfiguration;
  3. namespace YZXYH.Repository.Models.Mapping
  4. {
  5. public class SysLogMap : EntityTypeConfiguration<SysLog>
  6. {
  7. public SysLogMap()
  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.SysLogType)
  16. .IsRequired()
  17. .IsFixedLength()
  18. .HasMaxLength(2);
  19. this.Property(t => t.LogMessage)
  20. .IsRequired();
  21. this.Property(t => t.UserNo)
  22. .HasMaxLength(50);
  23. this.Property(t => t.GraduationYear)
  24. .IsFixedLength()
  25. .HasMaxLength(4);
  26. this.Property(t => t.LogSite)
  27. .HasMaxLength(500);
  28. this.Property(t => t.UserHostAddress)
  29. .HasMaxLength(100);
  30. // Table & Column Mappings
  31. this.ToTable("SysLog");
  32. this.Property(t => t.Id).HasColumnName("Id");
  33. this.Property(t => t.SysLogType).HasColumnName("SysLogType");
  34. this.Property(t => t.LogDate).HasColumnName("LogDate");
  35. this.Property(t => t.LogCommand).HasColumnName("LogCommand");
  36. this.Property(t => t.LogMessage).HasColumnName("LogMessage");
  37. this.Property(t => t.LogErrorMessage).HasColumnName("LogErrorMessage");
  38. this.Property(t => t.UserNo).HasColumnName("UserNo");
  39. this.Property(t => t.GraduationYear).HasColumnName("GraduationYear");
  40. this.Property(t => t.LogSite).HasColumnName("LogSite");
  41. this.Property(t => t.UserHostAddress).HasColumnName("UserHostAddress");
  42. }
  43. }
  44. }