OData Any and All with JayData or Breeze - odata

OData supports Any and All, which helped me a lot in my previous project. Now I use JayData to avoid writing OData query strings, but haven't found results by searching for any() and all().
Is there any existing functionality or plans to implement it?
I checked Breeze.js, but the result is the same.

Updated post: 11/25/13
As of Breeze 1.4.6, 'any' and 'all' operators are now supported.
See: http://www.breezejs.com/documentation/query-examples
Older post
For Breeze, we should have support for both any() and all() within the next two months for both our WebApi and OData providers.

Standard JavaScript array.some() and array.every() functions are compiled to OData Any and All operations, so the API follows the JavaScript terminology, to hide the differences between different data sources.
Detailed blogpost - Using some() and every() with JayData OData provider
The provider capability matrix show that these operations are supported only by OData provider.

Related

How can you use BreezeJS without Entity Framework and OData?

How can Breeze JS be used to consume a pure, simple, plain old RESTful API? Consider a web api endpoint that does not support OData and does not have Microsoft Entity Framework as the OR/M layer.
I see there's this Edmund's sample here, but I would like it to be more specific on how to manually setup BreezeJS metadata, since from what I understand about not having OData support is the fact that you lose out-of-the-box metadata resolution for the model consumed from an api endpoint. I quote from this Edmund example:
we have not yet described the Metadata Definition API properly. We ask that you rely on your intuition as you read this code ... your intuition will usually be correct. Please post questions to StackOveflow tagged with "breeze".
Is there any source of information on this topic that leaves intuition aside?
That Edmunds sample is so old, it pre-dates any of the documentation on how to write metadata.
Take a look at the Metadata by Hand topic in the BreezeJS documentation.

Does PetaPoco also support OData like Entity Framework?

Can I use oData with PetaPoco also? I have a requirement where I need to filter the records by passing more than one input parameters. The method will be a WebAPI method.
I got the answer, At the time exploring this link, I found this quote "Web API OData does not require EF. Use any data-access layer that can translate database entities into models."
It means PetaPoco should also support OData.
PetaPoco maintainer here.
No PetaPoco doesn't support OData and most likely never will.
The reason why is the mapping to and from OData for all supported DBs would be a too much work.

OData 4 custom provider with WebAPI

I'm looking for examples on how to implement a custom data provider for OData 4 and WebAPI (preferably for an in-memory untyped dataset).
Doese anyone know of any examples out there? My googeling turned up little of use.
I know of this example: http://msdn.microsoft.com/en-us/data/gg191846
But can't find the project-files for the example-code ... also it's from 2011 and things have changed since then...
You can refer to Web API OData Sample code at
https://aspnet.codeplex.com/SourceControl/latest
You can find the code at "Samples/WebApi/OData/v4/ODataUntypedSample" in the left panel.
There is another blog talking about "Typeless Entity Object Support in WebApi".
http://blogs.msdn.com/b/leohu/archive/2013/11/05/typeless-entity-object-support-in-webapi.aspx

Custom queries with Breeze JS (Fiql + Breeze)

Im new to breeze js, I understand that breeze has it's own query language related to OData
But I am trying to get breeze js working with a custom query language, as an example FIQL is
one of the form to make queries to backend, can we get breeze run with this type of query language.
Overview of FIQL :-
http://jaxenter.com/tutorial-smarter-search-with-fiql-and-apache-cxf-46876.html
(this is not a technical answer, at the very most it's an advice)
As mentionned from their website documentation :
Today, out of the box, the Breeze product ships with adapters for the
ASP.NET Web API and for OData. It also ships with .NET components that
interface with the Entity Framework and that generate Breeze metadata
from an Entity Framework model; that EF model could be developed code
first or database first. The Breeze client is in no way limited to
these technologies; they are merely the first backend components
available; we’d be thrilled to help you adapt Breeze to your preferred
server stack.
First question is whether
1) you want breeze to actually create FICL queries on the client and send them to a FICL service. This involves translating a client side breeze EntityQuery into FICL url syntax. If so you would need to create a new a 'uriBuilder' adapter.
2) you want to translate a breeze query already sent to your service into FIQL syntax on the server so that you can further refine the query and then send it on to your FICL service. If so you would need to create a breeze DataService endpoint.
Both of these are certainly possible.
If you are looking at the 1st option, take a look at the 'b000_uriBuilder.xxx' files in the breeze GitHub repo under the 'src' directory. There should be two 'uriBuilder.xxx' files, one which translates an EntityQuery into OData syntax and another that translates the EntityQuery into a new 'json' query syntax. There is also additional information on this 2nd syntax here:
http://www.getbreezenow.com/documentation/query-using-json
Both of these 'uriBuilder's make use an internal 'visitor' framework that we have not yet documented but should be reasonably understandable by looking at the source.
If you are looking at the 2nd option, I would recommend looking at the link mentioned above and then taking a look at the 'breeze.node.js' repo and the 'breeze-sequelize' subdir within it. In this repo we take a serialized server side breeze EntityQuery and translate it into a 'Node' Sequelize query that we can apply to a variety of backends.
Another option is to contact our professional services arm, at breeze#ideablade.com and ask them to assist in building the adapters for you or to ask for more detailed technical help.

Breeze with third party API

Is it possible for Breeze to access a third party API that does not have a "BreezeController" nor supports OData?
"BreezeController" is simply a .NET attribute that helps .NET WebApi provide support for query filtering and ordering via OData "syntax" and well as json serialization support for entity graphs and type identity. Type identity is important so that breeze can track the entities within its entityManager and merge the results of queries and update relation properties. OData itself is never required.
If you don't want the ability for the client to add filtering and ordering instructions to the server, you can write your own attribute that simply provides the json serialization support. The json serialization consists simply of configuring the json.net formatter that web api is already using.
The source for the BreezeControllerAttribute may be found in the Breeze.WebApi project and is really pretty short. Just create your own 'FooControllerAttribute' by copying the 'BreezeControllerAttribute' and remove the IFilterProvider code.
On the other hand, the query and filtering support won't hurt anything and this logic isn't even applied unless you use the EntityQuery 'where' 'orderBy' 'select' or 'expand' methods, so unless you want to explicitly remove this ability there is no need to not use the 'breezeControllerAttribute'

Resources