Monday, 26 August 2013

BreezeJS does not perform filtering ind database?

BreezeJS does not perform filtering ind database?

I am using the following query on the client:
var query =
breeze.EntityQuery.from("AllCustomers").where("CustomerId,"==",criteriaValue);
return this.manager.executeQuery(query)
which results in the following URL:
/breeze/myAPI/AllCustomers?$filter=CustomerId%20eq%2012
I have noticed that the filtering is not performed in the database (there
is no WHERE statemenet in dthe SQL executed by the database). I suspect,
that the reason for this is Breeze.WebApi.QueryHelper.WrapResult, which
calls Enumerable.ToList. The later converts IQueriable to list which
forces execution of the query before if is filtered by default Microsoft
OData implementation:
// if a select or expand was encountered we need to
// execute the DbQueries here, so that any exceptions thrown can be
properly returned.
// if we wait to have the query executed within the serializer, some
exceptions will not
// serialize properly.
queryResult = Enumerable.ToList((dynamic)queryResult);
queryResult = PostExecuteQuery((IEnumerable)queryResult);
Is this a bug in Breeze or am I doing something wrong?
I am using Oracle ODP.NET provider for entity framework.

No comments:

Post a Comment