DomainService -- dynamic query where clause syntax RRS feed

  • Question

  • Originally posted on the LINQ forum, but, they said the link looks fine and to repost on RIA.  Original Post:

    I can craft a dynamic where clause query but I can't get two of them working.  Here's my attempt at getting two different where clauses working...note, if I change the second where clause to filter using lambda style expressions everything works.  What is the syntax for doing this or examples of multiple where clauses working?  Thanks.

    return (from p in this.ObjectContext.PostingInstances.Where<PostingInstance>(strPIFilter, new System.Data.Objects.ObjectParameter[0]{ })
         from j in this.ObjectContext.Jobs.Where<Job>(strJobFilter, new System.Data.Objects.ObjectParameter[0] { })
          group p by new { p.UpdatedOn.Value.Month, p.UpdatedOn.Value.Year } into pi
          select new PostingInstanceTotals
           Month = pi.Key.Month,
           Year = pi.Key.Year,
           TotalActivePostingInstances = (int)pi.Sum(p => p.ActivePosting),
           TotalPostingInstances = pi.Count()

    this code is .NET 4.0 RIA services DomainService  class which returns an IQueryable<PostingInstanceTotals>.

    Appreciate any help,


    Monday, March 7, 2011 8:42 AM