小编kgz*_*dev的帖子

如何知道项目是代码优先还是数据库优先?

在现有项目中,我如何知道它是代码优先还是数据库优先?

项目有这几行代码:

public class TestDBContext : DbContext
{
    public DbSet<Player> Players { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
    }
}
Run Code Online (Sandbox Code Playgroud)

并且项目没有.edmx文件。如果需要任何其他细节,我会分享。

编辑:

Player.cs 类

public class Player
{
    public int PlayerID { get; set; }
    public string PlayerName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

编辑 12.05.2017

如果我改变database nameconnection string和运行项目,它创建database with the new name with all tables。可能这会被击中答案。

c# entity-framework ef-code-first db-first

6
推荐指数
1
解决办法
4193
查看次数

标签 统计

c# ×1

db-first ×1

ef-code-first ×1

entity-framework ×1