0

We are building a query service for client which have the following requirements:

  • Support Where, Begin, Contains, And, Or, Paging, Select. (1-main)
  • Lookup/Mapping multiple values from one value to another values. Client will pass hundreds of values and it will return the same amount of values back. (2)
  • Return some clear error codes for invalid requests (Missing parameters, Unknown field specified, Unknown Where condition specified, etc) (3)

For (1) and (2), we have seen that OData has strong syntax for supporting them and (OData + WebAPI) may be a good/flexible solution but we have some concerns:

  • Client wants to pass query over POST, not GET, due to the large filter size from (2). We saw some options, so we think about these 2 solutions for OData: ($batch-supported OData endpoint, POST OData URI and manually parse it into ODataQueryOption)
  • There are some concerns about OData endpoint query performance. Is it good enough or can we just use POST OData URI and use custom store procedure for best performance?
  • For (3), it seems we haven't found a way to invoke OData enpoints to return correct error codes yet.

We also think about building a custom JSON object, pretty much same as ODataQueryOption and use Web.API actions for each of those requirements in case OData cannot completely handle those requirements with good performance. But it would be our last choice.

So what's your choice to implement those 3 above? Thanks.

Community
  • 1
  • 1
Tan Vu
  • 3
  • 3

1 Answers1

0

I would first investigate OData batch processing to determine if it would suffice. That way you don't need to reimplement anything low-level for your second requirement (that would be your first solution).

Query performance is usually as good as the backend, parsing the URI shouldn't be a consideration at this point. If you are using the Entity Framework, then look at how Linq queries look like, and ultimately how they translate to the real backend.

Error reporting is specified here. Note that you will have the ability to return multiple errors in the same response in OData 4.0. You have multiple ways of creating such responses with ASP.NET Web API + OData extensions. Look at ODataErrors and CreateODataErrorResponse.

Your first requirement is perfectly covered I would think.

Ultimately, you're going to have to go with your gut or, if you have enough time allocated for tech eval, play with a few prototypes and run some actual numbers.

tne
  • 7,071
  • 2
  • 45
  • 68
  • Thanks. we will look into the Error from OData + Web API. About the performance, I think we will try some custom SP based on pure Linq SP and put it in EntitySetController/Get endpoint. Btw, we did succeed in implement [WebAPI-supported OData batch](http://aspnetwebstack.codeplex.com/wikipage?title=Web%20API%20Request%20Batching) and it can handle very long query quite well. – Tan Vu Oct 07 '13 at 04:31