Walaa wrote:
Are there any prefetch queries executed?
You can troubleshoot the queries and check them in the output window.
Btw, the runtime version provided is the .NET version number, please check the forum thread guidelines.
The project is using .NET 4.5.
I am using Visual Studio 2015 w/ IntelliTrace, and I can see the generated queries in the diagnostics window as they execute.
I thought maybe I had the syntax wrong for the .WithPath extension method? Chaining the WithPath methods doesn't seem to do anything.
Reading through the documentation again.. Is it because I am projecting the query into a new object?
Thanks for your help!
--- I just refactored again using the PathEdge syntax (and got rid of the projection in the query), and this code is working properly.. But I want to be able to dynamically build the collection of PathEdge objects, and pass them into the WithPath extension method.
I hope that makes sense...
query = query.WithPath(
new PathEdge<CustomerEmployeeIdEntity>(PersonEntity.PrefetchPathCustomerEmployeeId),
new PathEdge<CustomerEntity>(PersonEntity.PrefetchPathCustomer),
new PathEdge<PersonMetaDataEntity>(PersonEntity.PrefetchPathPersonMetaDatas),
new PathEdge<PersonBusinessUnitEntity>(PersonEntity.PrefetchPathPersonBusinessUnits),
new PathEdge<PersonChildCustomerEntity>(PersonEntity.PrefetchPathPersonChildCustomers),
new PathEdge<PersonRoleEntity>(PersonEntity.PrefetchPathPersonRoles, new PathEdge<RoleEntity>(PersonRoleEntity.PrefetchPathRole)));
var persons = query
.OrderBy(x => x.Firstname)
.ThenBy(x => x.Lastname)
.Skip(model.PageSize * model.Page)
.Take(model.PageSize)
.ToList();
result.Persons = persons.Select(p => p.ProjectToDto()).ToList();
return result;