Note that there are some explanatory texts on larger screens.

plurals
  1. POCollection navigation properties may NOT be set
    primarykey
    data
    text
    <p>I have been building my first SPA app, spring-boarding off the great work from John Papa's jumpstart.</p> <p>The issue that I'm having is that when I try to perform an Expand via breeze, or simply select all of the fields, I'm getting an issue from Breeze during the mapping of my child collections. newValue.entityAspect is undefined</p> <p>if I query via my api via a select clause, all is well, if I call the table directly, 'Positions' directly, I get the navigation error on the chartVal object. <img src="https://i.stack.imgur.com/dHyLL.png" alt="enter image description here"> <img src="https://i.stack.imgur.com/XviFs.png" alt="enter image description here"></p> <pre><code>var query = EntityQuery.from('Positions') //.select('id, endDate, gauge, hoursPerWeek, memberId, title, summary, startDate, totalHours, weightedHours, company, compensation') .where('memberId', '==', id) .expand('Company, ChartVals') .orderBy(orderBy.positions); return manager.executeQuery(query) .then(querySucceeded) .fail(queryFailed); function querySucceeded(data) { var list = partialMapper.mapDtosToEntities(manager, data.results, entityNames.position, 'id'); if (observables) { observables(list); } </code></pre> <p>The query above will succeed, then make a call to MapDtosToEntities (courtesy of John Papa)</p> <p>function mapDtosToEntities(manager, dtos, entityName, keyName, extendWith) { return dtos.map(dtoToEntityMapper);</p> <pre><code> function dtoToEntityMapper(dto) { var keyValue = dto[keyName]; var entity = manager.getEntityByKey(entityName, keyValue); if (!entity) { // We don't have it, so create it as a partial extendWith = $.extend({ }, extendWith || defaultExtension); extendWith[keyName] = keyValue; entity = manager.createEntity(entityName, extendWith); } mapToEntity(entity, dto); entity.entityAspect.setUnchanged(); return entity; } function mapToEntity(entity, dto) { // entity is an object with observables // dto is from json for (var prop in dto) { if (dto.hasOwnProperty(prop) &amp;&amp; prop !="entityAspect") { entity[prop](dto[prop]); &lt;-- tanks here on children } } return entity; } } /// &lt;summary&gt; /// TODO: Update summary. /// &lt;/summary&gt; public class Position : PersistableObject { public int CompanyId { get; set; } /// &lt;summary&gt; /// Weighted hours based on Half-Life. /// &lt;/summary&gt; public int CreditMinutes { get; set; } public int? CompensationId { get; set; } public DateTime? EndDate { get; set; } /// &lt;summary&gt; /// Code to hold measure of completeness. 10 = complete 0 = not complete. /// &lt;/summary&gt; public int Gauge { get; set; } public int? HoursPerWeek { get; set; } public bool IsCurrent { get; set; } [StringLength(40)] public string LinkedInId { get; set; } [Required] public int MemberId { get; set; } [StringLength(40)] public string Title { get; set; } [StringLength(400)] public string WeightedWords { get; set; } /// &lt;summary&gt; /// Adjusted Experience score Based on half life /// &lt;/summary&gt; public int Score { get; set; } [Required] [StringLength(2000)] public string Summary { get; set; } public DateTime StartDate { get; set; } public decimal? SalaryEnd { get; set; } /// &lt;summary&gt; /// Hourly salary - let users enter hourly, monthly, annual etc /// &lt;/summary&gt; public decimal? SalaryStart { get; set; } public decimal TotalHours { get; set; } /// &lt;summary&gt; /// Total Man-hours Multiplied by Gauge reading /// &lt;/summary&gt; public decimal WeightedHours { get; set; } public int VisibilityId { get; set; } public Company Company { get; set; } public Member Member { get; set; } public virtual Compensation Compensation { get; set; } public virtual ICollection&lt;Project&gt; Projects { get; set; } public virtual ICollection&lt;Tag&gt; Tags { get; set; } public virtual ICollection&lt;ChartVal&gt; ChartVals { get; set; } } public class ChartVal : PersistableObject { [Required] [StringLength(40)] public string Key { get; set; } public double Value { get; set; } public string Percentage { get; set; } public int PositionId { get; set; } public virtual Position Position { get; set; } } </code></pre> <p>Thanks for taking a moment to check out my issue. I appreciate your time!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload