views:

109

answers:

2

So I've created a dbml in my project, which has three tables: Elements, ElementImages and Images. Every Element record could have multiple ElementImage records and each of those ElementImage records should have one Image record. The primary and foreign keys are all set up correctly and the associations are defined correctly as well. So why do I not see the collections for each of the objects? I would expect Element to have the collection ElementImages and ElementImage to have an Image property - but none of this appears in my Intellisense. I've deleted and recreated the dbml several times, even on other tables to no avail.

A: 

What are the field types for your database fields? Some are not supported by L2S. Are they showing up in the tables when you drop onto the dbml surface?

keithwarren7
Guids for the PKs and FKs...
E-Madd
+1  A: 

I've never had this issue when dragging from Server Explorer panel.

We use bigint as our PK/FK so I can't say if Guids are what's giving you trouble. You might try a test using the same steps using bigint/long as your PKs to see if it works for you.

I have only ever experienced this when I thought that I'd set up the foreign keys on the DB table but actually forgot. In Server Explorer it is difficult to tell at a glance. If they are set up correctly you should see arrows between your tables on the design surface. If you don't see arrows immediately, I'd suspect your FKs aren't set up correctly.

Using the properties panel, you can modify the visibility of the association properties. Clicking on the arrows themselves allows you to modify the parent/child properties with the Properties panel. I usually disable the Child Property, but you can only limit the visibility of the Parent Property to internal. I suggest checking these to make sure it isn't disabled or has its visibility set lower than you are expecting.

McKAMEY