• 简介
  • 插入数据
  • 更新数据
    基本更新 复杂更新
  • 删除数据
  • 查询数据
    基本查询 联表查询 分页查询 子查询 联合查询 聚合查询
  • 常用函数

联表查询


new DBHelper<DTStudentModel>()
.Select(p => new
{
    p.IdentityID,
    p.StuCode,
    p.StuName,
    p.StuAge,
    p.StuSex
})
.Select<DTScoreModel>(p => p.Score)
.Join<DTStudentModel, DTScoreModel>(DBJoinType.Left, (k, v) => k.StuCode == v.StuCode)
.OrderBy(p => p.IdentityID)
.ToEntityList<DTStudentModel>();
-- 对应 SQL
select [T_Student].[IdentityID],[T_Student].[StuCode],[T_Student].[StuName],[T_Student].[StuAge],[T_Student].[StuSex],[T_Score].[Score] from [T_Student] left join [T_Score] on ([T_Student].[StuCode] = [T_Score].[StuCode]) order by [T_Student].[IdentityID] asc