Here is my code: Server-Web API
=======================================
public class OwnerDto { public int OwnerId { set; get; } public string OwnerName { set; get; } } [HttpGet] public IEnumerable GetOwner() { IEnumerable result = new[] { new OwnerDto { OwnerId = 1, OwnerName = "Test1" }, new OwnerDto { OwnerId = 2, OwnerName = "Test2" }, new OwnerDto { OwnerId = 3, OwnerName = "Test3" }, new OwnerDto { OwnerId = 4, OwnerName = "Test4" } }; return result; }
js code
var dataService = new breeze.DataService({ serviceName: "/api/owner/", hasServerMetadata: false, }); var manager = new breeze.EntityManager({ dataService: dataService }); var store = manager.metadataStore; //metadataStore.namingConvention = namingConv; store.addEntityType({ shortName: "Owner", namespace: "Test.Owner", dataProperties: { OwnerId: { dataType: breeze.DataType.Int32, isPartOfKey: true }, OwnerName: { dataType: breeze.DataType.String} } }); var op = breeze.FilterQueryOp; var query = new breeze.EntityQuery() .from("GetOwner") .where("ownerId",op.Equals,2); manager.executeQuery(query).then(function (data) { ko.applyBindings(data, $("#SearchResult")[0]); }).fail(function (e) { alert(e); });
Html Code
p- data-bind="visible: !results" Fetching data .. ul- data-bind="foreach: results, visible: results" style="display:none" span- data-bind="text: OwnerName" span- data-bind="text: OwnerId"
========================================== The problem is all the data can display but the filter(where/take/order...) does not work. Any ideas, Thanks very much!