I am using web api 2.2 odata v4.0. I have a controller which has 3 methods.
For example GetA()
, GetB()
and GetC()
.
Which code should I use so that I will be able to call individual methods from the url ?
Also, how can I call a method GetA()
? - as Get()
is the default method that is being called in ODataController
.
I used the code,
ODataRoute route = config.Routes.MapODataServiceRoute("odata", "odata",GetModel());
route.MapODataRouteAttributes(config); // This line threw an error sowing route does not have the method
MapODataRouteAttributes()
Please suggest me the solution.
Thanks
What do you need GetA(), GetB() and GetC() to do ? Are they for getting specific properties A, B and C? If so, you can take a look at the ODAtaAttributeRoutingSample. And if you want to know more about Web API OData, you can take a look at Sample Service implemented with Web API which is a complete project.