我在 Sql Server 中有 3 个表,一对一的关系。
关键是所有 3 个表中的索引。
3个实体:
public class Client
{
public int Indice { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string Company { get; set; }
public string Tel1 { get; set; }
public string Tel2 { get; set; }
}
public class CallClient
{
public int Indice { get; set; }
public string CallDateTime { get; set; }
public string Status { get; set; }
}
public class ResponsePollClient
{
public int Indice { get; set; }
public string Question1 { get; set; }
public string Question2 { get; set; }
public string Question3 { get; set; }
public string StatusPoll { get; set; }
}
我有这个主要实体
public class DataClient
{
public Client client { get; set; }
public CallClient callClient { get; set; }
public ResponsePollClient pollClient { get; set; }
}
SQL:
选择 c.Indice, .... , cc.Indice, ... , pc.Indice, ...
from Client c
inner join CallClient cc on c.Indice = cc.Indice
inner join PollClient pc on c.Indice = pc .指数
如何使用 Dapper 填充列表实体?