“Microsoft.OData.Edm.IEdmModel ... [英] 'Microsoft.OData.Edm.IEdmModel...

查看:92
本文介绍了“Microsoft.OData.Edm.IEdmModel ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Guys,



我正在尝试在WebApiConfig.cs中找到的寄存器方法中为我的EDM添加OData路由但是我一直在这错误:



无法从'Microsoft.OData.Edm.IEdmModel'转换为'Microsoft.Data.Edm.IEdmModel



Hello Guys,

I am trying to add an OData route for my EDM in the register method found in the "WebApiConfig.cs" but I keep getting this error:

cannot convert from 'Microsoft.OData.Edm.IEdmModel' to 'Microsoft.Data.Edm.IEdmModel

public static void Register(HttpConfiguration config)
       {
           // Web API configuration and services

           // Web API routes

           config.Routes.MapODataRoute("odata", "odata", GetEdmModel()); //this is were I get the error f 
           config.MapHttpAttributeRoutes();

           config.Routes.MapHttpRoute(
               name: "DefaultApi",
               routeTemplate: "api/{controller}/{id}",
               defaults: new { id = RouteParameter.Optional }
           );
       }


       public static IEdmModel GetEdmModel()
       {

           ODataModelBuilder builder = new ODataModelBuilder();
           builder.EntitySet<Customer>("Customers");
           builder.Namespace = "MyBreeseSote.Models";
           return builder.GetEdmModel();
       }
   }







有什么帮助吗?

谢谢




Any help?
Thank you

推荐答案

我想我想出来了。在Stack Overflow上查看我的主题:

[在ASP.NET Web Api 2.2中启用ODatav4路由时出现问题
I think I figured this out. Check out my thread on Stack Overflow:
[Trouble Enabling ODatav4 Routing in ASP.NET Web Api 2.2]


这篇关于“Microsoft.OData.Edm.IEdmModel ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆