Visual Studio and .NET Framework Home
DBML display does not show new foreign key constraints
2/13/2009 7:21:31 PM
User(s) can reproduce this bug
I am updating my database and changing the FK constraints on the fly. VS2008 does not seem to see those changes immediately nor allow me to easily update the dbml file. Even a refresh to the Server Explorer in VS2008 does not get constraints.
I refresh and drag and drop the tables in question onto the dbml file in VS2008, but it has no affect even though SQL Server Management studio shows the FK constraints on the tables! Its as if the tables are cached in VS2008.
The problem will go away if I do these steps
1) Build the project with the tables not showing the foreign key constraints.
2) Remove tables in question.
3) Drag/Drop the tables back to the dbml file.
Wala....the links are there...why? Note my links are 1 to many.
I expect to not have to build to solve this issue, and that a refresh to the SQL server explorer in VS2008 should be enough. I understand I need to delete the *old* tables from the dbml file, but don't have me build...it seems counter intuitive to have to build visually wrong tables, then delete and re-add when the re-add should be enough.
Visual Studio 2008 SP1
Operating System Language
Steps to Reproduce
1) Create two tables with a 1 to many FK constraint between the tables.
2) Create a dbml file in VS2008 and drag the two tables to it.
3) Build. Everything is OK.
4) Add another FK constraint to the tables.
5) Refresh the db in Server Explorer in VS2008.
6) Delete the tables on the dbml view.
7) Drag down the tables.
The tables will not show the new FK constraint.
Notice that the new link does not show. No refresh will solve the problem. Only a rebuild, delete then drag the tables down will solve the problem.
A refresh/delete/drop tables should be enough to show the links w/o having to do a build. Its confusing.
What would be nice is to right click the table on the dbml page and say refresh and it gets its current info.
TAP Code (if applicable)
You can indicate your satisfaction with how Microsoft handled this issue by completing this quick
3 question survey
to post a comment.
Please enter a comment.
on 6/22/2012 at 4:58 PM
I don't understand, why it is marked as fixed, because related (more general) issue https://connect.microsoft.com/VisualStudio/feedback/details/260723/linq-for-sql-designer-support-for-refresh-resync-of-tables-and-columns is marked as "won't fix"
on 6/8/2012 at 1:38 PM
I have the same issue in vs2010 and my FK constraints don't appears because my new table didn't have primary key. I have added it ant it works !
on 3/13/2009 at 2:28 PM
This issue will be fixed in the next version of Visual Studio (Dev 10)
on 2/15/2009 at 10:54 PM
We were able to reproduce the issue you are seeing. We are escalating this issue to the product unit who works on that specific feature area. The product team will review this issue and make a decision on whether they will fix it or not for the next release.
to post a workaround.
Please enter a workaround.
on 1/12/2010 at 12:02 PM
Delete the table in question. Close visual studio. Reopen and add the target table to the design surface.
on 10/6/2009 at 5:58 PM
another workaround (besides delete and re-add) is to modify the sql select statement(s) in the data table object:
- if a new column for the foreign key was added, then add the column to the select statement
- if a foriegn key relationship was added to an existing column, remove the column from the select statement, then add it back in.
© 2014 Microsoft