dotnet add package FreeSql.Extensions.Linq
var query = _freeSql.Select<Student>().AsQueryable(); query.RestoreToSelect();
(from s in _freeSql.Select<Student>() select s).ToList(); SELECT a.[Id], a.[Name], a.[Age], a.[Status], a.[AddTime], a.[Remark], a.[Version], a.[ClassId] FROM [Student] a (from s in _freeSql.Select<Student>() join c in _freeSql.Select<Class>() on s.ClassId equals c.Id into temp from sc in temp.DefaultIfEmpty() where s.Status == StatusEnum.Normal select new { SName = s.Name, CName = sc.Name }) .Page(2, 10) .ToList(); SELECT a.[Name] as1, sc.[Name] as2 FROM [Student] a LEFT JOIN [Class] sc ON a.[ClassId] = sc.[Id] WHERE (a.[Status] = 1) ORDER BY a.[Id] OFFSET 10 ROW FETCH NEXT 10 ROW ONLYLinq查询,联表使用较好,分组查询还是得使用ISelect,运用ISelect、IQueryable转换可以实现复杂查询