using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.ModelConfiguration; namespace YZXYH.Repository.Models.Mapping { public class SysLogMap : EntityTypeConfiguration { public SysLogMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Id) .IsRequired() .HasMaxLength(50); this.Property(t => t.SysLogType) .IsRequired() .IsFixedLength() .HasMaxLength(2); this.Property(t => t.LogMessage) .IsRequired(); this.Property(t => t.UserNo) .HasMaxLength(50); this.Property(t => t.GraduationYear) .IsFixedLength() .HasMaxLength(4); this.Property(t => t.LogSite) .HasMaxLength(500); this.Property(t => t.UserHostAddress) .HasMaxLength(100); // Table & Column Mappings this.ToTable("SysLog"); this.Property(t => t.Id).HasColumnName("Id"); this.Property(t => t.SysLogType).HasColumnName("SysLogType"); this.Property(t => t.LogDate).HasColumnName("LogDate"); this.Property(t => t.LogCommand).HasColumnName("LogCommand"); this.Property(t => t.LogMessage).HasColumnName("LogMessage"); this.Property(t => t.LogErrorMessage).HasColumnName("LogErrorMessage"); this.Property(t => t.UserNo).HasColumnName("UserNo"); this.Property(t => t.GraduationYear).HasColumnName("GraduationYear"); this.Property(t => t.LogSite).HasColumnName("LogSite"); this.Property(t => t.UserHostAddress).HasColumnName("UserHostAddress"); } } }