我目前使用的是最新版本的breezejs(1.4.2),與requirejs和淘汰賽。我有以下需要配置...BreezeJs,RequireJs和淘汰賽,但沒有observables
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"] }
}
});
看着網絡流量,breeze.min.js在所有上面列出的依賴關係之後被加載,但仍然得到了微風查詢返回的常規JSON對象,而不是像我所期望的那樣擊倒可觀察屬性。
如果我在requirejs之外添加knockout腳本,在breeze腳本之前使用標準腳本標記,則一切正常。所以,這確實暗示了我無法解決的依賴性和加載順序偏好的問題。
這是我用來返回微風實體的示例查詢。請注意,我所有的微風查詢都會返回具有不可觀察屬性的實體:
// Look for the log in manager"s cache first
// Fetch from the database if not found in 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);
顯示您的查詢。 –