Lost FK relationship with LINQ-SQL constructor

I have three tables in my DB (actually a bit more):

Users
-----------
ID (PK)   
Name

Sites
-----------
ID (PK)  
SiteName

Users_Sites
-----------
ID (PK)  
UserID (FK to Users.ID)  
SiteID (FK to Sites.ID)  

      

and I have a unique constraint on UserID and SiteID in the Users_Sites table. All very standard stuff.

My problem is that when I drag these tables into the LINQ-SQL designer, I can see the relationship between the Sites and Users_Sites tables, but not the relationship between the Users and Users_Sites tables. I tried to create an equivalent diagram in SQL Enterprise Manager, which verified that the relationship was actually there.

Is there a known issue with the LINQ-SQL constructor, or is there something special I should be doing?

0


a source to share


1 answer


Hi mdresser, I know this might sound silly, but have you tried restarting Visual Studio?

I've run into this several times and its always Visual Studio 2008 will die a little.

Re-fixes it every time.

Just make sure your relationship is actually in the DB and make sure you update your connections in the server explorer before dragging.



Finally, doing the build before adding tables sometimes helps ...

I know it sounds random, but let me know

amuses

+1


a source







All Articles