Missing relations


I've created a database using SQL CE 4.0, created my tables and relationships and am now attempting to view them in LinqPAD. Unfortunately, not all relations are showing up and I can't figure out why. For example, normally, if table A has a FK with a column referencing table C, then LinqPAD will show the relation to table C under table A's structure (in the structure pane), and foreign records (from table C) will be accessible via hyper-links in the results pane when selecting table A's records.

Table A actually has FK columns referencing 2 other tables, but only one of them is missing a relation. The same thing happens for another table, table B, and so both A & B are missing the relations to table C. In addition, reverse references from table C back to tables A & B do not appear in table C's structure either. So, it is as if the FK's do not exist at all, yet they do.

I have another table with FK's to 4 other tables, and all of those relations DO show up. So what is causing the relations to not show up for tables A & B? This is a very small database and I use LinqPAD with a much larger database (on SQL Server, not CE) and have never seen this before. I must be missing something, but for the life of me cannot figure out what.

I have tested this on LinqPAD v5.22.02 and v4.57.02, and I get the same results in both.

Any ideas?

I can make the database (.SDF file) available to anyone who wants it.

Thank you,

Dennis Jones


  • Follow-up:

    I tested the same schema on SQL Server and connected to it with LinqPAD and got the same results. So it is not caused by SQL CE.


  • I sort of remember reading somewhere that L2S and/or EF could have trouble with relationships in certain cases, depending on how objects are named.

    Since I had a prefix on some table names but not others, I decided it couldn't hurt to rename the tables so that they all had the same prefix. After renaming, LinqPAD now shows all the relationships (in both directions) as expected!


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!