Bruno Assis
Bruno Assis

Reputation: 1006

OData function routing conventions

I have been studying OData for a while and I am facing a specific requirement which I couldn't find a solution for, which is calling a function in OData with the parameters surrounded by slashes, in other words, I need to accomplish this: /entity/key/functionName/param1/param2/param3/ I have tried using [RoutePrefix("/entity/{key}/functionName/{param1}/{param2}..."] without any success. The action was like this:

public IHttpActionResult functionName(int key, int param1, int param2...)

I know that you can have this result by using [RoutePrefix("/entity({key}/functionName(param1={param1}....). But this is not what I want.

Does anybody has any idea if is it accomplishable?

Upvotes: 1

Views: 430

Answers (1)

TomDoesCode
TomDoesCode

Reputation: 3681

OData is effectively a specification for how to communicate with a webservice. It defines how to sort, select and filter but also how to call functions. What you are suggesting here is to call a function but not in the way that OData specifies so asking whether it can be done in OData doesn't really make any sense. I would either try and achieve it separately from OData, i.e. just using regular Web.API or try use the existing OData format, otherwise you will need to rewrite a large part of the OData library

Upvotes: 2

Related Questions