9

Using Visual Studios 2010 I'm creating a project that has a database.

I decided to try to use one of those Database Projects that allow you to manage the database in source control along with the code.

I also think I will use entity framework as my data access tool.

Are there any good solution to tie the EF 4.0 project to the database being managed in the Database project (assuming it's a new db)?

2 Answers 2

5

You simply use your database project to create database for you and you use Database first approach with Entity framework (that means you will use wizard and update from database to create entity model for you).

Sign up to request clarification or add additional context in comments.

3 Comments

So it will be very easy to update the EF 4.0 when there are changes to the DB but not automatic. Should I perhaps skip the Database project and just use EF code first instead?
It depends on the way how you want to develop the application. Code first = almost no control over the database. Database first with Database project = full control over the database.
Is this the correct workflow for making a db change? (1) Make the change in the Database Project, (2) Build the db project, (3) Publish the db project (to database), and then (4) Update EF Model from the database? It would be nice to be able to update the model directly from the db project, without (3) publishing before I'm ready - are you saying that's not possible? I'm using VS2013 with EF 6.
2

I found Scott Guthries 'Code-first' tutorial to be quite good:

http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx

Let me know if that doesn't quite scratch the itch, I've got a couple of others bookmarked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.