开发者

EF4 Include not returning any of the navigation properties

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜