markrendle/Simple.Data — Issue #161: Eager fetching query issues returning multiple parent items
Author: morganjohnston
Created: 2012-02-23 16:30:58+00:00
State: open

It seems the eager fetching can't handle returning multiple parent items. For example:

For All()
db.Customer.All().ToList(); // Works
db.Customer.All().WithOrders().ToList(); // Throws ArgumentOutOfRangeException "Index was out of range. Must be non-negative and less than the size of the collection".

For FindAll()
db.Customer.FindAll(db.Customer.Name == "Rambo").WithOrders().FirstOrDefault(); // This works because the query only returns a single row

db.Customer.FindAll(db.Customer.Name == "Generic Name").WithOrders().FirstOrDefault(); // Returns multiple rows so also throws ArgumentOutOfRangeException "Index was out of range. Must be non-negative and less than the size of the collection."