I am currently utilizing the most recent versions of Angular, breeze, and EF.
Within the client environment, I am working on creating a sophisticated object named Quote that is associated with a job. This Quote includes a QuoteMeasure, which in turn contains a navigation property called measure:
var quote = em.createEntity("Quote", { id: breeze.core.getUuid() }),
quoteMeasure,
measure;
measure = _getMeasureFromLookups(4);
quoteMeasure = em.createEntity("QuoteMeasure", { id: breeze.core.getUuid(), quoteId: quote.id });
I have attempted the following approach which triggers a query to the server:
quoteMeasure.measureId = measure.id;
quoteMeasure.entityAspect.loadNavigationProperty("measure").then(function () {
console.log(quoteMeasure.measure);
});
quote.quoteMeasures.push(quoteMeasure);
job.quotes.push(quote);
directed to the URL /Breeze/Data/Measure?$filter=Id%20eq%204&
This URL, however, does not exist. I am interested in manually setting the navigation property as it pertains to static data that was previously obtained through a breeze query on the server:
[HttpGet]
public object Lookups()
{
var measures = UnitOfWork.MeasureRepository.Get(null, q => q.OrderBy(m => m.Ordinal)).ToList();
return new { measures = measures };
}
The function _getMeasureFromLookups is designed to retrieve the previously stored measure. I would prefer to assign it in this manner:
quoteMeasure.measure = measure;
However, I am encountering a cryptic error on the client:
Error: A is undefined M@//llhst/X/Scripts/breeze.min.js:1 d/f.set@//llhst/X/Scripts/breeze.min.js:5 _createNewQuote@//llhst/X/Scripts/app/services/jobService.js:76
This issue appears to be related to downloading a complete tree of objects via the lookup, rather than focusing on an individual measure entity. The Breeze documentation discusses 'Omitting navigation properties' here, but fails to provide clear instructions on how to implement this.
Therefore, my query is centered around the best practices for loading navigation property data offline. How can the above code sample be adjusted to function correctly?