- 补充 同线程时间 fsql.Transaction 事务等级参数的传入;

This commit is contained in:
28810 2019-12-14 01:34:38 +08:00
parent 2b85e2e22d
commit dfb4662d86
20 changed files with 254 additions and 240 deletions

View File

@ -110,13 +110,6 @@
清空状态数据
</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>
添加

View File

@ -1960,10 +1960,18 @@
</summary>
<param name="handler">事务体 () => {}</param>
</member>
<member name="M:FreeSql.IAdo.Transaction(System.Action,System.TimeSpan)">
<member name="M:FreeSql.IAdo.Transaction(System.TimeSpan,System.Action)">
<summary>
开启事务(不支持异步)
</summary>
<param name="timeout">超时,未执行完将自动提交</param>
<param name="handler">事务体 () => {}</param>
</member>
<member name="M:FreeSql.IAdo.Transaction(System.Data.IsolationLevel,System.TimeSpan,System.Action)">
<summary>
开启事务(不支持异步)
</summary>
<param name="isolationLevel"></param>
<param name="handler">事务体 () => {}</param>
<param name="timeout">超时,未执行完将自动提交</param>
</member>
@ -2256,187 +2264,7 @@
</member>
<member name="P:FreeSql.IAop.CurdAfter">
<summary>
增删查改,执行命令完成后触发
</summary>
</member>
<member name="P:FreeSql.IAop.SyncStructureBefore">
<summary>
CodeFirst迁移执行之前触发
</summary>
</member>
<member name="P:FreeSql.IAop.SyncStructureAfter">
<summary>
CodeFirst迁移执行完成触发
</summary>
</member>
<member name="P:FreeSql.IAop.AuditValue">
<summary>
Insert/Update自动值处理
</summary>
</member>
<member name="P:FreeSql.Aop.ParseExpressionEventArgs.FreeParse">
<summary>
内置解析功能,可辅助您进行解析
</summary>
</member>
<member name="P:FreeSql.Aop.ParseExpressionEventArgs.Expression">
<summary>
需要您解析的表达式
</summary>
</member>
<member name="P:FreeSql.Aop.ParseExpressionEventArgs.Result">
<summary>
解析后的内容
</summary>
</member>
<member name="P:FreeSql.Aop.ConfigEntityEventArgs.EntityType">
<summary>
实体类型
</summary>
</member>
<member name="P:FreeSql.Aop.ConfigEntityEventArgs.ModifyResult">
<summary>
实体配置
</summary>
</member>
<member name="P:FreeSql.Aop.ConfigEntityEventArgs.ModifyIndexResult">
<summary>
索引配置
</summary>
</member>
<member name="P:FreeSql.Aop.ConfigEntityPropertyEventArgs.EntityType">
<summary>
实体类型
</summary>
</member>
<member name="P:FreeSql.Aop.ConfigEntityPropertyEventArgs.Property">
<summary>
实体的属性
</summary>
</member>
<member name="P:FreeSql.Aop.ConfigEntityPropertyEventArgs.ModifyResult">
<summary>
实体的属性配置
</summary>
</member>
<member name="P:FreeSql.Aop.CurdBeforeEventArgs.Identifier">
<summary>
标识符,可将 CurdBefore 与 CurdAfter 进行匹配
</summary>
</member>
<member name="P:FreeSql.Aop.CurdBeforeEventArgs.CurdType">
<summary>
操作类型
</summary>
</member>
<member name="P:FreeSql.Aop.CurdBeforeEventArgs.EntityType">
<summary>
实体类型
</summary>
</member>
<member name="P:FreeSql.Aop.CurdBeforeEventArgs.Table">
<summary>
实体类型的元数据
</summary>
</member>
<member name="P:FreeSql.Aop.CurdBeforeEventArgs.Sql">
<summary>
执行的 SQL
</summary>
</member>
<member name="P:FreeSql.Aop.CurdBeforeEventArgs.DbParms">
<summary>
参数化命令
</summary>
</member>
<member name="P:FreeSql.Aop.CurdAfterEventArgs.Exception">
<summary>
发生的错误
</summary>
</member>
<member name="P:FreeSql.Aop.CurdAfterEventArgs.ExecuteResult">
<summary>
执行SQL命令返回的结果
</summary>
</member>
<member name="P:FreeSql.Aop.CurdAfterEventArgs.ElapsedTicks">
<summary>
耗时单位Ticks
</summary>
</member>
<member name="P:FreeSql.Aop.CurdAfterEventArgs.ElapsedMilliseconds">
<summary>
耗时(单位:毫秒)
</summary>
</member>
<member name="P:FreeSql.Aop.SyncStructureBeforeEventArgs.Identifier">
<summary>
标识符,可将 SyncStructureBeforeEventArgs 与 SyncStructureAfterEventArgs 进行匹配
</summary>
</member>
<member name="P:FreeSql.Aop.SyncStructureBeforeEventArgs.EntityTypes">
<summary>
实体类型
</summary>
</member>
<member name="P:FreeSql.Aop.SyncStructureAfterEventArgs.Sql">
<summary>
执行的 SQL
</summary>
</member>
<member name="P:FreeSql.Aop.SyncStructureAfterEventArgs.Exception">
<summary>
发生的错误
</summary>
</member>
<member name="P:FreeSql.Aop.SyncStructureAfterEventArgs.ElapsedTicks">
<summary>
耗时单位Ticks
</summary>
</member>
<member name="P:FreeSql.Aop.SyncStructureAfterEventArgs.ElapsedMilliseconds">
<summary>
耗时(单位:毫秒)
</summary>
</member>
<member name="P:FreeSql.Aop.AuditValueEventArgs.AuditValueType">
<summary>
类型
</summary>
</member>
<member name="P:FreeSql.Aop.AuditValueEventArgs.Column">
<summary>
属性列的元数据
</summary>
</member>
<member name="P:FreeSql.Aop.AuditValueEventArgs.Property">
<summary>
反射的属性信息
</summary>
</member>
<member name="P:FreeSql.Aop.AuditValueEventArgs.Value">
<summary>
获取实体的属性值,也可以设置实体的属性新值
</summary>
</member>
<member name="P:FreeSql.ICodeFirst.IsAutoSyncStructure">
<summary>
【开发环境必备】自动同步实体结构到数据库,程序运行中检查实体表是否存在,然后创建或修改
</summary>
</member>
<member name="P:FreeSql.ICodeFirst.IsSyncStructureToLower">
<summary>
转小写同步结构
</summary>
</member>
<member name="P:FreeSql.ICodeFirst.IsSyncStructureToUpper">
<summary>
转大写同步结构
</summary>
</member>
<member name="P:FreeSql.ICodeFirst.IsConfigEntityFromDbFirst">
<summary>
将数据库的主键、自增、索引设置导入,适用 DbFirst 模式,无须在实体类型上设置 [Column(IsPrimary)] 或者 ConfigEntity。此功能目前可用于 mysql/sqlserver/postgresql/oracle。<para></para>
或者 ConfigEntity。此功能目前可用于 mysql/sqlserver/postgresql/oracle。<para></para>
本功能会影响 IFreeSql 首次访问的速度。<para></para>
若使用 CodeFirst 创建索引后,又直接在数据库上建了索引,若无本功能下一次 CodeFirst 迁移时数据库上创建的索引将被删除
</summary>
@ -2970,10 +2798,163 @@
</summary>
<param name="handler">事务体 () => {}</param>
</member>
<member name="M:IFreeSql.Transaction(System.Action,System.TimeSpan)">
<member name="M:IFreeSql.Transaction(System.TimeSpan,System.Action)">
<summary>
开启事务(不支持异步)
</summary>
<param name="timeout">超时,未执行完将自动提交</param>
<param name="handler">事务体 () => {}</param>
</member>
<member name="M:IFreeSql.Transaction(System.Data.IsolationLevel,System.TimeSpan,System.Action)">
<summary>
开启事务(不支持异步)
<20>
</summary>
<returns></returns>
</member>
<member name="M:System.Linq.Expressions.LambadaExpressionExtensions.And``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Boolean,System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}})">
<summary>
使用 and 拼接两个 lambda 表达式
</summary>
<typeparam name="T"></typeparam>
<param name="exp1"></param>
<param name="condition">true 时生效</param>
<param name="exp2"></param>
<returns></returns>
</member>
<member name="M:System.Linq.Expressions.LambadaExpressionExtensions.Or``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}})">
<summary>
使用 or 拼接两个 lambda 表达式
</summary>
<returns></returns>
</member>
<member name="M:System.Linq.Expressions.LambadaExpressionExtensions.Or``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Boolean,System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}})">
<summary>
使用 or 拼接两个 lambda 表达式
</summary>
<typeparam name="T"></typeparam>
<param name="exp1"></param>
<param name="condition">true 时生效</param>
<param name="exp2"></param>
<returns></returns>
</member>
<member name="M:System.Linq.Expressions.LambadaExpressionExtensions.Not``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Boolean)">
<summary>
将 lambda 表达式取反
</summary>
<typeparam name="T"></typeparam>
<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.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>
开启事务不支持异步60秒未执行完将自动提交
</summary>
<param name="handler">事务体 () => {}</param>
</member>
<member name="M:IFreeSql.Transaction(System.TimeSpan,System.Action)">
<summary>
开启事务(不支持异步)
</summary>
<param name="timeout">超时,未执行完将自动提交</param>
<param name="handler">事务体 () => {}</param>
</member>
<member name="M:IFreeSql.Transaction(System.Data.IsolationLevel,System.TimeSpan,System.Action)">
<summary>
开启事务(不支持异步)
</summary>
<param name="isolationLevel"></param>
<param name="handler">事务体 () => {}</param>
<param name="timeout">超时,未执行完将自动提交</param>
</member>

View File

@ -41,9 +41,16 @@ namespace FreeSql
/// <summary>
/// 开启事务(不支持异步)
/// </summary>
/// <param name="timeout">超时,未执行完将自动提交</param>
/// <param name="handler">事务体 () => {}</param>
void Transaction(TimeSpan timeout, Action handler);
/// <summary>
/// 开启事务(不支持异步)
/// </summary>
/// <param name="isolationLevel"></param>
/// <param name="handler">事务体 () => {}</param>
/// <param name="timeout">超时,未执行完将自动提交</param>
void Transaction(Action handler, TimeSpan timeout);
void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler);
/// <summary>
/// 当前线程的事务
/// </summary>

View File

@ -2,6 +2,7 @@
using FreeSql.Internal;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq.Expressions;
public interface IFreeSql<TMark> : IFreeSql { }
@ -93,9 +94,16 @@ public interface IFreeSql : IDisposable
/// <summary>
/// 开启事务(不支持异步)
/// </summary>
/// <param name="timeout">超时,未执行完将自动提交</param>
/// <param name="handler">事务体 () => {}</param>
void Transaction(TimeSpan timeout, Action handler);
/// <summary>
/// 开启事务(不支持异步)
/// </summary>
/// <param name="isolationLevel"></param>
/// <param name="handler">事务体 () => {}</param>
/// <param name="timeout">超时,未执行完将自动提交</param>
void Transaction(Action handler, TimeSpan timeout);
void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler);
/// <summary>
/// 数据库访问对象

View File

@ -1,7 +1,8 @@
using SafeObjectPool;
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Diagnostics;
using System.Linq;
@ -33,7 +34,7 @@ namespace FreeSql.Internal.CommonProvider
public DbTransaction TransactionCurrentThread => _trans.TryGetValue(Thread.CurrentThread.ManagedThreadId, out var conn) && conn.Transaction?.Connection != null ? conn.Transaction : null;
public void BeginTransaction(TimeSpan timeout)
public void BeginTransaction(TimeSpan timeout, IsolationLevel? isolationLevel)
{
if (TransactionCurrentThread != null) return;
@ -44,7 +45,7 @@ namespace FreeSql.Internal.CommonProvider
try
{
conn = MasterPool.Get();
tran = new Transaction2(conn, conn.Value.BeginTransaction(), timeout);
tran = new Transaction2(conn, isolationLevel == null ? conn.Value.BeginTransaction() : conn.Value.BeginTransaction(isolationLevel.Value), timeout);
}
catch (Exception ex)
{
@ -102,15 +103,15 @@ namespace FreeSql.Internal.CommonProvider
public void CommitTransaction() => CommitTransaction(true);
public void RollbackTransaction() => CommitTransaction(false);
public void Transaction(Action handler)
{
Transaction(handler, TimeSpan.FromSeconds(60));
}
public void Transaction(Action handler, TimeSpan timeout)
public void Transaction(Action handler) => TransactionInternal(null, TimeSpan.FromSeconds(60), handler);
public void Transaction(TimeSpan timeout, Action handler) => TransactionInternal(null, timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => TransactionInternal(isolationLevel, timeout, handler);
void TransactionInternal(IsolationLevel? isolationLevel, TimeSpan timeout, Action handler)
{
try
{
BeginTransaction(timeout);
BeginTransaction(timeout, isolationLevel);
handler();
CommitTransaction();
}

View File

@ -3,6 +3,7 @@ using FreeSql.Internal.CommonProvider;
using FreeSql.MySql.Curd;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq.Expressions;
using System.Threading;
@ -70,7 +71,8 @@ namespace FreeSql.MySql
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -2,6 +2,7 @@
using FreeSql.Internal.CommonProvider;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Threading;
@ -49,7 +50,8 @@ namespace FreeSql.Odbc.Dameng
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -4,6 +4,7 @@ using FreeSql.Odbc.Default;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading;
@ -83,7 +84,8 @@ namespace FreeSql.Odbc.Default
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -2,6 +2,7 @@
using FreeSql.Internal.CommonProvider;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading;
namespace FreeSql.Odbc.GBase
@ -46,7 +47,8 @@ namespace FreeSql.Odbc.GBase
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -25,7 +25,7 @@ namespace FreeSql.Odbc.GBase
{ typeof(byte).FullName, (OdbcType.SmallInt, "byte","byte NOT NULL", false, false, 0) },{ typeof(byte?).FullName, (OdbcType.SmallInt, "byte", "byte", false, true, null) },
{ typeof(ushort).FullName, (OdbcType.Int, "integer","integer NOT NULL", false, false, 0) },{ typeof(ushort?).FullName, (OdbcType.Int, "integer", "integer", false, true, null) },
{ typeof(uint).FullName, (OdbcType.BigInt, "int8","int8 NOT NULL", false, false, 0) },{ typeof(uint?).FullName, (OdbcType.BigInt, "int8", "int8", false, true, null) },
{ typeof(uint).FullName, (OdbcType.BigInt, "bigint","bigint NOT NULL", false, false, 0) },{ typeof(uint?).FullName, (OdbcType.BigInt, "bigint", "bigint", false, true, null) },
{ typeof(ulong).FullName, (OdbcType.Decimal, "decimal","decimal(20,0) NOT NULL", false, false, 0) },{ typeof(ulong?).FullName, (OdbcType.Decimal, "decimal", "decimal(20,0)", false, true, null) },
{ typeof(float).FullName, (OdbcType.Real, "smallfloat","smallfloat NOT NULL", false, false, 0) },{ typeof(float?).FullName, (OdbcType.Real, "smallfloat", "smallfloat", false, true, null) },

View File

@ -27,21 +27,21 @@ namespace FreeSql.Odbc.GBase
switch (exp.Type.NullableTypeOrThis().ToString())
{
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
case "System.Byte": return $"({getExp(operandExp)})::int2";
case "System.Byte": return $"({getExp(operandExp)})::byte";
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
case "System.DateTime": return $"({getExp(operandExp)})::timestamp";
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
case "System.Double": return $"({getExp(operandExp)})::float8";
case "System.Int16": return $"({getExp(operandExp)})::int2";
case "System.Int32": return $"({getExp(operandExp)})::int4";
case "System.Int64": return $"({getExp(operandExp)})::int8";
case "System.SByte": return $"({getExp(operandExp)})::int2";
case "System.Single": return $"({getExp(operandExp)})::float4";
case "System.String": return $"({getExp(operandExp)})::varchar";
case "System.UInt16": return $"({getExp(operandExp)})::int2";
case "System.UInt32": return $"({getExp(operandExp)})::int4";
case "System.UInt64": return $"({getExp(operandExp)})::int8";
case "System.Guid": return $"({getExp(operandExp)})::uuid";
case "System.Decimal": return $"({getExp(operandExp)})::decimal";
case "System.Double": return $"({getExp(operandExp)})::float";
case "System.Int16": return $"({getExp(operandExp)})::smallint";
case "System.Int32": return $"({getExp(operandExp)})::integer";
case "System.Int64": return $"({getExp(operandExp)})::bigint";
case "System.SByte": return $"({getExp(operandExp)})::smallint";
case "System.Single": return $"({getExp(operandExp)})::smallfloat";
case "System.String": return $"({getExp(operandExp)})::nvarchar";
case "System.UInt16": return $"({getExp(operandExp)})::integer";
case "System.UInt32": return $"({getExp(operandExp)})::bigint";
case "System.UInt64": return $"({getExp(operandExp)})::decimal";
case "System.Guid": return $"({getExp(operandExp)})::char";
}
}
break;
@ -59,26 +59,26 @@ namespace FreeSql.Odbc.GBase
switch (callExp.Method.DeclaringType.NullableTypeOrThis().ToString())
{
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::byte";
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
case "System.DateTime": return $"({getExp(callExp.Arguments[0])})::timestamp";
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
case "System.Int32": return $"({getExp(callExp.Arguments[0])})::int4";
case "System.Int64": return $"({getExp(callExp.Arguments[0])})::int8";
case "System.SByte": return $"({getExp(callExp.Arguments[0])})::int2";
case "System.Single": return $"({getExp(callExp.Arguments[0])})::float4";
case "System.UInt16": return $"({getExp(callExp.Arguments[0])})::int2";
case "System.UInt32": return $"({getExp(callExp.Arguments[0])})::int4";
case "System.UInt64": return $"({getExp(callExp.Arguments[0])})::int8";
case "System.Guid": return $"({getExp(callExp.Arguments[0])})::uuid";
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::decimal";
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float";
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::smallint";
case "System.Int32": return $"({getExp(callExp.Arguments[0])})::integer";
case "System.Int64": return $"({getExp(callExp.Arguments[0])})::bigint";
case "System.SByte": return $"({getExp(callExp.Arguments[0])})::smallint";
case "System.Single": return $"({getExp(callExp.Arguments[0])})::smallfloat";
case "System.UInt16": return $"({getExp(callExp.Arguments[0])})::integer";
case "System.UInt32": return $"({getExp(callExp.Arguments[0])})::bigint";
case "System.UInt64": return $"({getExp(callExp.Arguments[0])})::decimal";
case "System.Guid": return $"({getExp(callExp.Arguments[0])})::char";
}
break;
case "NewGuid":
return null;
case "Next":
if (callExp.Object?.Type == typeof(Random)) return "(random()*1000000000)::int4";
if (callExp.Object?.Type == typeof(Random)) return "(random()*1000000000)::integer";
return null;
case "NextDouble":
if (callExp.Object?.Type == typeof(Random)) return "random()";

View File

@ -2,6 +2,7 @@
using FreeSql.Internal.CommonProvider;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq.Expressions;
using System.Threading;
@ -48,7 +49,8 @@ namespace FreeSql.Odbc.MySql
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -2,6 +2,7 @@
using FreeSql.Internal.CommonProvider;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Threading;
@ -49,7 +50,8 @@ namespace FreeSql.Odbc.Oracle
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -2,6 +2,7 @@
using FreeSql.Internal.CommonProvider;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading;
namespace FreeSql.Odbc.PostgreSQL
@ -46,7 +47,8 @@ namespace FreeSql.Odbc.PostgreSQL
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -2,6 +2,7 @@
using FreeSql.Internal.CommonProvider;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading;
namespace FreeSql.Odbc.SqlServer
@ -54,7 +55,8 @@ namespace FreeSql.Odbc.SqlServer
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -3,6 +3,7 @@ using FreeSql.Internal.CommonProvider;
using FreeSql.Oracle.Curd;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Threading;
@ -44,7 +45,8 @@ namespace FreeSql.Oracle
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -7,6 +7,7 @@ using NpgsqlTypes;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq.Expressions;
using System.Net;
@ -97,7 +98,8 @@ namespace FreeSql.PostgreSQL
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -3,6 +3,7 @@ using FreeSql.Internal.CommonProvider;
using FreeSql.SqlServer.Curd;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading;
namespace FreeSql.SqlServer
@ -55,7 +56,8 @@ namespace FreeSql.SqlServer
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();

View File

@ -3,6 +3,7 @@ using FreeSql.Internal.CommonProvider;
using FreeSql.Sqlite.Curd;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Threading;
@ -43,7 +44,8 @@ namespace FreeSql.Sqlite
internal CommonExpression InternalCommonExpression { get; }
public void Transaction(Action handler) => Ado.Transaction(handler);
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();