1
votes
   public class Denial
{
    [Key]
    public string DenialCd { get; set; }
    [Required]
    public string DenialDesc { get; set; }

    public ICollection<CaseDenial> CaseDenials { get; set; }
}


public class CaseDenial
{
    [Key]
    public int ID { get; set; }

    [Required]
    public string DenialCd { get; set; }

    [Required]
    public int CaseId { get; set; }

    [ForeignKey("DenialCd")]
    public Denial Denial { get; set; }
    [ForeignKey("CaseId")]
    public Case Case { get; set; }
}

      var query = EntityQuery.from('CaseDenials')
            .where("CaseId", "==", caseID)
            .expand("Denial")
            .orderBy("DenialCd").inlineCount();

CaseDenial table links to DenialCd column of Denial table. Above breeze query brings null for the navigation property "Denial" while fetching records from CaseDenials.

2

2 Answers

1
votes

My guess is that your EF model is not attributed 'correctly'. I would confirm that you can perform a server side Entity Framework 'Include' operation. This is what Breeze is doing under the covers when you call a client side 'expand'.

1
votes

As far as I know, if you have 1 denial with MANY case denials, then you should query as follows:

var query = EntityQuery.from('Denials')
    .where("CaseDenial.CaseId", "==", caseID)
    .expand("CaseDenial")
    .orderBy("DenialCd").inlineCount();

This should work. What you can try as well is adding [InverseProperty("CaseDenials")]