dotnetcore / dotnetcore/FreeSql

Ado.Query 使用参数化查询非常缓慢

Open
#2,050 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.4k
Forks
910
PR merge metrics
No merged PRs in 30d

Description

#### 问题描述及重现代码:

```c#
public static readonly IFreeSql fsql = new FreeSqlBuilder()
.UseConnectionString(
DataType.Oracle,
dBUtility.Get_DB_ConnectionString(...)
)
.UseAutoSyncStructure(false)
.Build(); //请务必定义成 Singleton 单例模式

private const string sql = @"select c1,i2,c3 from t WHERE cond =:cond ";
var result2 = fsql.Ado.Query<(string, int, string)>(sql, new {cond=cond})
.ToList();
```

使用参数化查询,查询消耗5秒以上,数据库工具中手工查询,消耗0.004秒。将参数化查询改为手工拼接sql,可以秒出结果

#### 数据库版本

Oracle 10

#### 安装的Nuget包

3.5.208

#### .net framework/. net core? 及具体版本

.net framework 4.6.2

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.