public class BaseEntity
{
[Key]
public Guid Id { get; set; }
}
public class Classe : BaseEntity
{
public string Nome { get; set; } = string.Empty;
}
public class Aluno : BaseEntity
{
public Guid ClasseId { get; set; }
public string Nome { get; set; } = string.Empty;
public string Cpf { get; set; } = string.Empty;
public string Rg { get; set; } = string.Empty;
public required DateTime DataNascimento { get; set; }
public Classe Classe { get; set; } = new Classe();
}
public class Classe : BaseEntity
{
public string Nome { get; set; } = string.Empty;
}
This query is giving an error
public IEnumerable<Aluno> GetByClasseId(Guid classeId)
{
var result = _unitOfWork.Connection.Select<Aluno, Classe, Aluno>(p => p.Classe.Id == classeId, _unitOfWork.Transaction);
return result;
}
This query works
public IEnumerable<Aluno> GetByClasseId(Guid classeId)
{
var result = _unitOfWork.Connection.Select<Aluno, Classe, Aluno>(p => p.ClasseId == classeId, _unitOfWork.Transaction);
return result;
}
When I use a Child Entity to make the query the error occurs
variable 'p' of type 'Escola.Entities.Aluno' referenced from scope '', but it is not defined
This query is giving an error
This query works
When I use a Child Entity to make the query the error occurs
I am using the latest version of Dommel