Page 1 of 1

Include() not working

Posted: Thu 01 Sep 2011 09:21
by haiduc32
Hi,
we started using dbMonitor lately and I've spotted that the Include() has no action. For example:

Code: Select all

Customer customer = context.Customers.Include("Orders").Single( ... );
Order order = customer.Orders.First();
will generate 2 selects in db instead of expected only one.

Is this a known issue, some flag we have to set?

Posted: Fri 02 Sep 2011 13:54
by Shalex
haiduc32 wrote:generate 2 selects in db instead of expected only one.
Do you mean the "Prepare: Select..." and "Execute: Select..." records in dbMonitor? These are two stages of a single select.

Posted: Fri 02 Sep 2011 14:03
by haiduc32
hi,
to be more specific:

Code: Select all

Customer customer = context.Customers.Include("Orders").Single( ... ); 
//one select is done here on the Customers table
Order order = customer.Orders.First();
//one select is done here on the Orders table

Posted: Mon 05 Sep 2011 13:03
by Shalex
Could you please send us a small test project with the corresponding DDL/DML script to reproduce the issue in our environment?