我在 IE8 中使用 Breeze.metadata-helper.js 时遇到问题。我已经包含了 es5-shim 和 sham 库。它在尝试执行时失败:makePropDescription(proto, property) 方法:Object.defineProperty(proto, propName, descr) 带有消息“getters & setters can not be defined on this javascript engine”。
它未能添加的属性是 DeclarationID 定义在:
define([], function () {
var dt = breeze.DataType;
var defaultNamespace = 'Our.Custom.Namespace';
// Breeze Labs: breeze.metadata.helper.js
var helper = new breeze.config.MetadataHelper();
var addDataService = helper.addDataService.bind(helper);
var addTypeToStore = helper.addTypeToStore.bind(helper);
var setDefaultNamespace = helper.setDefaultNamespace.bind(helper);
var createMetadataStore = function () {
return new breeze.MetadataStore();
};
var addDeclaration = function (store) {
var et = {
shortName: "Declaration",
namespace: defaultNamespace,
defaultResourceName: "Declaration",
dataProperties: {
DeclarationID: { dataType: dt.Int64, isPartOfKey: true },
MRN: { dataType: dt.String },
IssuingDate: { dataType: dt.DateTime },
DeclarationStateCode: { dataType: dt.String },
DeclarationStateID: { dataType: dt.Int64 },
DeclarationType: { dataType: dt.String }
}
};
return addTypeToStore(store, et);
};
var initialize = function (dataService) {
var store = createMetadataStore();
addDataService(store, dataService);
setDefaultNamespace(defaultNamespace);
addDeclaration(store);
return store;
};
return {
initialize: initialize
};
});
我正在使用 Breeze v1.4.11 和 Metadata-Helper v1.0.5。