using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.ModelConfiguration; namespace YZXYH.Repository.Models.Mapping { public class VocationInfoMap : EntityTypeConfiguration { public VocationInfoMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Id) .IsRequired() .HasMaxLength(50); this.Property(t => t.VocationName) .IsRequired() .HasMaxLength(50); this.Property(t => t.VocationType) .IsRequired() .HasMaxLength(50); this.Property(t => t.SortNo) .IsFixedLength() .HasMaxLength(4); this.Property(t => t.IsLocked) .IsRequired() .IsFixedLength() .HasMaxLength(1); // Table & Column Mappings this.ToTable("VocationInfos"); this.Property(t => t.Id).HasColumnName("Id"); this.Property(t => t.VocationName).HasColumnName("VocationName"); this.Property(t => t.VocationType).HasColumnName("VocationType"); this.Property(t => t.SortNo).HasColumnName("SortNo"); this.Property(t => t.IsLocked).HasColumnName("IsLocked"); this.Property(t => t.Remark).HasColumnName("Remark"); } } }