-
-
Save dlmanning/c09fe225995bc7cb682b to your computer and use it in GitHub Desktop.
Does not populate EntityStore with PriorStudies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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