5

I can create a table relation very easily with SQL Server Express in Visual Studio 2010 by right clicking and selecting the relationships in the table designer. How do I create a relation between two tables with Visual Studio 2013 in SQL Server Express LocalDB without SQL Server Management Studio? I'm confused about it. May be without T-SQL code. I would like a simple solution.

dymanoid
  • 14,771
  • 4
  • 36
  • 64
Denis
  • 141
  • 3
  • 14
  • You can use the SQL Server Object Explorer - not entirely graphical though – ErikEJ Dec 20 '14 at 13:28
  • 1
    Why not install SQL Server Management Studio Express? It's by far the easiest way to manage your databases, LocalDB or not. Download: http://msdn.microsoft.com/en-us/evalcenter/dn434042.aspx – jessehouwing Dec 20 '14 at 14:04
  • Are you using code first or db first approach of development for entity framework? – RBT Jun 05 '16 at 01:42
  • If it is code first development then you should rather let the data annotations or Fluent APIs to do this work of relationship creation for you at run time. – RBT Jun 05 '16 at 01:48

1 Answers1

0

You can install Entity Framework Power Tools Beta from following url:

https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d

It is a visual studio extension applicable to Visual studio 2013 as well which is your case. Restart Visual Studio after the install. Now right-click the code file in solution explorer which contains the definition of the class inherited from DbContext. In the context menu choose "Entity Framework" -> "View Entity Data Model". From there you should be able to edit the relationships between tables.

RBT
  • 24,161
  • 21
  • 159
  • 240