Reputation: 323
Have all a structure for creating complex queries and obtaining data on the client side using Breeze and webapi IQueryable<T>
.
I would use this structure on the client side to call another webapi controller, intercept the result of the query, and use this to make an Excel file returned by HttpResponseMessage
.
See: Returning binary file from controller in ASP.NET Web API
How can I use the executeQuery
without getting return data in standard Breeze JSON and without interfering with the data on the client side cache to have the 'octet-stream'.
The goal is to create an 'Export to Excel' without existing frontend paging for a large volume of data.
Upvotes: 0
Views: 222
Reputation: 17863
Create a custom "data service adapter" and specify it when you create an EntityManager for this special purpose. It can be quite simple because you disable the most difficult parts to implement, the metadata and saveChanges methods.
You don't want to cache the results. Therefore, you make sure the manager's metadata store is empty and you should add the " no caching" QueryOption. [exact names escape me as I write this on my phone].
Make sure these steps are really adding tangible value
Specialized server operations often can be performed more simply with native AJAX components.
p.s. I just saw @didar 's answer which is consistent with mine. Blend these thoughts into your solution.
Upvotes: 0
Reputation: 1240
If you don't want to track changes, call EntityQuery.noTracking()
before calling executeQuery()
. This will return raw javascript objects without breeze tracking capabilities.
You can't make executeQuery()
return binary 'octet-stream' data. But you can use breeze ajax implementation:
var ajaxImpl = breeze.config.getAdapterInstance("ajax");
ajaxImpl.ajax() // by default it is a wrapper to jQuery.ajax
Look http://www.breezejs.com/documentation/customizing-ajax
Upvotes: 1