Not all navigation properties are shown

I have two identical SQL Server 2014 databases which I have added as connections to Linqpad 5. (I have ensured that the schemas are identical (with schema compare from VS 2017)). For a specific table in the first DB all navigation properties are shown. In the second DB for the same table some of the navigation properties are missing.
Has anybody got an explanation for that?

Comments

  • what I forgot to mention is that for the second DB the database was removed an re-created.
  • I can't think of a reason that would happen. If you can provide a schema that can reproduce the problem of navigation properties not showing, I can look into it. However, it's not always possible for the built-in heuristics to infer a name for association properties, which is why they might not show.
  • Joe, Are the heuristics for association properties described any where?
  • No, there isn't any such document. I've had another look at the code and the most likely reason for omitting an association is that its name would conflict with another association or property name. In these cases, LINQPad should probably add a unique suffix (Customer1, Customer2, etc) rather than omitting it. I can put this on the TODO list.
  • @JoeAlbahari Just as another data point, I've hit that scenario as well where the generated names for properties conflicted so I ended up with only 1 of them and the other just wasn't present. Historically I've been lucky enough to change the FK name such that they then both showed up, but it'd be great to have the suffix approach. :)
  • OK, I'll add this to the next build.
  • James - try now and let me know if it makes any difference.
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!