ServiceStacks'自动查询 - 在嵌套结果中搜索

时间:2015-09-29 13:23:01

标签: servicestack

我有一个关于使用ServiceStack的自动查询的嵌套结果的问题。

具体地,

首先, 我有两节课。具有引用的子项列表的Parent类,如下所示:

    [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;}
    }

其次,我有一个Autoquery类,如下所示:

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

鉴于上述情况,

AutoQuery是否支持在ParentView的子列表中进行搜索?

e.g。 API查询  /父母?ChildName =汤姆

似乎没有过滤结果。 AutoQuery是否自动支持在List中进行搜索?

谢谢&amp;顺便说一句,ServiceStack非常棒!

1 个答案:

答案 0 :(得分:1)

AutoQuery不包含任何子引用作为查询的一部分。您需要将explicitly Join tables包含在已执行的查询中。