I'm trying to filter entities based on a collection of child entities. Here are my entities (EF POCO's):
public class Customer
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<Order> Orders { get; set; }
}
public class Order
{
public int Id { get; set; }
public string Description { get; set; }
}
Using Breeze js I want to return all customers where any Order.Description contains the word 'foo'. I imagined the query to look similar to this:
query = entityQuery.from('Customers')
.where("Orders.Description", "contains", "foo");
But of course that won't work. Any ideas?
As of Breeze 1.4.6, Breeze now supports the "any" and "all" query operators.
See: http://www.breezejs.com/documentation/query-examples
This means that this query can now be composed as:
var query = breeze.EntityQuery.from("Customers")
.where("Orders", "any", "Description", "contains", "Foo");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With