使用 Insight.Database,我可以查询具有子对象及其孙子对象的对象:
var someObject = connection.Query("SomeStoredProc", new {ParentId = id}, Query.Returns(Some<Parent>.Records)
.ThenChildren(Some<Child>.Records)
.ThenChildren(Some<Grandchild>.Records,
parents: parent=> parent.Children,
into: (child, grandchildren) => child.Grandchildren = grandchildren));
我有一组表 Parent -> Child -> Grandchild -> Great-Grandchild
我尝试使用 RecordId、ParentId、ChildRecords 属性无济于事。此外,我所有的课程都用 [BindChildren(BindChildrenFor.All)] 装饰。
有没有办法让我的曾孙子孙满堂?谢谢!