Mark
Mark

Reputation: 2203

ServiceStacks' Autoquery - Searching in Nested Results

I have a question relating to nested results using ServiceStack's Autoquery.

Specifically,

Firstly, I have two classes. A Parent class with a referenced list of children, as shown below:

    [Alias("view_parent")]
    public class ParentView
    {
         public int Id { get; set; }
         public string ParentName {get;set;}
         [Reference]
         public List<ChildView> Children {get;set;}

    }

    [Alias("view_children")]
    public class ChildView
    {
        [References(typeof (ParentView))]
        public int ParentId { get; set; }
        public string ChildName {get;set;}
    }

Secondly, I have an Autoquery class as follows:

  [Route("/parents", "GET")]
    public class GetParents : QueryBase<ParentView>
    {
    }

Given the above,

Does AutoQuery support searching within the List of children from the ParentView?

e.g. the API query /parents?ChildName=Tom

does not seem filter the results. Does AutoQuery automatically support searching within a List?

Thanks & by the way ServiceStack is pretty awesome!

Upvotes: 1

Views: 80

Answers (1)

mythz
mythz

Reputation: 143349

AutoQuery doesn't include any child references as part of the query. You'll need to explicitly Join tables you want included in the executed query.

Upvotes: 1

Related Questions