我想使用 DBContext SqlQuery 执行原始 sql,然后包含相关实体。我尝试了以下方法,但它没有加载相关实体:
string sql = "Select * from client where id in (select id from activeclient)";
var list = DbContext.Database.SqlQuery<Client>(sql).AsQueryable().Include(c => c.Address).Include(c => c.Contactinfo).ToList();
有什么帮助吗?