Hopefully someone has a better insight into Breeze's Extended entities, because I'm stumped! So, I have created a partial class (WO_Rout) on the server side (Web API using Breeze's API) and created a property named "AssetJobEqNo".
I have read and followed Breeze's documentation here with no avail. Following the guide I have created a constructor for this particular entity "WO_Rout" like so:
var assets = function () {
this.AssetJobEqNo = '';
};
var serviceName = 'cms8/workorders';
var manager = new breeze.EntityManager({
serviceName: serviceName
});
var store = manager.metadataStore;
store.registerEntityTypeCtor('WO_Rout', assets);
When I query my controller this particular property "AssetJobEqNo" is sent and seen in the JSON raw results on the client side.
So....here is the weird part I can't figure out. If I run a query tied to a button on my UI the property IS loaded and in the object I assigned it, BUT it's still the default value of an empty string, it never loads. Then I run the EXACT same query again grabbing the same entities and this time the value IS there.
In conclusion, I'm confused as to why this extended entity's property is not being filled the first query but if I run the exact same query it loads the second time?
Hope this all makes sense.
dataService function:
function getWorkOrder(reqNo) {
if (reqNo > 0) {
var query = breeze.EntityQuery.from("GetWorkOrders");
query = query.where("req_no", "==", reqNo)
.expand(["WO_RtHelp.WO_Rout", "WO_RtHelp.WO_Rout.eqptmast", "WO_RtHelp.WO_Act.WO_Resources.persmast", "WO_RtHelp.WO_Act.WO_Resources.Kits", "WO_RtHelp.WO_Act.Activity", "WO_RtHelp.WO_Act.WO_Resources.customer", "WO_RtHelp.WO_Act.WO_Resources.eqptmast", "WO_RtHelp.WO_Act.WO_Resources.invsite.invmast", "WO_RtHelp.WO_Act.WO_Resources.crew"])
return manager.executeQuery(query);
} else {
return throwNotification('Please enter a Work Order number.');
}
}
controller function for succeeded queries
function querySucceeded(data) {
$scope.WorkOrder = {};
if (data.results.length === 0) {
sysErrorNotification('No Work Order with System #' + $scope.workOrderSearchNumber);
}
else {
$scope.WorkOrder = data.results[0];
$scope.myData = $scope.WorkOrder.WO_RtHelp;
$('#bottomNav a[href="/WorkOrders/#woMain"]').tab('show');
resetDataSources();
$scope.$apply();
}
}
I'm using Breeze, Angular, Q, and jQuery