I'm currently using the latest version of breezejs (1.4.2), with requirejs and knockout. I have the following require config...
require.config({
paths:
{
"jquery": "../Scripts/jquery-1.10.2.min", //using jquery 1.x for older browsers
"bootstrap": "../Scripts/bootstrap.min",
"knockout": "../Scripts/knockout-2.3.0",
"knockoutMapping": "../Scripts/knockout.mapping-latest",
"toastr": "../Scripts/toastr.min",
"Q": "../Scripts/Q.min",
"es5-shim": "../Scripts/es5-shim.min",
"es5-polyfill": "../Scripts/es5-polyfill",
"breeze": "../Scripts/breeze.min",
"kendo": "../Scripts/kendo/2013.2.716/kendo.web.min",
"knockoutKendo": "../Scripts/knockout-kendo.min",
"globalize": "../Scripts/globalize/globalize",
"globalize-au": "../Scripts/globalize/cultures/globalize.culture.en-AU"
},
shim:
{
"jquery": { exports: "$" },
"knockout": { deps: ["jquery"] },
"Q": { deps: ["jquery", "knockout"] },
"breeze": { deps: ["knockout", "jquery", "Q", "es5-shim", "es5-polyfill"] },
"globalize-au": { deps: ["globalize"] },
"bootstrap": { exports: "Bootstrap", deps: ["jquery"] },
"kendo": { deps: ["jquery"] },
"knockoutKendo": { deps: ["knockout", "kendo"] },
"knockoutMapping": { deps: ["knockout"] }
}
});
Looking at the network traffic, breeze.min.js is loaded after all the listed dependencies above but I still get regular JSON objects returned by breeze queries and not knockout observable properties, as I would expect.
If I add the knockout script outside of requirejs, using standard script tags before the breeze script, then everything works. So, this does suggest an issue with dependencies and loading order preferences that I can't work out.
Here is a sample query that I am using to return the breeze entities. Note, that all my current breeze queries return entities with non-observable properties:
// Look for the log in manager"s cache first
// Fetch from the database if not found in the cache
return manager
.fetchEntityByKey("SqlLog", sqlLogId, true)
.then(function (data)
{
log("Retrieved [SQL DETAILS] from remote data source", data, true);
// using entity values here as breeze not returning observables.
sqlText(data.entity.SqlText);
parameters(data.entity.Parameters);
exceptionMessage(data.entity.ExceptionMessage);
})
.fail(queryFailed);