locked
Filter on Collection count RRS feed

  • Question

  • Hello,

    I need to use OData to express the following query where ParentChildren represents a bridge table. The Parent Entity contains an ICollection<Child> Children. Essentially I need to express this query:

    SELECT ID FROM Parent WHERE Children.Count > 1

    I feel like I have done this before but, for whatever reason, cannot remember how. any help would be greatly appreciated.

    Best and TIA

    Tuesday, March 8, 2011 5:04 PM

Answers

  • Unfortunately filtering on collection properties is not yet supported. Alternatively, a Service Operation can be setup that returns an IQueryable<Parent>, that way the filter can be setup on the server side instead.

     

    Regards,

    PQ


    Peter Q. http://blogs.msdn.com/peter_qian
    • Marked as answer by rkbrown Tuesday, March 8, 2011 9:38 PM
    Tuesday, March 8, 2011 7:18 PM
    Answerer

All replies

  • Unfortunately filtering on collection properties is not yet supported. Alternatively, a Service Operation can be setup that returns an IQueryable<Parent>, that way the filter can be setup on the server side instead.

     

    Regards,

    PQ


    Peter Q. http://blogs.msdn.com/peter_qian
    • Marked as answer by rkbrown Tuesday, March 8, 2011 9:38 PM
    Tuesday, March 8, 2011 7:18 PM
    Answerer
  • Thanks for the definitive answer!

    Best,

    Ryan

    Tuesday, March 8, 2011 9:38 PM