嗨,我需要获取与 3 个表相关的记录:
路线 -> 一对一 -> StartCity & EndCity
路线 -> 一对多 -> StopoverCity -> 一对一 -> 城市
** 对不起,我的英语不好
public static Route GetById(int id)
{
var result = new Route();
try
{
using (IDatabase db = DBContext.GetInstance())
{
result = db.Query<Route>().Include(x => x.StartCity).Include(x => x.EndCity)
.IncludeMany(x => x.StopoverCity).Where(x => x.Id == id).SingleOrDefault();
// i need to add other include with the StopoverCity
}
}
catch (Exception ex)
{
throw;
}
return result;
}