EF4 包括不返回任何导航属性

发布于 2024-09-26 07:03:01 字数 393 浏览 1 评论 0原文

我在我的域服务中使用它

  public IQueryable<Document> GetDocuments()
    {
        return this.ObjectContext.Documents.Include("Company").Include("PostingStatus").Include("DocumentType").Include("Period");
    }

,但它没有向客户端返回任何内容,我正在使用 WCF RIA 服务以及 EF4 和 Silverlight。

这是否与 EF4 中关于内部和外部联接的一些更改有关,它曾经在以前的 EF 版本中工作,但不知道出了什么问题。 你能解释一下吗?

谢谢, 阿什什·古普塔

I am using this

  public IQueryable<Document> GetDocuments()
    {
        return this.ObjectContext.Documents.Include("Company").Include("PostingStatus").Include("DocumentType").Include("Period");
    }

in my domainservice but its not returning anything to the client i am using WCF RIA Services and EF4 and Silverlight.

Does this have anything to do with some changes in EF4 regarding inner and outer joins it used to work in previous version of EF but dont know whats going on wrong.
Can you throw some light on this.

Thanks,
Aashish Gupta

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

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

发布评论

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

评论(2

心清如水 2024-10-03 07:03:01

我在 WCF RIA 服务和 EF4 中遇到了同样的问题,通过手动将 [Include] 属性添加到生成的“*DomainService.metadata.cs”文件中的相应导航属性来修复该问题。

另请参阅:http://xamlgeek.net /2010/02/21/include-lated-properties-in-wcf-ria-services/

不利的一面是,在重新生成 DomainService 文件时,此属性会被消除。

I had the same problem in my WCF RIA Services and EF4, which was fixed by manually adding the [Include] attribute to the appropriate navigation properties within the generated "*DomainService.metadata.cs" file.

See also: http://xamlgeek.net/2010/02/21/include-related-properties-in-wcf-ria-services/

On the downside, this attribute gets blown away when regenerating the DomainService files.

你与清晨阳光 2024-10-03 07:03:01

我已经上传了文件并尝试了一切,但当我在客户端上像这样外部指定时它似乎不起作用,

  (documentDomainDataSource.DomainContext as DocumentContext).AddReference(typeof(Company), company_ctx);
        (documentDomainDataSource.DomainContext as DocumentContext).AddReference(typeof(DocumentType), documentType_ctx);
        (documentDomainDataSource.DomainContext as DocumentContext).AddReference(typeof(Period), periods_ctx);

然后它就可以工作,但这不是我使用实体框架和 ria 服务的解决方案。

I have uploaded the file and tried everything but it doesn't seem to work when on the client i externally specify like this

  (documentDomainDataSource.DomainContext as DocumentContext).AddReference(typeof(Company), company_ctx);
        (documentDomainDataSource.DomainContext as DocumentContext).AddReference(typeof(DocumentType), documentType_ctx);
        (documentDomainDataSource.DomainContext as DocumentContext).AddReference(typeof(Period), periods_ctx);

then it works but this is not the solution for which i am using Entity Framework and ria services.

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