| 9256 | |
| 9257 | // Used by both ComplexType and EntityType |
| 9258 | function addProperties(entityType, propObj, ctor) { |
| 9259 | |
| 9260 | if (!propObj) return; |
| 9261 | if (Array.isArray(propObj)) { |
| 9262 | propObj.forEach(entityType._addPropertyCore.bind(entityType)); |
| 9263 | } else if (typeof (propObj) === 'object') { |
| 9264 | for (var key in propObj) { |
| 9265 | if (__hasOwnProperty(propObj, key)) { |
| 9266 | var value = propObj[key]; |
| 9267 | value.name = key; |
| 9268 | var prop = new ctor(value); |
| 9269 | entityType._addPropertyCore(prop); |
| 9270 | } |
| 9271 | } |
| 9272 | } else { |
| 9273 | throw new Error("The 'dataProperties' or 'navigationProperties' values must be either an array of data/nav properties or an object where each property defines a data/nav property"); |
| 9274 | } |
| 9275 | } |
| 9276 | |
| 9277 | breeze.MetadataStore = MetadataStore; |
| 9278 | breeze.EntityType = EntityType; |