首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有webapi导航属性的OData

问具有webapi导航属性的OData
EN

Stack Overflow用户
提问于 2013-05-25 03:09:54
回答 1查看 3.8K关注 0票数 2

我正在编写建立在WebApi asp.net上的OData服务,我正在构建自己的EDM

代码语言:javascript
复制
ODataModelBuilder builder = new ODataModelBuilder();

        builder.Namespace = "Models";

        EntitySetConfiguration<Incident> incident = builder.EntitySet<Incident>("Incidents");
        incident.EntityType.HasKey(c => c.IncidentID);
        incident.EntityType.Property(c => c.Name);
        incident.EntityType.Property(c => c.IncidentType);
        incident.EntityType.Property(c => c.Description);
        incident.HasIdLink(eic =>
        {
            return eic.GenerateSelfLink(false);
        }, false);

        var hasManyComments = incident.EntityType.HasMany(c => c.IncidentComments);
        incident.HasNavigationPropertyLink(hasManyComments, (z, y) =>
        {
            return z.GenerateNavigationPropertyLink(y, false);
        }, false);

        EntitySetConfiguration<IncidentComment> incidentComment = builder.EntitySet<IncidentComment>("IncidentComments");
        incidentComment.EntityType.HasKey(c => c.CommentID);
        incidentComment.EntityType.Property(c => c.IncidentID);
        incidentComment.EntityType.Property(c => c.Content);
        incidentComment.HasIdLink(eic =>
        {
            return eic.GenerateSelfLink(false);
        }, false);

我正在测试作为客户端的BreezeJS和wcf数据客户端。当我尝试在网络中获取事件时,我看到传递了事件属性和注释在wcf客户端中我得到了空的注释集合以及Breeze测试,我怀疑元数据不正确,我遗漏了什么

EN

回答 1

Stack Overflow用户

发布于 2013-05-28 16:24:19

我想..。问题可能是ODataModelBuilder还没有处理外键的概念。因此,Breeze无法检索将fk链接到其相应导航属性的元数据。我们已经向微软指出了这一点,他们理解这个问题,但他们说这个问题要到以后的版本才能解决。这类似于微软首次发布实体框架时出现的独立关联与外键关联的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16742054

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档