Click here to Skip to main content
15,897,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

C#
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
Posted
Updated 15-Aug-14 4:50am
v3
Comments
Kevin Donn 26-Oct-14 13:43pm    
I'm a me-too on this. Got into this boat doing a round of package upgrades. Still looking for the fix if anyone knows it.
Chris Spears 25-Mar-15 14:45pm    
I ran into this issue today as well. Very frustrating.

1 solution

I think I figured this out. Check out my thread on Stack Overflow:
[Trouble Enabling ODatav4 Routing in ASP.NET Web Api 2.2]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900