Instructions for Setting up Entity Framework 6 and Data Test Project‏

I had gone through a lot of days of futzing to make this work and thought others may benefit from this as well. Instructions are included for both VS2010 (at the very end) and VS2015.

VS2015

VS2015 is much easier than VS2010, as both the Entity Model and the DBContext generator (pick either version 5 or 6, depending on your needs), as they are right in Add New Item’s dialog box under “Data” subsection.

Project settings modifications

Your DAL project will need to have the app.config set to Your unit test project then needs 2 things:

Adding a Reference to EntityFramework.dll in the Data Test project, to match the same EF reference item from your Data project.

And a post build step to bring in the config, otherwise your EF Integration tests will fail saying it can’t find the connection. Exact command that I’d used is not a perfect outcome compared to a file move, as this does a copy:

copy App.Config $(TargetName).config.

 post20build20step_zpsrrirz1ju

VS2010

If in VS2010, first add a ADO.NET Entity Data Model.
Then search for “Entity” and add the Nuget Package for EntityFramework 6.x.  Note, you won’t be able to use the designer though, so I’d highly recommend getting VS2012 or higher.

 Enjoy, and happy DAL coding!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s