diff --git a/lib/services/sqlAzure/models/databaseresult.js b/lib/services/sqlAzure/models/databaseresult.js index e531ed5917..274450c6f7 100644 --- a/lib/services/sqlAzure/models/databaseresult.js +++ b/lib/services/sqlAzure/models/databaseresult.js @@ -22,7 +22,7 @@ exports.serialize = function (databaseName, collation, edition, maxSizeInGB) { var databaseDescription = { }; databaseDescription['CollationName'] = { '$': { 'type': 'Edm.String' }, '_': collation }; - databaseDescription['CreationDate'] = { '$': { 'm:type': 'Edm.DateTime' }, '_': '0001-01-01T00:00:00' }; + databaseDescription['CreationDate'] = { '$': { 'type': 'Edm.DateTime' }, '_': '0001-01-01T00:00:00' }; databaseDescription['Edition'] = { '$': { 'type': 'Edm.String' }, '_': edition }; databaseDescription['Id'] = { '$': { 'type': 'Edm.Int32' }, '_': 0 }; databaseDescription['IsFederationRoot'] = { '$': { 'type': 'Edm.Boolean' }, '_': null }; diff --git a/lib/util/odatahandler.js b/lib/util/odatahandler.js index 5852facec7..e13d972d74 100644 --- a/lib/util/odatahandler.js +++ b/lib/util/odatahandler.js @@ -153,7 +153,7 @@ OdataHandler.prototype._setProperty = function (entity, propertyName, value, typ OdataHandler.prototype.serialize = function (entity, skipType) { var properties = {}; - for (var name in entity) { + Object.keys(entity).forEach(function (name) { if (name !== '_') { properties[OdataHandler.NSDATA + ':' + name] = { }; properties[OdataHandler.NSDATA + ':' + name][Constants.XML_METADATA_MARKER] = {}; @@ -162,12 +162,13 @@ OdataHandler.prototype.serialize = function (entity, skipType) { var propertyValue = null; if (entity[name] && - entity[name][Constants.XML_VALUE_MARKER] !== undefined && entity[name][Constants.XML_METADATA_MARKER] !== undefined && entity[name][Constants.XML_METADATA_MARKER].type !== undefined) { - propertyValue = edmType.serializeValue(entity[name][Constants.XML_METADATA_MARKER].type, entity[name][Constants.XML_VALUE_MARKER]); propertyType = entity[name][Constants.XML_METADATA_MARKER].type; + if (entity[name][Constants.XML_VALUE_MARKER] !== undefined) { + propertyValue = edmType.serializeValue(propertyType, entity[name][Constants.XML_VALUE_MARKER]); + } } else { if (entity[name] !== undefined && entity[name] !== null) { @@ -187,7 +188,7 @@ OdataHandler.prototype.serialize = function (entity, skipType) { properties[OdataHandler.NSDATA + ':' + name][Constants.XML_METADATA_MARKER][OdataHandler.NSMETA + ':null'] = true; } } - } + }); return atomHandler.serializeEntry({ 'm:properties': properties }, [ {