Skip to content

Instantly share code, notes, and snippets.

@CraigStuntz
Created March 23, 2011 19:05
Show Gist options
  • Save CraigStuntz/883732 to your computer and use it in GitHub Desktop.
Save CraigStuntz/883732 to your computer and use it in GitHub Desktop.
WCF Data Services doesn't support nested aggregates. But DataServiceQuery does -- with certain gotchas.
var result = _unitOfWork.BillingBatches
.Select(batch => new BillingBatch
{
Id = batch.Id,
Description = batch.Description,
FundingSource = batch.PayerCustomer.Name,
Amount = batch.Bills.Select(bill => bill.NetTotal).Sum(), // turns into $expand -- EF would have used SQL SUM()
Created = batch.Created
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment