diff --git a/FreeSql.Tests/FreeSql.Tests/AdoNetExtensions/MySqlConnectionExtensionsTest.cs b/FreeSql.Tests/FreeSql.Tests/AdoNetExtensions/MySqlConnectionExtensionsTest.cs index c16eb020..7f4a3296 100644 --- a/FreeSql.Tests/FreeSql.Tests/AdoNetExtensions/MySqlConnectionExtensionsTest.cs +++ b/FreeSql.Tests/FreeSql.Tests/AdoNetExtensions/MySqlConnectionExtensionsTest.cs @@ -1,6 +1,7 @@ using MySql.Data.MySqlClient; using System; using System.Collections.Generic; +using System.Diagnostics; using Xunit; namespace FreeSql.Tests.AdoNetExtensions.MySqlConnectionExtensions { @@ -10,6 +11,12 @@ namespace FreeSql.Tests.AdoNetExtensions.MySqlConnectionExtensions { public Methods() { g.mysql.CodeFirst.SyncStructure(); + using (var conn = new MySqlConnection(_connectString)) + { + var fsql = conn.GetIFreeSql(); + fsql.CodeFirst.IsNoneCommandParameter = true; + fsql.Aop.CommandBefore += (_, e) => Trace.WriteLine("SQL: " + e.Command.CommandText); + } } [Fact] diff --git a/FreeSql/Extensions/FreeSqlGlobalExtensions.cs b/FreeSql/Extensions/FreeSqlGlobalExtensions.cs index e72c637b..8870e1c3 100644 --- a/FreeSql/Extensions/FreeSqlGlobalExtensions.cs +++ b/FreeSql/Extensions/FreeSqlGlobalExtensions.cs @@ -674,6 +674,61 @@ SELECT "); /// 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 /// public static IDelete Delete(this IDbConnection that, object dywhere) where T1 : class => GetCrud(that).Delete(dywhere).WithConnection(that as DbConnection); + + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbConnection that) where T1 : class where T2 : class => + GetCrud(that).Select().From((s, b) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbConnection that) where T1 : class where T2 : class where T3 : class => + GetCrud(that).Select().From((s, b, c) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class => + GetCrud(that).Select().From((s, b, c, d) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class => + GetCrud(that).Select().From((s, b, c, d, e) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class => + GetCrud(that).Select().From((s, b, c, d, e, f) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class => + GetCrud(that).Select().From((s, b, c, d, e, f, g) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class => + GetCrud(that).Select().From((s, b, c, d, e, f, g, h) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbConnection that) 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 => + GetCrud(that).Select().From((s, b, c, d, e, f, g, h, i) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbConnection that) 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 => + GetCrud(that).Select().From((s, b, c, d, e, f, g, h, i, j) => s); #endregion #region IDbTransaction @@ -770,6 +825,61 @@ SELECT "); /// 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 /// public static IDelete Delete(this IDbTransaction that, object dywhere) where T1 : class => GetCrud(that).Delete(dywhere).WithTransaction(that as DbTransaction); + + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbTransaction that) where T1 : class where T2 : class => + GetCrud(that).Select().From((s, b) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbTransaction that) where T1 : class where T2 : class where T3 : class => + GetCrud(that).Select().From((s, b, c) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class => + GetCrud(that).Select().From((s, b, c, d) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class => + GetCrud(that).Select().From((s, b, c, d, e) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class => + GetCrud(that).Select().From((s, b, c, d, e, f) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class => + GetCrud(that).Select().From((s, b, c, d, e, f, g) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class => + GetCrud(that).Select().From((s, b, c, d, e, f, g, h) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbTransaction that) 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 => + GetCrud(that).Select().From((s, b, c, d, e, f, g, h, i) => s); + /// + /// 多表查询 + /// + /// + public static ISelect Select(this IDbTransaction that) 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 => + GetCrud(that).Select().From((s, b, c, d, e, f, g, h, i, j) => s); #endregion #endregion