I have the following entities:
public class Transacao : IEntity
{
[Key]
public int Id { get; private set; }
public int LojaId { get; set; }
public virtual Loja Loja { get; set; }
public int AdquirenteId { get; set; }
public virtual Adquirente Adquirente { get; set; }
public DateTime Data { get; set; }
public Guid Numero { get; set; }
public int NumeroPedido { get; set; }
public Decimal Valor { get; set; }
}
public class Adquirente : IEntity
{
[Key]
public int Id { get; private set; }
[Required]
[StringLength(50)]
[Display(Name = "Nome")]
public string Nome { get; set; }
public int AdquirenteId { get; set; }
public List<LojaAdquirente> LojaAdquirentes { get; set; }
}
public class Loja : IEntity
{
[Key]
public int Id { get; private set; }
[Required]
[StringLength(18)]
[Display(Name = "CNPJ")]
public string CNPJ { get; set; }
[Required]
[StringLength(50)]
[Display(Name = "Nome")]
public string Nome { get; set; }
[Required]
[StringLength(50)]
[Display(Name = "Endereço")]
public string Endereco { get; set; }
[Required]
[Display(Name = "Possui Antifraude Habilitado")]
public bool IsAntiFraudeEnabled { get; set; }
public Guid Token { get; set; }
public int LojaId { get; set; }
public List<LojaAdquirente> LojaAdquirentes { get; set; }
}
When I retrieve the database records (_context.Transaction.Where (x => x.Loja.Token.Equals (tokenLoja)), the Store and Buyer entities are coming null. load these entities together with the parent entity?