Skip to content

Instantly share code, notes, and snippets.

@dlmanning
Created May 28, 2014 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlmanning/c09fe225995bc7cb682b to your computer and use it in GitHub Desktop.
Save dlmanning/c09fe225995bc7cb682b to your computer and use it in GitHub Desktop.
Does not populate EntityStore with PriorStudies
'use strict';
/* Controllers */
angular.module('myApp.controllers', [])
.controller('myCtrl', ['$scope', 'breeze', 'entityManagerFactory', function($scope, breeze, em) {
var keyGen = breeze.AutoGeneratedKeyType.Identity;
var namespace = 'Model';
var manager = em.newManager();
var helper = new breeze.config.MetadataHelper(namespace, keyGen);
helper.addDataService(manager.metadataStore, manager.serviceName);
helper.addTypeToStore(manager.metadataStore, {
name: 'PriorStudy',
dataProperties: {
priorStudyId: { type: breeze.DataType.Int32 },
patientId: { type: breeze.DataType.Int32 },
priorStudyType: { max: 6 },
priorStudyPurpose: { max: 12 },
notes: { max: 250 }
},
navigationProperties: {
patient: 'Patient'
}
});
helper.addTypeToStore(manager.metadataStore, {
name: 'Patient',
dataProperties: {
patientId: { type: breeze.DataType.Int32 },
firstName: { max: 25 },
lastName: { max: 25 },
},
navigationProperties: {
priorStudies: { type: 'PriorStudy', hasMany: true }
}
})
var query = breeze.EntityQuery.from('Patient/1').toType('Patient').expand('priorStudy')
console.log(query);
manager.executeQuery(query).then(function (results) {
console.log(results);
})
.then(function () {
var ents = breeze.EntityQuery.from('PriorStudy').using(manager).executeLocally();
console.log(ents);
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment