'How to know project is code-first or database-first?

In an existing project, how do I know if it's code-first or database-first?

Project has this lines of code:

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

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
    }
}

And project has no .edmx file. If any other details need I will share.

EDIT:

Player.cs class

public class Player
{
    public int PlayerID { get; set; }
    public string PlayerName { get; set; }
}

EDIT 12.05.2017

IF I change database name from connection string and run project, it creates database with the new name with all tables. May be this will be hit for the answer.



Solution 1:[1]

Here I am sharing my observation.

Mainly there are two approaches to implement Entity Framework. 1. Code-first If chosen, it will create simple .cs file(s) which developers later modifies as per their requirement.

  1. Data-first If chosen, it will create a [name].edmx file along with hierarchy of different files. It contains .Context.tt and underneath .Context.cs file. The .Context.cs file will have below snippet which indicates whether induced entity model was empty when created or it was with any database object.

    namespace Search { using System; using System.Data.Entity; using System.Data.Entity.Infrastructure;

    public partial class XYZ_MSCRMEntities : DbContext
    {
       public XYZ_MSCRMEntities()
        : base("name=xyz_MSCRMEntities")
       {
    }
    
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        throw new UnintentionalCodeFirstException();
    }
    
    public virtual DbSet<AnyDatabaseTableOrView> TableOrViewPluralized { get; set; }
    }}
    

In above snippet, very last line (DbSet property) shows that it has imported database object and that is how it is "Data-first"

Solution 2:[2]

If there is no .edmx file, the project is code-first.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Binoy
Solution 2 Adok