|
Hi Roland,
I'm able to see the issue here. I'm going to check with a senior engineer to find out whether this is a bug or just a known limitation when returning an IEnumerable.
FYI, the Include works on the server, i.e. inside the named query, you can actually see that the included entities are being returned from the db to the server. They're just not being returned/serialized from the server to the client as well.
Since you must execute the calculations on the server, one suggestion is to return IQueryable, intercept the query results on the server and execute the calculations. This way you can keep the client side query call the same and not have to change anything there.
public class MyQueryInterceptor : EntityServerQueryInterceptor { protected override bool ExecuteQuery() {
//calls base.ExecuteQuery to execute and returns results base.ExecuteQuery();
//Do special calculations for your particular named query here PerformAdditionalCalculationsToCustomerResults(); } private void PerformAdditionalCalculationsToCustomerResults() { var entityQuery = this.Query as EntityQuery;
if (entityQuery != null && entityQuery.IsNamedQuery && entityQuery.NamedQueryMethod.Name.Contains("CustomerWithCalculations")) { if (this.QueriedEntities.Any()) { this.QueriedEntities.OfType<Customer>().ForEach(c => { c.CalculateRevenue(); c.CalculateOpenAmount(); }); } } } }
|
Another suggestion that does require you to change client side code is to use Remote Server Method. See http://drc.ideablade.com/xwiki/bin/view/Documentation/rsmc-query - http://drc.ideablade.com/xwiki/bin/view/Documentation/rsmc-query . This is just another option.
I'll keep you updated as to whether this is a bug or not.
|