Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 Database Diagram?

I have done very little in C# and am following the Head First C# book. There's a part in the book where it asks me to create a Database Diagram for my SQL database, but in the Database Explorer there is no Database Diagram node/folder.

I have heard that Microsoft dropped the Database Diagram feature, but is there another way to create a Database Diagram that would be easy enough for me to understand?

like image 586
Flaxbeard Avatar asked Jan 03 '13 00:01

Flaxbeard


1 Answers

I like the way Entity Framework 5 will allow you to import database objects and then it will diagram the tables, indexes, relationships, etc. Or you can do it the other way, create the diagrams and then publish it to a database. This works so well I suspect it is why the Database Diagram was dropped in SQL Server. EF5 is probably in your Visual Studio environment right now.

EF5

To create an EF5 diagram, right click a directory (usually the directory is named "Model"), and select "Add" / "New Item" and then select "ADO.NET Entity Data Model". Name it, and then select "Generate from database". The rest is selecting or generating a connection string and then selecting the database objects.

Best part is that this is the start of what I would recommend when you get to the point in your learning where you need a data access layer, I can not recommend EF5 high enough.

like image 101
JBrooks Avatar answered Sep 21 '22 18:09

JBrooks