using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.ModelConfiguration; namespace YZXYH.Repository.Models.Mapping { public class QuestionnaireMap : EntityTypeConfiguration { public QuestionnaireMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Id) .IsRequired() .HasMaxLength(32); this.Property(t => t.Title) .IsRequired() .HasMaxLength(150); this.Property(t => t.QuestionContent) .HasMaxLength(int.MaxValue); this.Property(t => t.Footer) .HasMaxLength(int.MaxValue); this.Property(t => t.CreateUserNo) .HasMaxLength(50); this.Property(t => t.ModifyUserNo) .HasMaxLength(50); this.Property(t => t.Remark) .HasMaxLength(500); this.Property(t => t.IsLocked) .IsRequired() .IsFixedLength() .HasMaxLength(1); // Table & Column Mappings this.ToTable("Questionnaires"); } } }