Imagine three entities (Customer, Book, Author) related to this:
Customer has many books
There is one author in the book
I use this data to print a report as follows:
Customer: Peter Book: To Kill a Mockingbird - Author: Harper Lee Book: A Tale of Two Cities - Author: Charles Dickens Customer: Melanie Book: The Hobbit - Author: JRR Tolkien
When I request for Clients, I receive, as expected, a bunch of requests of the following nature
- Customer Request
- Request for a client to receive his books
- Request for a book to get its author
I can reduce the number of queries by including books like this:
var customers = db.Customers.Include (c => c.Books);
But I do not know how to download the third level (Author). How can i do this?
entity-framework ef-code-first eager-loading
adolfojp May 6 '11 at 12:50 a.m. 2011-05-06 00:50
source share