mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 优化 GBase 数据库存储过程参数化的执行;#965
This commit is contained in:
parent
6826dec09f
commit
9bd6e83ed7
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Version>2.8.100-preview1013</Version>
|
<Version>2.6.100</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>FreeSql;GBase</Authors>
|
<Authors>FreeSql;GBase</Authors>
|
||||||
<Description>FreeSql 数据库实现,基于 南大通用 8.0</Description>
|
<Description>FreeSql 数据库实现,基于 南大通用 8.0</Description>
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using FreeSql.GBase.Curd;
|
using FreeSql.GBase.Curd;
|
||||||
using FreeSql.Internal.CommonProvider;
|
using FreeSql.Internal.CommonProvider;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Data;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
@ -28,6 +30,26 @@ namespace FreeSql.GBase
|
|||||||
this.DbFirst = new GBaseDbFirst(this, this.InternalCommonUtils, this.InternalCommonExpression);
|
this.DbFirst = new GBaseDbFirst(this, this.InternalCommonUtils, this.InternalCommonExpression);
|
||||||
this.CodeFirst = new GBaseCodeFirst(this, this.InternalCommonUtils, this.InternalCommonExpression);
|
this.CodeFirst = new GBaseCodeFirst(this, this.InternalCommonUtils, this.InternalCommonExpression);
|
||||||
|
|
||||||
|
this.Aop.CommandBefore += (_, e) =>
|
||||||
|
{
|
||||||
|
if (e.Command.CommandType == CommandType.StoredProcedure)
|
||||||
|
{
|
||||||
|
if (e.Command.CommandText.Trim().StartsWith("{call ", StringComparison.OrdinalIgnoreCase) == false)
|
||||||
|
{
|
||||||
|
var args = string.Join(", ", Enumerable.Range(0, e.Command.Parameters.Count)
|
||||||
|
.Select(a => "?"));
|
||||||
|
var cmdText = $"{{call {e.Command.CommandText}({args})}}";
|
||||||
|
|
||||||
|
foreach (DbParameter parameter in e.Command.Parameters)
|
||||||
|
{
|
||||||
|
if (parameter.DbType == DbType.String && parameter.Size <= 0)
|
||||||
|
parameter.Size = 255;
|
||||||
|
}
|
||||||
|
e.Command.CommandText = cmdText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.Aop.AuditDataReader += (_, e) =>
|
this.Aop.AuditDataReader += (_, e) =>
|
||||||
{
|
{
|
||||||
var dbtype = e.DataReader.GetDataTypeName(e.Index);
|
var dbtype = e.DataReader.GetDataTypeName(e.Index);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user