Question

I am using breeze and the filter does not work.

var EntityQuery = breeze.EntityQuery;
var manager = configureBreezeManager("xxx");

function configureBreezeManager(param) {
   breeze.NamingConvention.camelCase.setAsDefault();
   var mgr = new breeze.EntityManager(param);
   model.configureMetadataStore(mgr.metadataStore);
   return mgr;
}

And my query query

var query = EntityQuery.from('GetStudents').where("Id", "==", "xxx");
 return manager.executeQuery(query)

The filter is ignore and all results are returned. my get student returns an IQueryable of all students.

public IQueryable<Students> GetStudents(){
     return context.Students;
}

Is there something up there I am doing wrong or should I look elsewhere?

EDIT I realize that my controller is missing the property [BreezeController]. But when I include that, me metadata path is not found giving me an error (error 500 below) when trying to load it. The matadata loads fine without this property on the controller, but filtering does not work. Is this related?

"Could not load file or assembly 'System.Web.Http.OData, ... or one of its dependencies. The system cannot find the file specified."
Was it helpful?

Solution 2

I was missing the [BreezeController] and after adding it, I received the error Could not load file or assembly System.Web.Http.OData, Version=4.0.0.0 and was able to solve it by runing Install-Package Microsoft.AspNet.WebApi.OData in the package manager

OTHER TIPS

Your issue might be that you have specified a 'camelCase' namingConvention, but your query is for 'Id' instead of 'id'. i.e. try:

var query = EntityQuery.from('GetStudents').where("id", "==", "xxx");
return manager.executeQuery(query) 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top