views:

26

answers:

1

Hi All,

I have an authors -> authorsbooks <- books in my database. I created an entity data model from this and I noticed that the association entity didn't show up in the model(I think it's inferred).

I want to drag 2 EntityDataSources onto the designer, a gridview of authors, and when a user clicks to select an author another gridview below will show all the books assoiciated with that author.

How do I configure that second entitydatasource because when I try to configure it I don't see the authorsbooks association entity in the entitysetname dropdownlist. I'm thinking to set this as the datasource to the books gridview? Am I misunderstanding something?

Thanks,

rodchar

A: 

Entity Framework will infer the relationships based on the Foreign Keys in your database.

Does your AuthorBooks table have a foreign key to the Author table?

Also, when you add your tables onto your EDMX, make sure you tick "Include Foreign Keys in Model".

If done correctly, when you type Author., you should see AuthorBooks as an EntitySet.

RPM1984