Joining between 3 tables

Posts   
 
    
CSharpner
User
Posts: 28
Joined: 03-Jun-2007
# Posted on: 15-Nov-2007 20:39:44   

I've got 3 tables (names are changed to protect the guilty):

Books

BookID long (PK) Title string

BookChapters

BookID long (FK) ChapterID long (FK)

Chapters

ChapterID long (PK) Text string

A "Book" is made of "Chapters". Any chapter may exist in several books at the same time.

I've got Entities generated for each table and the database has relations between books and bookchapters and between chapters and bookchapters. I have permission to add or change relations, if necessary.

Question: Given a BookID, how do I get a collection of chapters using the generated code?

CSharpner
User
Posts: 28
Joined: 03-Jun-2007
# Posted on: 15-Nov-2007 22:30:06   

The generated code I was using was generated before the relations existed on that actual database. After those were added, I reloaded the scheme and regenerated code and now I've got what I need.