Problems with Inner Join in Dapper

0

I have the following problem when I inner join in 3 in> Dapper does not bring me all the columns of the 3 tables, but only the parent table of my inner join (ie the first table in the query).

My classes

public class ItemQuestion
{
    public int Id { get; set; }    
    public int Questao_Id { get; set; }    
    public int Resposta_Id { get; set; }    
}    

public class Question
{
    public int Id { get; set; }    
    public string Questao { get; set; }    
}  

public class Answer
{
    public int Id { get; set; }    
    public string Resposta { get; set; }

}
using(var conn = new SqlConnection(strConn))
{
    conn.Open();
    Dictionary<string, string> quest = new Dictionary<string, string>();
    return conn
        .Query<ItemQuestion, Question, Answer, ItemQuestion>
            (@"SELECT ITQ.*, Q.*, AWS.* FROM ITEM_QUESTION AS ITQ 
                INNER JOIN QUESTION AS Q ON Q.Id = ITQ.Questao_Id 
                INNER JOIN ANSWER AS AWS ON AWS.Id = ITQ.Resposta_Id",
                (itq, q, a) =>
                {
                    itq.Questao_Id = q.Id;
                    itq.Resposta_Id = a.Id;
                    return itq;

            }).ToList();                         
}
    
asked by anonymous 11.08.2018 / 01:16

0 answers