Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Foreign keys are not showing up in Visual Studio

$
0
0

Hello all,

I am having an issue where my SQL Model in Visual Studio 2010 is not fully generating code for my foreign keys.  In my SQL database I have a few tables with foreign key relationships.  In VS I go to my (database).edmx file and select "update model from database" and I also have checked the option "include foreign keys".  In my .edmx file I can see all of my tables and all of the foreign key relationships just fine.  The problem is when I go to my (database.Designer.CS) file, the proper code has not been generated for those relationships.  What I have to do is manually go into that file and add “using System.ServiceModel.DomainServices.Server;” and then I have to go to every place where there is a foreign key and add the code "[include]".  This is the only way that I can get my linq queries to recognize those foreign key relationships.

It has been too big of a deal but I am getting ready to add a bunch more tables and FK's and it is going to become very time consuming to do this any time I update my database model.  I know it should be generating this code automatically.  I appreciate the responses ahead of time!

~Aaron Kruger


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>