Chiricescu Mihai Chiricescu Mihai - 10 months ago 69
C# Question

Odata with no metadata actions not working

I tried the solution described in this article here:
Original article

As described i did:

var defaultConventions = ODataRoutingConventions.CreateDefault();
var conventions = defaultConventions.Except(
routeName: "ODataRoute",
routePrefix: null,
model: model,
pathHandler: new DefaultODataPathHandler(),
routingConventions: conventions);

Everything worked ok, no more metadata informations. Standard request work Ok but the unbound actions and functions are not working anymore i get a 404 response.

I register actions to Odata model builder like:

var validateEmailAction = builder.Action("ValidateEmail");

And in controller i have:

public async Task<IHttpActionResult> ValidateEmail(ODataActionParameters parameters)

Any suggestions how can i achieve hiding Odatametada but still have actions/functions working?



will create a list of routing conventions WITHOUT attribute routing.

While, unbound actions and functions need attribute routing.

So, You must change to call: