Your extension will be available shortly on the Visual Studio Marketplace at this link.

EF 4.x DbContext Generator for C#


A project item to generate a strongly-typed DbContext class and persistence ignorant entity classes. Use this template when working with an EF 4.x release.

Visual Studio
2012, 2010
Download (126,238)
E-mail Twitter Digg Facebook
Add to favorites
Sign in to write a review
Sort by:

by AlteredLife | October 12 2012

It works, creating a DbContext based object context and POCOs from the object model. The namespace the POCOs are generated seems to be wrong if you change it from the default in the object model properties.

Strangely - it seems to keep working even though the declarations in the .edmx point to the namespace in the object model properties, and the generated objects have the default namespace for the project...

SO the .edmx may describe the type of a complex property as objectmodel.ct and the generated type will be repository.ct

I dont know if this is a general 'bug' or something that just hit me.

Using EF 4.5

by Noam A. Lewis | August 09 2012

These templates are a great starting point for customizing the code. Thanks!

However I found a bug in setting LazyLoadingEnabled on the .edmx - it gets set in the default constructor of the DbContext subclass, so that when creating an instance using a different constructor the value of LazyLoadingEnabled is not set.


by Pedram Karimi | June 03 2012

by rt2726 | May 16 2012

The DbContext code generator is a nice improvement for EF. I would like to give this a 5 rating but the template does not pick up the documentation summaries from the model when building the POCO classes. That is something that I feel should be addressed in the next release.

Also, it would be nice to see a change log for this extension.

by Dragan Radovac | April 14 2012

by NewWorldMan | March 29 2012

@Mr. Javaman II, there are some other templates that you do not get if you install or update EF using NuGet as opposed to using the standalone installer. I just ran into this problem when updating to EF 4.3.1, so found this page.

by Mr. Javaman II | March 07 2012

It looks great but I don't understand its function. I've already used the EF templates that come standard being able to map a database schema to class structures no problem.

What does this tool do?

by abatishchev | December 06 2011

by Luke Winikates | October 11 2011

Indispensable if you're working with an existing database for your Entity Framework project. For testing purposes, it would be nice if the T4 generated an interface class to go along with the DbContext.