0

I have a problem in IE8 with Breeze using breeze.metadata-helper.js. I already included es5-shim and sham libraries. It fails in: makePropDescription(proto, property) method, while trying to execute: Object.defineProperty(proto, propName, descr) with message "getters & setters can not be defined on this javascript engine".

The property that it fails to add is DeclarationID defined in:

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
};
});

I'm using Breeze v1.4.11 and Metadata-Helper v1.0.5.

Miloš Ostojić
  • 132
  • 1
  • 4

1 Answers1

0

I'm pretty sure that the breeze.metadata-helper addin was NOT designed for IE8. Breeze proper will work with IE8, but in general most breeze addins are NOT tested or certified for IE8 ( and below) unless this is explicitly called out. The specific issue in this case is that IE8 does not support Object.defineProperty for standard javascript classes.

That said, this code is freely available and you could clone and modify it for IE8. It's just that demand for IE8 and below has been dropping steadily and trying to write IE8 compliant components is a real hassle, especially once you've gotten used to using ES5 compatible javascript.

Jay Traband
  • 17,053
  • 1
  • 23
  • 44
  • Jay, the same thing happens if I remove metadata-helper. I'm using an implementation of a datacontext and model similar to the one shown in "Edmunds sample" project. – Miloš Ostojić Mar 24 '14 at 14:50