调试loadwith在domainservice中有子节点,但在viewmodel中调用时没有子节点

发布于 2024-09-05 19:23:08 字数 697 浏览 1 评论 0原文

我正在尝试使用 .LoadWith 方法,

我的域服务中有这些代码行:

public IEnumerable<Subject> GetSubjectList(Guid userid)
        {
            DataLoadOptions loadopts = new DataLoadOptions();
            loadopts.LoadWith<Subject>(s => s.Notes);
            this.DataContext.LoadOptions = loadopts;
            return this.DataContext.Subjects;
        }

我可以看到加载主题列表的调试,并且作为列表的 subjects.Notes 属性也填充了子项,但是当我这样做时,

ctx.Load(ctx.GetSubjectListQuery(WebContext.Current.User.UserId), lo => 
                {
                    serverdata = ctx.Subjects; 
                }, null);

我只得到加载到服务器数据中的主题的平面列表,并且没有注释子项加载到 subject.notes

I'm trying to use the .LoadWith method

I have these lines of code in my domainservice:

public IEnumerable<Subject> GetSubjectList(Guid userid)
        {
            DataLoadOptions loadopts = new DataLoadOptions();
            loadopts.LoadWith<Subject>(s => s.Notes);
            this.DataContext.LoadOptions = loadopts;
            return this.DataContext.Subjects;
        }

I can see debugging that a list of subjects get loaded, and that the Subjects.Notes property which is a List is also populated with subitems, but when I do

ctx.Load(ctx.GetSubjectListQuery(WebContext.Current.User.UserId), lo => 
                {
                    serverdata = ctx.Subjects; 
                }, null);

I only get a flat list of subjects loaded into serverdata, and no note subitems are loaded to subject.notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没有你我更好 2024-09-12 19:23:08

我没有将 [Include] 添加到我的域服务的元数据属性中。

I had not added [Include] to my metadata properties of my domainservice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文