mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 增加 ISelect.InsertInto 将查询转换为 INSERT INTO t1 SELECT ... FROM t2 执行插入;#469
This commit is contained in:
parent
fc47407fba
commit
acf26ecbef
@ -130,6 +130,13 @@
|
||||
清空状态数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
|
||||
<summary>
|
||||
根据 lambda 条件删除数据
|
||||
</summary>
|
||||
<param name="predicate"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||
<summary>
|
||||
添加
|
||||
@ -525,5 +532,14 @@
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
||||
<summary>
|
||||
批量注入 Repository,可以参考代码自行调整
|
||||
</summary>
|
||||
<param name="services"></param>
|
||||
<param name="globalDataFilter"></param>
|
||||
<param name="assemblies"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
@ -105,6 +105,11 @@ namespace FreeSql.Tests.MySqlConnector
|
||||
|
||||
Assert.Equal(1, g.mysql.Insert<TestEnumInsertTb>().AppendData(new TestEnumInsertTb { type = TestEnumInserTbType.sum211 }).ExecuteAffrows());
|
||||
Assert.Equal(1, g.mysql.Insert<TestEnumInsertTb>().AppendData(new TestEnumInsertTb { type = TestEnumInserTbType.sum211 }).NoneParameter().ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.mysql.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -177,6 +177,11 @@ INTO ""TB_TOPIC_INSERT""(""CLICKS"") VALUES(900)
|
||||
|
||||
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
|
||||
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.dameng.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -215,6 +215,11 @@ UNION ALL
|
||||
|
||||
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
|
||||
Assert.Equal(10, insert.NoneParameter().AppendData(items).ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.firebird.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -89,6 +89,11 @@ namespace FreeSql.Tests.KingbaseES
|
||||
|
||||
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
|
||||
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.kingbaseES.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -92,6 +92,11 @@ namespace FreeSql.Tests.MsAccess
|
||||
|
||||
//items = Enumerable.Range(0, 9989).Select(a => new Topic { Title = "newtitle" + a, CreateTime = DateTime.Now }).ToList();
|
||||
//Assert.Equal(9989, g.msaccess.Insert<Topic>(items).ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.msaccess.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -106,6 +106,11 @@ namespace FreeSql.Tests.MySql
|
||||
|
||||
Assert.Equal(1, g.mysql.Insert<TestEnumInsertTb>().AppendData(new TestEnumInsertTb { type = TestEnumInserTbType.sum211 }).ExecuteAffrows());
|
||||
Assert.Equal(1, g.mysql.Insert<TestEnumInsertTb>().AppendData(new TestEnumInsertTb { type = TestEnumInserTbType.sum211 }).NoneParameter().ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.mysql.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -177,6 +177,11 @@ INTO ""TB_TOPIC_INSERT""(""CLICKS"") VALUES(:Clicks_9)
|
||||
|
||||
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
|
||||
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.oracle.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -89,6 +89,11 @@ namespace FreeSql.Tests.PostgreSQL
|
||||
|
||||
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
|
||||
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.pgsql.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -89,6 +89,11 @@ namespace FreeSql.Tests.ShenTong
|
||||
|
||||
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
|
||||
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.shentong.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -100,6 +100,11 @@ namespace FreeSql.Tests.SqlServer
|
||||
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
|
||||
Assert.Equal(10, insert.AppendData(items).NoneParameter().ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.sqlserver.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
|
||||
//items = Enumerable.Range(0, 9989).Select(a => new Topic { Title = "newtitle" + a, CreateTime = DateTime.Now }).ToList();
|
||||
//Assert.Equal(9989, g.sqlserver.Insert<Topic>(items).ExecuteAffrows());
|
||||
|
||||
|
@ -89,6 +89,11 @@ namespace FreeSql.Tests.Sqlite
|
||||
|
||||
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
|
||||
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
|
||||
|
||||
Assert.Equal(10, g.sqlite.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
|
||||
{
|
||||
Title = a.Title
|
||||
}));
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteIdentity()
|
||||
|
@ -2046,6 +2046,15 @@
|
||||
<param name="exp">lambda表达式</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.ISelect`1.InsertInto``1(System.String,System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
||||
<summary>
|
||||
将查询转换为 INSERT INTO tableName SELECT ... FROM t 执行插入
|
||||
</summary>
|
||||
<typeparam name="TTargetEntity"></typeparam>
|
||||
<param name="tableName">指定插入的表名,若为 null 则使用 TTargetEntity 实体表名</param>
|
||||
<param name="select">选择列</param>
|
||||
<returns>返回影响的行数</returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.ISelect`1.ToDataTable``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
||||
<summary>
|
||||
执行SQL查询,返回 DataTable
|
||||
@ -2997,154 +3006,6 @@
|
||||
<param name="parms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteConnectTestAsync(System.Int32)">
|
||||
<summary>
|
||||
测试数据库是否连接正确,本方法执行如下命令:<para></para>
|
||||
MySql/SqlServer/PostgreSQL/达梦/人大金仓/神通: SELECT 1<para></para>
|
||||
Oracle: SELECT 1 FROM dual<para></para>
|
||||
</summary>
|
||||
<param name="commandTimeout">命令超时设置(秒)</param>
|
||||
<returns>true: 成功, false: 失败</returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteReaderAsync(System.Func{FreeSql.Internal.Model.FetchCallbackArgs{System.Data.Common.DbDataReader},System.Threading.Tasks.Task},System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
|
||||
<summary>
|
||||
查询,若使用读写分离,查询【从库】条件cmdText.StartsWith("SELECT "),否则查询【主库】
|
||||
</summary>
|
||||
<param name="readerHander"></param>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteReaderAsync(System.Func{FreeSql.Internal.Model.FetchCallbackArgs{System.Data.Common.DbDataReader},System.Threading.Tasks.Task},System.String,System.Object)">
|
||||
<summary>
|
||||
查询,ExecuteReaderAsync(dr => {}, "select * from user where age > ?age", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteArrayAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
|
||||
<summary>
|
||||
查询
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteArrayAsync(System.String,System.Object)">
|
||||
<summary>
|
||||
查询,ExecuteArrayAsync("select * from user where age > ?age", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteDataSetAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
|
||||
<summary>
|
||||
查询
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteDataSetAsync(System.String,System.Object)">
|
||||
<summary>
|
||||
查询,ExecuteDataSetAsync("select * from user where age > ?age; select 2", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteDataTableAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
|
||||
<summary>
|
||||
查询
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteDataTableAsync(System.String,System.Object)">
|
||||
<summary>
|
||||
查询,ExecuteDataTableAsync("select * from user where age > ?age", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteNonQueryAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
|
||||
<summary>
|
||||
在【主库】执行
|
||||
</summary>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteNonQueryAsync(System.String,System.Object)">
|
||||
<summary>
|
||||
在【主库】执行,ExecuteNonQueryAsync("delete from user where age > ?age", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteScalarAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
|
||||
<summary>
|
||||
在【主库】执行
|
||||
</summary>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteScalarAsync(System.String,System.Object)">
|
||||
<summary>
|
||||
在【主库】执行,ExecuteScalarAsync("select 1 from user where age > ?age", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.QueryAsync``1(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
|
||||
<summary>
|
||||
执行SQL返回对象集合,QueryAsync<User>("select * from user where age > ?age", new SqlParameter { ParameterName = "age", Value = 25 })
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.QueryAsync``1(System.String,System.Object)">
|
||||
<summary>
|
||||
执行SQL返回对象集合,QueryAsync<User>("select * from user where age > ?age", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.QueryAsync``2(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
|
||||
<summary>
|
||||
执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 })
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.QueryAsync``2(System.String,System.Object)">
|
||||
<summary>
|
||||
执行SQL返回对象集合,Query<User, Address>("select * from user where age > ?age; select * from address", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="E:FreeSql.IAop.ParseExpression">
|
||||
<summary>
|
||||
可自定义解析表达式
|
||||
@ -3951,12 +3812,6 @@
|
||||
<param name="timeout">超时</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.Internal.ObjectPool.IObjectPool`1.GetAsync">
|
||||
<summary>
|
||||
获取资源
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.Internal.ObjectPool.IObjectPool`1.Return(FreeSql.Internal.ObjectPool.Object{`0},System.Boolean)">
|
||||
<summary>
|
||||
使用完毕后,归还资源
|
||||
@ -4027,12 +3882,6 @@
|
||||
</summary>
|
||||
<param name="obj">资源对象</param>
|
||||
</member>
|
||||
<member name="M:FreeSql.Internal.ObjectPool.IPolicy`1.OnGetAsync(FreeSql.Internal.ObjectPool.Object{`0})">
|
||||
<summary>
|
||||
从对象池获取对象成功的时候触发,通过该方法统计或初始化对象
|
||||
</summary>
|
||||
<param name="obj">资源对象</param>
|
||||
</member>
|
||||
<member name="M:FreeSql.Internal.ObjectPool.IPolicy`1.OnReturn(FreeSql.Internal.ObjectPool.Object{`0})">
|
||||
<summary>
|
||||
归还对象给对象池的时候触发
|
||||
@ -4643,3 +4492,190 @@
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
essions.Expression{System.Func{``0,``1,``2,``3,``4,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1,``2,``3,``4,System.Boolean}})">
|
||||
<summary>
|
||||
使用 and 拼接两个 lambda 表达式
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:System.Linq.Expressions.LambadaExpressionExtensions.And``5(System.Linq.Expressions.Expression{System.Func{``0,``1,``2,``3,``4,System.Boolean}},System.Boolean,System.Linq.Expressions.Expression{System.Func{``0,``1,``2,``3,``4,System.Boolean}})">
|
||||
<summary>
|
||||
使用 and 拼接两个 lambda 表达式
|
||||
</summary>
|
||||
<param name="exp1"></param>
|
||||
<param name="condition">true 时生效</param>
|
||||
<param name="exp2"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:System.Linq.Expressions.LambadaExpressionExtensions.Or``5(System.Linq.Expressions.Expression{System.Func{``0,``1,``2,``3,``4,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1,``2,``3,``4,System.Boolean}})">
|
||||
<summary>
|
||||
使用 or 拼接两个 lambda 表达式
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:System.Linq.Expressions.LambadaExpressionExtensions.Or``5(System.Linq.Expressions.Expression{System.Func{``0,``1,``2,``3,``4,System.Boolean}},System.Boolean,System.Linq.Expressions.Expression{System.Func{``0,``1,``2,``3,``4,System.Boolean}})">
|
||||
<summary>
|
||||
使用 or 拼接两个 lambda 表达式
|
||||
</summary>
|
||||
<param name="exp1"></param>
|
||||
<param name="condition">true 时生效</param>
|
||||
<param name="exp2"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:System.Linq.Expressions.LambadaExpressionExtensions.Not``5(System.Linq.Expressions.Expression{System.Func{``0,``1,``2,``3,``4,System.Boolean}},System.Boolean)">
|
||||
<summary>
|
||||
将 lambda 表达式取反
|
||||
</summary>
|
||||
<param name="exp"></param>
|
||||
<param name="condition">true 时生效</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeUtil.NewMongodbId">
|
||||
<summary>
|
||||
生成类似Mongodb的ObjectId有序、不重复Guid
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Insert``1">
|
||||
<summary>
|
||||
插入数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Insert``1(``0)">
|
||||
<summary>
|
||||
插入数据,传入实体
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Insert``1(``0[])">
|
||||
<summary>
|
||||
插入数据,传入实体数组
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Insert``1(System.Collections.Generic.List{``0})">
|
||||
<summary>
|
||||
插入数据,传入实体集合
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Insert``1(System.Collections.Generic.IEnumerable{``0})">
|
||||
<summary>
|
||||
插入数据,传入实体集合
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.InsertOrUpdate``1">
|
||||
<summary>
|
||||
插入或更新数据,此功能依赖数据库特性(低版本可能不支持),参考如下:<para></para>
|
||||
MySql 5.6+: on duplicate key update<para></para>
|
||||
PostgreSQL 9.4+: on conflict do update<para></para>
|
||||
SqlServer 2008+: merge into<para></para>
|
||||
Oracle 11+: merge into<para></para>
|
||||
Sqlite: replace into<para></para>
|
||||
达梦: merge into<para></para>
|
||||
人大金仓:on conflict do update<para></para>
|
||||
神通:merge into<para></para>
|
||||
MsAccess:不支持<para></para>
|
||||
注意区别:FreeSql.Repository 仓储也有 InsertOrUpdate 方法(不依赖数据库特性)
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Update``1">
|
||||
<summary>
|
||||
修改数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Update``1(System.Object)">
|
||||
<summary>
|
||||
修改数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Select``1">
|
||||
<summary>
|
||||
查询数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Select``1(System.Object)">
|
||||
<summary>
|
||||
查询数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Delete``1">
|
||||
<summary>
|
||||
删除数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Delete``1(System.Object)">
|
||||
<summary>
|
||||
删除数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Transaction(System.Action)">
|
||||
<summary>
|
||||
开启事务(不支持异步)<para></para>
|
||||
v1.5.0 关闭了线程事务超时自动提交的机制
|
||||
</summary>
|
||||
<param name="handler">事务体 () => {}</param>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Transaction(System.Data.IsolationLevel,System.Action)">
|
||||
<summary>
|
||||
开启事务(不支持异步)<para></para>
|
||||
v1.5.0 关闭了线程事务超时自动提交的机制
|
||||
</summary>
|
||||
<param name="isolationLevel"></param>
|
||||
<param name="handler">事务体 () => {}</param>
|
||||
</member>
|
||||
<member name="P:IFreeSql.Ado">
|
||||
<summary>
|
||||
数据库访问对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IFreeSql.Aop">
|
||||
<summary>
|
||||
所有拦截方法都在这里
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IFreeSql.CodeFirst">
|
||||
<summary>
|
||||
CodeFirst 模式开发相关方法
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IFreeSql.DbFirst">
|
||||
<summary>
|
||||
DbFirst 模式开发相关方法
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IFreeSql.GlobalFilter">
|
||||
<summary>
|
||||
全局过滤设置,可默认附加为 Select/Update/Delete 条件
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
@ -15,6 +15,7 @@ namespace FreeSql
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, bool>> exp);
|
||||
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -38,6 +39,15 @@ namespace FreeSql
|
||||
/// <returns></returns>
|
||||
bool Any(Expression<Func<T1, bool>> exp);
|
||||
|
||||
/// <summary>
|
||||
/// 将查询转换为 INSERT INTO tableName SELECT ... FROM t 执行插入
|
||||
/// </summary>
|
||||
/// <typeparam name="TTargetEntity"></typeparam>
|
||||
/// <param name="tableName">指定插入的表名,若为 null 则使用 TTargetEntity 实体表名</param>
|
||||
/// <param name="select">选择列</param>
|
||||
/// <returns>返回影响的行数</returns>
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, TTargetEntity>> select) where TTargetEntity : class;
|
||||
|
||||
/// <summary>
|
||||
/// 执行SQL查询,返回 DataTable
|
||||
/// </summary>
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -13,6 +13,7 @@ namespace FreeSql
|
||||
#if net40
|
||||
#else
|
||||
Task<bool> AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp);
|
||||
Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TTargetEntity>> select) where TTargetEntity : class;
|
||||
Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>> select);
|
||||
Task<List<TReturn>> ToListAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>> select);
|
||||
Task<List<TDto>> ToListAsync<TDto>();
|
||||
@ -29,6 +30,7 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
bool Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp);
|
||||
int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TTargetEntity>> select) where TTargetEntity : class;
|
||||
DataTable ToDataTable<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>> select);
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>> select);
|
||||
List<TDto> ToList<TDto>();
|
||||
|
@ -683,6 +683,61 @@ namespace FreeSql.Internal.CommonProvider
|
||||
var af = this.GetExpressionField(select, fieldAlias);
|
||||
return this.ToSql(af.field);
|
||||
}
|
||||
protected string InternalGetInsertIntoToSql<TTargetEntity>(string tableName, Expression select)
|
||||
{
|
||||
var tb = _orm.CodeFirst.GetTableByEntity(typeof(TTargetEntity));
|
||||
if (tb == null) throw new ArgumentException($"ISelect.InsertInto() 类型错误: {typeof(TTargetEntity).DisplayCsharp()}");
|
||||
if (string.IsNullOrEmpty(tableName)) tableName = tb.DbName;
|
||||
if (_orm.CodeFirst.IsSyncStructureToLower) tableName = tableName.ToLower();
|
||||
if (_orm.CodeFirst.IsSyncStructureToUpper) tableName = tableName.ToUpper();
|
||||
|
||||
var map = new ReadAnonymousTypeInfo();
|
||||
var field = new StringBuilder();
|
||||
var index = -10000; //临时规则,不返回 as1
|
||||
|
||||
_commonExpression.ReadAnonymousField(_tables, field, map, ref index, select, null, null, _whereCascadeExpression, null, false); //不走 DTO 映射,不处理 IncludeMany
|
||||
|
||||
var childs = map.Childs;
|
||||
if (childs.Any() == false) throw new ArgumentException($"ISelect.InsertInto() 未选择属性: {typeof(TTargetEntity).DisplayCsharp()}");
|
||||
foreach(var col in tb.Columns.Values)
|
||||
{
|
||||
if (col.Attribute.IsIdentity && string.IsNullOrEmpty(col.DbInsertValue)) continue;
|
||||
if (col.Attribute.CanInsert == false) continue;
|
||||
if (childs.Any(a => a.CsName == col.CsName)) continue;
|
||||
var dbfield = string.IsNullOrWhiteSpace(col.DbInsertValue) == false ? col.DbInsertValue : col.DbDefaultValue;
|
||||
childs.Add(new ReadAnonymousTypeInfo { DbField = dbfield, CsName = col.CsName });
|
||||
}
|
||||
var selectField = string.Join(", ", childs.Select(a => a.DbField));
|
||||
var selectSql = this.ToSql(selectField);
|
||||
var insertField = string.Join(", ", childs.Select(a => _commonUtils.QuoteSqlName(tb.Columns[a.CsName].Attribute.Name)));
|
||||
var sql = $"INSERT INTO {_commonUtils.QuoteSqlName(tableName)}({insertField})\r\n{selectSql}";
|
||||
return sql;
|
||||
}
|
||||
public int InternalInsertInto<TTargetEntity>(string tableName, Expression select)
|
||||
{
|
||||
var sql = this.InternalGetInsertIntoToSql<TTargetEntity>(tableName, select);
|
||||
var dbParms = _params.ToArray();
|
||||
var tb = _orm.CodeFirst.GetTableByEntity(typeof(TTargetEntity));
|
||||
var before = new Aop.CurdBeforeEventArgs(tb.Type, tb, Aop.CurdType.Insert, sql, dbParms);
|
||||
_orm.Aop.CurdBeforeHandler?.Invoke(this, before);
|
||||
int ret = 0;
|
||||
Exception exception = null;
|
||||
try
|
||||
{
|
||||
ret = _orm.Ado.ExecuteNonQuery(_connection, _transaction, CommandType.Text, sql, _commandTimeout, dbParms);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
var after = new Aop.CurdAfterEventArgs(before, exception, ret);
|
||||
_orm.Aop.CurdAfterHandler?.Invoke(this, after);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected DataTable InternalToDataTable(Expression select)
|
||||
{
|
||||
@ -949,6 +1004,32 @@ namespace FreeSql.Internal.CommonProvider
|
||||
|
||||
protected Task<List<TReturn>> InternalToListAsync<TReturn>(Expression select) => this.ToListMapReaderAsync<TReturn>(this.GetExpressionField(select));
|
||||
|
||||
async public Task<int> InternalInsertIntoAsync<TTargetEntity>(string tableName, Expression select)
|
||||
{
|
||||
var sql = this.InternalGetInsertIntoToSql<TTargetEntity>(tableName, select);
|
||||
var dbParms = _params.ToArray();
|
||||
var tb = _orm.CodeFirst.GetTableByEntity(typeof(TTargetEntity));
|
||||
var before = new Aop.CurdBeforeEventArgs(tb.Type, tb, Aop.CurdType.Insert, sql, dbParms);
|
||||
_orm.Aop.CurdBeforeHandler?.Invoke(this, before);
|
||||
int ret = 0;
|
||||
Exception exception = null;
|
||||
try
|
||||
{
|
||||
ret = await _orm.Ado.ExecuteNonQueryAsync(_connection, _transaction, CommandType.Text, sql, _commandTimeout, dbParms);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
var after = new Aop.CurdAfterEventArgs(before, exception, ret);
|
||||
_orm.Aop.CurdAfterHandler?.Invoke(this, after);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
async protected Task<DataTable> InternalToDataTableAsync(Expression select)
|
||||
{
|
||||
var sql = this.InternalToSql<int>(select, FieldAliasOptions.AsProperty); //DataTable 使用 AsProperty
|
||||
|
@ -160,6 +160,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -268,6 +275,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -164,6 +164,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -272,6 +279,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -168,6 +168,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -276,6 +283,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -172,6 +172,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -280,6 +287,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -176,6 +176,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -284,6 +291,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -180,6 +180,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -288,6 +295,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -184,6 +184,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -292,6 +299,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -392,6 +392,8 @@ namespace FreeSql.Internal.CommonProvider
|
||||
|
||||
public override List<T1> ToList(bool includeNestedMembers = false) => base.ToList(_isIncluded || includeNestedMembers);
|
||||
|
||||
public int InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, TTargetEntity>> select) where TTargetEntity : class => base.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
|
||||
bool _isIncluded = false;
|
||||
public ISelect<T1> Include<TNavigate>(Expression<Func<T1, TNavigate>> navigateSelector) where TNavigate : class
|
||||
{
|
||||
@ -1253,6 +1255,8 @@ namespace FreeSql.Internal.CommonProvider
|
||||
}
|
||||
public Task<List<TDto>> ToListAsync<TDto>() => ToListAsync(GetToListDtoSelector<TDto>());
|
||||
|
||||
public Task<int> InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, TTargetEntity>> select) where TTargetEntity : class => base.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
|
||||
public Task<DataTable> ToDataTableAsync<TReturn>(Expression<Func<T1, TReturn>> select)
|
||||
{
|
||||
if (select == null) return this.InternalToDataTableAsync(select?.Body);
|
||||
|
@ -106,6 +106,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalToList<TReturn>(select?.Body);
|
||||
}
|
||||
|
||||
List<TDto> ISelect<T1, T2>.ToList<TDto>() => (this as ISelect<T1, T2>).ToList(GetToListDtoSelector<TDto>());
|
||||
Expression<Func<T1, T2, TDto>> GetToListDtoSelector<TDto>()
|
||||
{
|
||||
@ -114,6 +115,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
_tables[0].Parameter ?? Expression.Parameter(typeof(T1), "a"),
|
||||
Expression.Parameter(typeof(T2), "b"));
|
||||
}
|
||||
|
||||
public void ToChunk<TReturn>(Expression<Func<T1, T2, TReturn>> select, int size, Action<FetchCallbackArgs<List<TReturn>>> done)
|
||||
{
|
||||
if (select == null || done == null) return;
|
||||
@ -128,6 +130,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2>.ToSql<TReturn>(Expression<Func<T1, T2, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -236,6 +245,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2>.AnyAsync(Expression<Func<T1, T2, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -132,6 +132,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3>.ToSql<TReturn>(Expression<Func<T1, T2, T3, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -240,6 +247,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3>.AnyAsync(Expression<Func<T1, T2, T3, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -136,6 +136,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -244,6 +251,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4>.AnyAsync(Expression<Func<T1, T2, T3, T4, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -140,6 +140,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -248,6 +255,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -144,6 +144,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -252,6 +259,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -148,6 +148,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -256,6 +263,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -152,6 +152,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7, T8>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7, T8>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -260,6 +267,13 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7, T8>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
|
@ -38,15 +38,15 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
this.AsTable((type, old) =>
|
||||
{
|
||||
if (type == _tables[0].Table?.Type && string.IsNullOrEmpty(sqlT1) == false) return $"( {sqlT1} )";
|
||||
if (type == _tables[1].Table?.Type && string.IsNullOrEmpty(sqlT2) == false) return $"( {sqlT2} )";
|
||||
if (type == _tables[2].Table?.Type && string.IsNullOrEmpty(sqlT3) == false) return $"( {sqlT3} )";
|
||||
if (type == _tables[3].Table?.Type && string.IsNullOrEmpty(sqlT4) == false) return $"( {sqlT4} )";
|
||||
if (type == _tables[4].Table?.Type && string.IsNullOrEmpty(sqlT5) == false) return $"( {sqlT5} )";
|
||||
if (type == _tables[5].Table?.Type && string.IsNullOrEmpty(sqlT6) == false) return $"( {sqlT6} )";
|
||||
if (type == _tables[6].Table?.Type && string.IsNullOrEmpty(sqlT7) == false) return $"( {sqlT7} )";
|
||||
if (type == _tables[7].Table?.Type && string.IsNullOrEmpty(sqlT8) == false) return $"( {sqlT8} )";
|
||||
if (type == _tables[8].Table?.Type && string.IsNullOrEmpty(sqlT9) == false) return $"( {sqlT9} )";
|
||||
if (type == _tables[0].Table?.Type) return $"( {sqlT1} )";
|
||||
if (type == _tables[1].Table?.Type) return $"( {sqlT2} )";
|
||||
if (type == _tables[2].Table?.Type) return $"( {sqlT3} )";
|
||||
if (type == _tables[3].Table?.Type) return $"( {sqlT4} )";
|
||||
if (type == _tables[4].Table?.Type) return $"( {sqlT5} )";
|
||||
if (type == _tables[5].Table?.Type) return $"( {sqlT6} )";
|
||||
if (type == _tables[6].Table?.Type) return $"( {sqlT7} )";
|
||||
if (type == _tables[7].Table?.Type) return $"( {sqlT8} )";
|
||||
if (type == _tables[8].Table?.Type) return $"( {sqlT9} )";
|
||||
return old;
|
||||
});
|
||||
if (parms != null) _params.AddRange(_commonUtils.GetDbParamtersByObject($"{sqlT1};\r\n{sqlT2};\r\n{sqlT3};\r\n{sqlT4};\r\n{sqlT5};\r\n{sqlT6};\r\n{sqlT7};\r\n{sqlT8};\r\n{sqlT9}", parms));
|
||||
@ -55,7 +55,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
|
||||
double ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.Avg<TMember>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TMember>> column)
|
||||
{
|
||||
if (column == null) return default(double);
|
||||
if (column == null) return 0;
|
||||
for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a];
|
||||
return this.InternalAvg(column?.Body);
|
||||
}
|
||||
@ -155,6 +155,14 @@ namespace FreeSql.Internal.CommonProvider
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalToDataTable(select?.Body);
|
||||
}
|
||||
|
||||
int ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
string ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.ToSql<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>> select, FieldAliasOptions fieldAlias)
|
||||
{
|
||||
if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias);
|
||||
@ -168,12 +176,14 @@ namespace FreeSql.Internal.CommonProvider
|
||||
for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
|
||||
return this.InternalJoin(exp?.Body, SelectTableInfoType.LeftJoin);
|
||||
}
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.InnerJoin(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp)
|
||||
{
|
||||
if (exp == null) return this.InternalJoin(exp?.Body, SelectTableInfoType.LeftJoin);
|
||||
for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
|
||||
return this.InternalJoin(exp?.Body, SelectTableInfoType.InnerJoin);
|
||||
}
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.RightJoin(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp)
|
||||
{
|
||||
if (exp == null) return this.InternalJoin(exp?.Body, SelectTableInfoType.LeftJoin);
|
||||
@ -187,11 +197,12 @@ namespace FreeSql.Internal.CommonProvider
|
||||
for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
|
||||
return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null, _whereCascadeExpression, _params));
|
||||
}
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp)
|
||||
{
|
||||
if (condition == false || exp == null) return this;
|
||||
if (condition == false || exp == null) return this.Where(null);
|
||||
for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
|
||||
return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null, _whereCascadeExpression, _params));
|
||||
return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null, _whereCascadeExpression, _params)) : this;
|
||||
}
|
||||
|
||||
bool ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp)
|
||||
@ -210,25 +221,6 @@ namespace FreeSql.Internal.CommonProvider
|
||||
|
||||
#if net40
|
||||
#else
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
|
||||
var oldwhere = _where.ToString();
|
||||
var ret = await this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null, _whereCascadeExpression, _params)).AnyAsync();
|
||||
_where.Clear().Append(oldwhere);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Task<DataTable> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>> select)
|
||||
{
|
||||
if (select == null) return this.InternalToDataTableAsync(select?.Body);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<List<TDto>> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.ToListAsync<TDto>() => (this as ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>).ToListAsync(GetToListDtoSelector<TDto>());
|
||||
|
||||
Task<double> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.AvgAsync<TMember>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TMember>> column)
|
||||
{
|
||||
if (column == null) return Task.FromResult(default(double));
|
||||
@ -270,6 +262,31 @@ namespace FreeSql.Internal.CommonProvider
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalToListAsync<TReturn>(select?.Body);
|
||||
}
|
||||
Task<List<TDto>> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.ToListAsync<TDto>() => (this as ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>).ToListAsync(GetToListDtoSelector<TDto>());
|
||||
|
||||
Task<DataTable> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.ToDataTableAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>> select)
|
||||
{
|
||||
if (select == null) return this.InternalToDataTableAsync(select?.Body);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalToDataTableAsync(select?.Body);
|
||||
}
|
||||
|
||||
Task<int> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TTargetEntity>> select)
|
||||
{
|
||||
if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select);
|
||||
for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a];
|
||||
return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body);
|
||||
}
|
||||
|
||||
async Task<bool> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.AnyAsync(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp)
|
||||
{
|
||||
if (exp == null) return await this.AnyAsync();
|
||||
for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
|
||||
var oldwhere = _where.ToString();
|
||||
var ret = await this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null, _whereCascadeExpression, _params)).AnyAsync();
|
||||
_where.Clear().Append(oldwhere);
|
||||
return ret;
|
||||
}
|
||||
|
||||
async Task<TReturn> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.ToOneAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>> select) => (await (this as ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>).Limit(1).ToListAsync(select)).FirstOrDefault();
|
||||
async Task<TReturn> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.FirstAsync<TReturn>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>> select) => (await (this as ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>).Limit(1).ToListAsync(select)).FirstOrDefault();
|
||||
|
Loading…
x
Reference in New Issue
Block a user