我将一个WebAPI从FullDotnet(4.6)迁移到.Net Core 2.0,我在使用Dapper的数据层中遇到了这个问题.
我的代码:
public List<Doctor> GetList()
{
List<Doctor> ret;
using (var db = GetMySqlConnection())
{
const string sql = @"SELECT D.Id, D.Bio, D.CRMState, D.CRMNumber,
U.Id, U.Email, U.CreatedOn, U.LastLogon, U.Login, U.Name, U.Phone, U.Surname, U.Id, U.Birth, U.CPF,
S.Id, S.Name
from Doctor D
inner join User U on U.Id = D.UserId
inner join Speciality S on S.Id = D.IDEspeciality
order by D.Id DESC";
ret = db.Query<Doctor, User, Speciality, Doctor>(sql, (doctor, user, speciality) =>
{
doctor.User = user;
doctor.Speciality = speciality;
return doctor; …Run Code Online (Sandbox Code Playgroud)