I have a Code First
project with Entity Framework 5.0.0
using localdb
created in Visual Studio 2012 Ultimate
.
Although I can see my class relations in a Class Diagram
, how to see a visual diagram of automatic generated database by EF
?

- 29,931
- 42
- 140
- 205
-
This blog post [http://www.stratospher.es/blog/post/connecting-to-localdb-with-sql-server-management-studio-2012-ssms] shows how to connect to LocalDB using the SQL Management Studio. Same approach can be reused for VS2012. – Damyan Bogoev Nov 24 '12 at 23:24
-
Thanks, know that (check your link). I was doubtful if there is a built-in option in EF 5, not reverse engineering my project every-time wanna see data relations. – Xaqron Nov 24 '12 at 23:35
-
You could dump the edmx using EdmxWriter.WriteEdmx (or with PowerTools) and open this file with VS2012 what should open EFDesigner and you should see the model in the designer. Note that it will be the conceptual model and not store model (database) though. – Pawel Nov 24 '12 at 23:41
-
Hope that will provide you with helpful information how your database was migrated: 1. http://coding.abel.nu/2012/03/ef-migrations-command-reference/#Get-Migrations 2. http://thedatafarm.com/blog/data-access/ef-code-first-migrations-documentation/ – Damyan Bogoev Nov 24 '12 at 23:42
-
I was looking for the same thing as you, then I realized SSMS has a built-in feature for displaying existing relationships. In the db folder, right-click Database Diagrams, Add New, then select all tables except for your migrations folder. Then it will show the relationships between all the tables in your db; bam! – levininja Dec 30 '14 at 17:30
3 Answers
Install Entity Framework Power Tools Beta 4, restart Visual Studio, right-click on the context in your solution view and you'll see a new 'Entity Framework' option in the context menu. Select 'View Entity Data Model' to see a beautiful visual database diagram in Visual Studio. Voilà!
Entity Framework 6 Power Tools: Link

- 3,895
- 9
- 53
- 97

- 5,718
- 4
- 36
- 46
-
Yeah, very handy in certain circumstances. You can also reverse-engineer an existing db into a bunch of classes, which can save a lot of time if working EF into an existing db situation. – Ralph Lavelle Jan 02 '13 at 04:37
-
1Good for now. It should support changes via model (currently it is read-only) – Xaqron Mar 15 '13 at 07:20
-
1I do use this and it's handy. However, this isn't strictly a diagram of the SQL database though, it's an EF model of it. The penny dropped and I found you can use SQL Server Management Studio 2012 to do this using the usual Database Diagram tool. See my answer below. – TimS Jan 31 '14 at 10:57
-
8This doesn't work out of the box for VS 2015. Here's Julie Lerman on how to make it work: http://thedatafarm.com/data-access/installing-ef-power-tools-into-vs2015/ – Cristian Diaconescu Oct 23 '15 at 07:14
-
3or, just download Julie's .visx from [here](https://onedrive.live.com/?authkey=%21AOLVNEIVt_sf2JI&id=4B1104A99AE8ABE2%21333&cid=4B1104A99AE8ABE2) if you're in a rush. – Mike Devenney Feb 27 '16 at 19:18
-
+1. Very nice. Without this I was unable to verify if the foreign key relationships were getting created or not. Thanks! – RBT Jun 05 '16 at 00:54
You can use Microsoft SQL Server Management Studio 2012 with localdb
which supports Database Diagrams in they way you may be used to with other SQL Server database.
- Open Management Studio (should have been installed with Visual Studio)
- Connect to
(localdb)\v11.0
, with Windows Authentication - Find the relevant database
- Expand Database Digrams, and install diagram support objects if you've not already
- Add the tables you need and you're done!
Source: This older but still relevant article: http://visualstudiomagazine.com/blogs/data-driver/2012/05/visual-studio-11-beta-easier-development-localdb.aspx

- 5,922
- 6
- 35
- 55
-
For those coming later e.g. using the default template for a Code First app with LocalDB, just use the server instance part of your connection string to connect SSMS to - in my case it was `(LocalDb)\MSSQLLocalDB` – Tian van Heerden Jul 18 '18 at 15:51
I checked out the Entity Framework Power Tools Beta 4 and it is no longer being supported. Intead, you can use the new Entity Framework 6 Power Tools Community Edition.
It is supposed to work the same.

- 69,473
- 35
- 181
- 253

- 61
- 2