Usage of existing database (not database first)
Posted Kevin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Usage of existing database (not database first)相关的知识,希望对你有一定的参考价值。
1. create class which is inheirt from DBContext, make sure there is an database connection which is named of xxxx
public class SimpleContext : DbContext { public SimpleContext() : base("name=xxxx") { Database.SetInitializer<SimpleContext>(null); } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); } public virtual DbSet<Product> Product{ get; set; } }
2. add mapped dataTable, schema and primary key
以上是关于Usage of existing database (not database first)的主要内容,如果未能解决你的问题,请参考以下文章
One usage of recurison: the tower of Hanoi