1

Is Entity Framework 6 uses code first approach only ? I am a bit confused when we talk about code first approach, but i want to know if it works only with entity framework 6 or entity framework 6 uses code first approach only?

2 Answers2

1

No, EF 6 does not ony support Code First. Code first can be a confusing name. It does not mean that you write code and then generate a db from that. You could in fact both target a new or an existing database using code first strategy. Code first simply imply not using the model designer (edmx) to create and maintain your db-context in your development project.

Some links to get you going:

EF 6 Database first (with asp.net mvc)

EF 6 Code first against new db (with asp.net mvc)

EF 6 Code first against existing db

Ps. Worth noting is that EF 7 (Core) will only support the Code First approach (but of course, as in EF 6, against a new or an existing db).

Indregaard
  • 1,195
  • 1
  • 18
  • 26
  • Does Database First uses .edmx files only? – Anubhav Tiwari Jul 01 '16 at 11:15
  • I have noticed that in Code First Approach there is no .edmx files generated ? – Anubhav Tiwari Jul 01 '16 at 11:15
  • Yes and Yes, But Code first could be targeted against an existing database (where I thing the naming could be a bit off as it is in fact "database first" and not code first...) But the big point with code first would be that you have Poco classes representing your db/context and with database first you generate the edmx from your database. – Indregaard Jul 02 '16 at 20:39
0

Checkout this links to find the Different approach of Entity Framework,

Basically we have 3 approach in that,

  1. Code-First

  2. Model-First

  3. Database-First

Smit Patel
  • 2,992
  • 1
  • 26
  • 44