using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; using ConsoleHttp.Model; using MqttMsgServer.Model; namespace MqttMsgServer.Dao { public class ApplicationDbContext:DbContext { public ApplicationDbContext():base(AppSetting.GetValue("SqlServerConnectionString")) { // Database.SetInitializer(new DropCreateDatabaseIfModelChanges()); } public IDbSet ClientInfos { get; set; } public IDbSet ReceiveMessageRecords { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity().Property(i=>i.Id).HasMaxLength(50); modelBuilder.Entity().Property(i=>i.Id).HasMaxLength(50); } } }