I'm currently working on a proof of concept relating these technologies.
I've basically implemented what is suggested in this article, with the exception of using EF code first.
Consuming an ASP.NET Web API OData Service with Breeze
An exception i.e.
"Uncaught TypeError: Cannot read property 'propertyRef' of undefined"
gets thrown when executing this piece of client side code:
<script type="text/javascript">
var my = {}; //my namespace
$(function () {
debugger;
var serverAddress = "/odata/";
breeze.config.initializeAdapterInstances({ dataService: "OData" });
var manager = new breeze.EntityManager(serverAddress);
my.vm = {
entities: ko.observableArray([]),
load: function () {
var query = breeze.EntityQuery.from("Customers");
manager.executeQuery(query, function (data) {
var results = data.results;
$.each(data.results, function (i, c) {
my.vm.entities.push(c);
});
})
.fail(function (e) {
alert(e);
}); ;
}
}
my.vm.load();
ko.applyBindings(my.vm);
});
</script>
which originates in from this in the breeze.debug.js
function convertFromODataEntityType(odataEntityType, schema, metadataStore) {
var shortName = odataEntityType.name;
var ns = getNamespaceFor(shortName, schema);
var entityType = new EntityType({
shortName: shortName,
namespace: ns
});
---> **EXCEPTION HERE**--->var keyNamesOnServer = toArray(odataEntityType.key.propertyRef).map(__pluck("name"));
toArray(odataEntityType.property).forEach(function (prop) {
convertFromODataDataProperty(entityType, prop, schema, keyNamesOnServer);
});
toArray(odataEntityType.navigationProperty).forEach(function (prop) {
convertFromODataNavProperty(entityType, prop, schema);
});
metadataStore.addEntityType(entityType);
return entityType;
}
Querying the odata service via the url returns me the desired results, so its does not seem to be a data retrieval problem.
I've done some searching and the cause was suggested as breeze not handling inherited types as of yet.
In my case here I'm not using an inherited type.
Any suggestions are welcome.