0

I've got a query with many "contains" filters and I've reached the URL limitation (well over 2000 characters).

I've come across this post (OData Url Length Limitations), which solution is to use the $batch feature of ODATA.

Is there a way to do that with breeze ?

Community
  • 1
  • 1
Sam
  • 13,934
  • 26
  • 108
  • 194

2 Answers2

1

If you are willing to sidestep OData a bit, use the withParameters feature to pass filter parameters to the server method. Then you can send the parameters in a more compact representation than OData uses. Note the second example in docs, in which an array is passed as a parameter.

If that's still too big, then you can use the ajaxpost adapter, which allows you to send query parameters using POST. Then the sky's the limit.

Steve Schmitt
  • 3,124
  • 12
  • 14
  • Thanks Steve. The withParameters solution is actually the one I've started implementing before I asked the question here. It's definitely not as neat as using purely ODATA but it works. – Sam Feb 09 '15 at 08:38
  • Remember that you can mix `withParameters` with other query operations. So you could use `withParameters` for your "contains" filters, and still use `where`, `skip`, `take`, `orderBy` for everything else. – Steve Schmitt Feb 09 '15 at 18:17
0

I'd look into writing a Breeze DataServiceAdapter that inherits from the 'OData' adapter you're currently using as described here.

You'd override its executeQuery method and do something appropriate when the URL gets too big.

The executeQuery method for the stock 'OData' adapter is only 22 lines so it shouldn't be daunting.

You will note, however, that this adapter delegates to datajs. That means you'll have to figure out what facilities datajs offers for doing the $batch trick that you described. I don't know the answer to that myself. We'd all like to learn from you.

Ward
  • 17,793
  • 4
  • 37
  • 53
  • Thanks Ward. I understand the idea. That however, involves more work and I'm not sure I have time for this. I will take a look at the datajs code though. – Sam Feb 09 '15 at 08:40