This question is locked. New answers and comments are not allowed.
If I have two table T_BS_FUNCTION with 1 parent record and T_BS_RULE.with 2 child record. Could help to indicate the calling time for DB for following two cases:
A:
using (EntitiesModel dbContext = new EntitiesModel())
{
IQueryable<T_BS_FUNCTION> query = from c in dbContext.T_BS_FUNCTIONs
select c;
foreach (T_BS_FUNCTION customer in query)
{
Console.WriteLine(customer.DATE_CREATED);
foreach (T_BS_RULE order in customer.T_BS_RULEs)
{
Console.WriteLine("\t{0}", order.AUTHOR);
}
}
}
B:
using (EntitiesModel dbContext = new EntitiesModel())
{
Telerik.OpenAccess.FetchOptimization.FetchStrategy fetchStrategy = new Telerik.OpenAccess.FetchOptimization.FetchStrategy();
fetchStrategy.LoadWith<T_BS_FUNCTION>(c => c.T_BS_RULEs);
dbContext.FetchStrategy = fetchStrategy;
IQueryable<T_BS_FUNCTION> query = from c in dbContext.T_BS_FUNCTIONs
select c;
foreach (T_BS_FUNCTION customer in query)
{
Console.WriteLine(customer.DATE_CREATED);
foreach (T_BS_RULE order in customer.T_BS_RULEs)
{
Console.WriteLine("\t{0}", order.AUTHOR);
}
}
}
A:
using (EntitiesModel dbContext = new EntitiesModel())
{
IQueryable<T_BS_FUNCTION> query = from c in dbContext.T_BS_FUNCTIONs
select c;
foreach (T_BS_FUNCTION customer in query)
{
Console.WriteLine(customer.DATE_CREATED);
foreach (T_BS_RULE order in customer.T_BS_RULEs)
{
Console.WriteLine("\t{0}", order.AUTHOR);
}
}
}
B:
using (EntitiesModel dbContext = new EntitiesModel())
{
Telerik.OpenAccess.FetchOptimization.FetchStrategy fetchStrategy = new Telerik.OpenAccess.FetchOptimization.FetchStrategy();
fetchStrategy.LoadWith<T_BS_FUNCTION>(c => c.T_BS_RULEs);
dbContext.FetchStrategy = fetchStrategy;
IQueryable<T_BS_FUNCTION> query = from c in dbContext.T_BS_FUNCTIONs
select c;
foreach (T_BS_FUNCTION customer in query)
{
Console.WriteLine(customer.DATE_CREATED);
foreach (T_BS_RULE order in customer.T_BS_RULEs)
{
Console.WriteLine("\t{0}", order.AUTHOR);
}
}
}