Generating Entity Data Model Diagram from EF Code First DbContext

The Entity Framework Code First approach lets the developers to build applications with Domain-Driven Design (DDD) by hand coding your Persistence Ignorance (PI) classes. At the same time, it would be great if we could see the entity model in a visual diagram, which can also ensure that our domain model is accurate and our relationships are designed properly. The Entity Framework Power Tools lets you to view a  read-only view of the Code First model in the Entity Model Designer, from a Code First DbContext class.

You can add the Entity Framework Power Tools from Visual Studio 2012. To install Entity Framework Power Tools from Visual Studio 2012, select the Extensions and Updates from the Tools menu and search for Entity Framework Power Tools in the Visual Studio online gallery, and install the Power Tools.


One you have installed the Entity Framework Power Tools, you can see a context menu Entity Framework. To generate a read-only Entity Model in a designer, select the Code First DbConext class and right click, from the Entity Framework context menu, select view Entity Data Model (Read-only) as shown in the below picture:


The following screen shot shows the Entity Data Model generated from my Codeplex project EFMVC


Please note that this is a read-only model which won’t allow to edit the model in the designer. By looking on the Data Model in the designer, you can verify that the domain model is correct and relationships are configured properly.


  • quite interesting, it's good to know that you are able to see the diagram of your data classes

  • I use Visual Studio Express 2012 for Web with SQL Server Express 2008 R2 and when I try to install Entity Framework Power Tools (beta 3 is the actual version) it says that I didnt have any product compatible with that version. Any ideas?

Comments have been disabled for this content.