0

When creating a new solution (typically ASP.Net MVC or API) I usually create a data access project and my web project. In the data access project I typically use EF6 and have been trying to use Code-First so that I can take advantage of the migrations feature.

In the data access project I create a model folder and then in that folder add my classes and my DBContext class. Then I generate my migrations and seed data. This all works ok.

  • What I was wondering are there more efficient ways of creating this type of project?
  • Am I hampering my productivity by going code first?
  • I know I am not using code generation that the database first process would use. Can I gain efficiencies by switching to DB first?
  • What are typical work flows that others use?
  • OR is there a hybrid approach that people find successful?

I understand that this has been addressed in other posts but my questions is more in context of EF6 and those all seem to be based on EF4.

TIA

Community
  • 1
  • 1
John S
  • 7,909
  • 21
  • 77
  • 145
  • Just added to my question to further clarify. That particular article is EF4 based. I'm wondering if things have changed between 4 and 6 – John S Mar 28 '14 at 17:57
  • Lots of answers to this but immediately I think: Do the tables already exist? And do I need much by way of POCO's or business rules on the model itself? If the answers are Yes->No respectively then DB first is probably more desired since it creates your models for you. – Evan L Mar 28 '14 at 18:00
  • @EvanL - you can create a Code First model from the database as well - EF 6.1 tooling supports this. – Pawel Mar 28 '14 at 20:09
  • @Pawel Honestly haven't worked with EF6 yet. Good to know! – Evan L Mar 28 '14 at 20:11
  • 1
    @EvanL - take a look at this then: http://msdn.microsoft.com/en-us/data/jj200620.aspx – Pawel Mar 28 '14 at 21:42
  • @Pawel Thanks! I will read up =) – Evan L Mar 28 '14 at 21:43

0 Answers0