MVC 上下文类

版权声明:未经允许,不得转载 https://blog.csdn.net/qq_29881259/article/details/77880858
 public PerContext()
            : base("Name=Default")
        {
            Database.SetInitializer<PerContext>(null);

        }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
            modelBuilder.Conventions.Remove<DecimalPropertyConvention>();
            modelBuilder.Conventions.Add(new DecimalPropertyConvention(18, 6));

            base.OnModelCreating(modelBuilder);
        }
展开阅读全文

没有更多推荐了,返回首页