From 8a11e9c7944a8c958283803243da87f419590c33 Mon Sep 17 00:00:00 2001 From: 28810 <28810@YEXIANGQIN> Date: Wed, 31 Jul 2019 11:24:41 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=A2=9E=E5=8A=A0=20IFreeSql.Select`T1...T?= =?UTF-8?q?10=20=E7=9A=84=E5=A4=9A=E8=A1=A8=E6=9F=A5=E8=AF=A2=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E6=96=B9=E6=B3=95=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FreeSql.Tests/FreeSql.Tests/UnitTest1.cs | 2 +- FreeSql/Extensions/FreeSqlGlobalExtensions.cs | 62 ++++++++++++++++++- FreeSql/FreeSql.xml | 54 ++++++++++++++++ 3 files changed, 114 insertions(+), 4 deletions(-) diff --git a/FreeSql.Tests/FreeSql.Tests/UnitTest1.cs b/FreeSql.Tests/FreeSql.Tests/UnitTest1.cs index 2d38490e..351dda5e 100644 --- a/FreeSql.Tests/FreeSql.Tests/UnitTest1.cs +++ b/FreeSql.Tests/FreeSql.Tests/UnitTest1.cs @@ -342,7 +342,7 @@ namespace FreeSql.Tests public void Test1() { var kfkfjdfg = g.oracle.Select().Where(a => (DateTime.Now - a.EditTime).TotalMinutes > 100).ToSql(); - + g.oracle.Aop.SyncStructureAfter += (s, e) => Trace.WriteLine(e.Sql); diff --git a/FreeSql/Extensions/FreeSqlGlobalExtensions.cs b/FreeSql/Extensions/FreeSqlGlobalExtensions.cs index 68855572..02fba7c2 100644 --- a/FreeSql/Extensions/FreeSqlGlobalExtensions.cs +++ b/FreeSql/Extensions/FreeSqlGlobalExtensions.cs @@ -10,9 +10,6 @@ using System.Reflection; public static partial class FreeSqlGlobalExtensions { - - public static FreeSql.ISelect Queryable(this IFreeSql freesql) where T : class => freesql.Select(); - static Lazy> dicIsNumberType = new Lazy>(() => new Dictionary { [typeof(sbyte)] = true, @@ -109,4 +106,63 @@ public static partial class FreeSqlGlobalExtensions { return orm?.Select(); } + + public static FreeSql.ISelect Queryable(this IFreeSql freesql) where T : class => freesql.Select(); + + #region 多表查询 + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IFreeSql freesql) where T1 : class where T2 : class => + freesql.Select().From((s, b) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IFreeSql freesql) where T1 : class where T2 : class where T3 : class => + freesql.Select().From((s, b, c) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IFreeSql freesql) where T1 : class where T2 : class where T3 : class where T4 : class => + freesql.Select().From((s, b, c, d) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IFreeSql freesql) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class => + freesql.Select().From((s, b, c, d, e) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IFreeSql freesql) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class => + freesql.Select().From((s, b, c, d, e, f) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IFreeSql freesql) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class => + freesql.Select().From((s, b, c, d, e, f, g) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IFreeSql freesql) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class => + freesql.Select().From((s, b, c, d, e, f, g, h) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IFreeSql freesql) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class => + freesql.Select().From((s, b, c, d, e, f, g, h, i) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IFreeSql freesql) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class => + freesql.Select().From((s, b, c, d, e, f, g, h, i, j) => s); + #endregion } \ No newline at end of file diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml index 5c6d9d2b..6818bf46 100644 --- a/FreeSql/FreeSql.xml +++ b/FreeSql/FreeSql.xml @@ -2388,6 +2388,60 @@ + + + 多表查询 + + + + + + 多表查询 + + + + + + 多表查询 + + + + + + 多表查询 + + + + + + 多表查询 + + + + + + 多表查询 + + + + + + 多表查询 + + + + + + 多表查询 + + + + + + 多表查询 + + + 使用 and 拼接两个 lambda 表达式