mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 优化 GBase 数据库存储过程参数化的执行;#965
This commit is contained in:
parent
6826dec09f
commit
9bd6e83ed7
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Version>2.8.100-preview1013</Version>
|
||||
<Version>2.6.100</Version>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Authors>FreeSql;GBase</Authors>
|
||||
<Description>FreeSql 数据库实现,基于 南大通用 8.0</Description>
|
||||
|
@ -1,8 +1,10 @@
|
||||
using FreeSql.GBase.Curd;
|
||||
using FreeSql.Internal.CommonProvider;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
@ -28,6 +30,26 @@ namespace FreeSql.GBase
|
||||
this.DbFirst = new GBaseDbFirst(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) =>
|
||||
{
|
||||
var dbtype = e.DataReader.GetDataTypeName(e.Index);
|
||||
|
Loading…
x
Reference in New Issue
Block a user