EF6 DbModelBuilder

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    modelBuilder.Entity<Product>().HasKey(t => t.ProductID);
    modelBuilder.Entity<Product>().Property(t => t.ProductID)
        .HasColumnName("ProductID")
        .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
}

 

posted @ 2017-10-05 10:36  shiningrise  阅读(1026)  评论(0编辑  收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css