Chiricescu Mihai Chiricescu Mihai - 1 year ago 132
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?

Answer Source


will create a list of routing conventions WITHOUT attribute routing.

While, unbound actions and functions need attribute routing.

So, You must change to call:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download