Reputation: 2065
I have the following model:
Products (DbSet<Product>) ProductHasWidgets (DbSet<ProductHasWidget> many-to-many w/ payload) Widgets (DbSet<Widget>)
I am getting stuck with querying across and/or from the many-to-many table and have two questions:
How do I write a breeze query to return all Products where:
Widget.IsActive == true
ProductHasWidgets.WidgetId == 1
Upvotes: 0
Views: 238
Reputation: 17052
As of Breeze 1.4.6, Breeze now supports "any" and "all" queries. See: http://www.breezejs.com/documentation/query-examples
Depending on your model, this means that your query would look something like:
var predicate = breeze.Predicate.create("WidgetId", "==" 1)
.and("Widget.IsActive", "==", true);
var query = EntityQuery.from("Products")
.where("ProductHasWidgets", "any", predicate);
Upvotes: 0
Reputation: 17863
You can't do that from a Breeze client yet because Breeze does not support the any
keyword at this time.
You can write a service method to do the query on the server. The client can pass query parameters to that method using the BreezeJS withParameters
query verb.
Upvotes: 1