From 50eba05c15dc9faccd1201eeaa8667d17614fbeb Mon Sep 17 00:00:00 2001
From: 28810 <28810@YEXIANGQIN>
Date: Tue, 21 Apr 2020 16:55:32 +0800
Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=20WhereDynamic=20?=
=?UTF-8?q?=E4=BC=A0=E5=85=A5=20string=20=E7=9A=84=E6=97=B6=E5=80=99?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=BD=AC=E4=B8=BA=E4=B8=BB=E9=94=AE=E7=9A=84?=
=?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=80=BC=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FreeSql.DbContext/FreeSql.DbContext.xml | 16 --
FreeSql/FreeSql.xml | 291 +++++++++++-------------
FreeSql/Internal/CommonUtils.cs | 4 +
3 files changed, 135 insertions(+), 176 deletions(-)
diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml
index f619f03f..67ccde2b 100644
--- a/FreeSql.DbContext/FreeSql.DbContext.xml
+++ b/FreeSql.DbContext/FreeSql.DbContext.xml
@@ -120,13 +120,6 @@
清空状态数据
-
-
- 根据 lambda 条件删除数据
-
-
-
-
添加
@@ -417,14 +410,5 @@
-
-
- 批量注入 Repository,可以参考代码自行调整
-
-
-
-
-
-
diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml
index 09a5a1d6..d6b6f1a8 100644
--- a/FreeSql/FreeSql.xml
+++ b/FreeSql/FreeSql.xml
@@ -2310,6 +2310,137 @@
+
+
+ 查询,若使用读写分离,查询【从库】条件cmdText.StartsWith("SELECT "),否则查询【主库】
+
+
+
+
+
+
+
+
+ 查询,ExecuteReaderAsync(dr => {}, "select * from user where age > ?age", new { age = 25 })
+
+
+
+
+
+
+ 查询
+
+
+
+
+
+
+ 查询,ExecuteArrayAsync("select * from user where age > ?age", new { age = 25 })
+
+
+
+
+
+
+
+ 查询
+
+
+
+
+
+
+ 查询,ExecuteDataSetAsync("select * from user where age > ?age; select 2", new { age = 25 })
+
+
+
+
+
+
+
+ 查询
+
+
+
+
+
+
+ 查询,ExecuteDataTableAsync("select * from user where age > ?age", new { age = 25 })
+
+
+
+
+
+
+
+ 在【主库】执行
+
+
+
+
+
+
+
+ 在【主库】执行,ExecuteNonQueryAsync("delete from user where age > ?age", new { age = 25 })
+
+
+
+
+
+
+
+ 在【主库】执行
+
+
+
+
+
+
+
+ 在【主库】执行,ExecuteScalarAsync("select 1 from user where age > ?age", new { age = 25 })
+
+
+
+
+
+
+
+ 执行SQL返回对象集合,QueryAsync<User>("select * from user where age > ?age", new SqlParameter { ParameterName = "age", Value = 25 })
+
+
+
+
+
+
+
+
+
+ 执行SQL返回对象集合,QueryAsync<User>("select * from user where age > ?age", new { age = 25 })
+
+
+
+
+
+
+
+
+ 执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 })
+
+
+
+
+
+
+
+
+
+ 执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new { age = 25 })
+
+
+
+
+
+
可自定义解析表达式
@@ -2830,166 +2961,6 @@
超时
-
-
- 使用完毕后,归还资源
-
- 对象
- 是否重新创建
-
-
-
- 名称
-
-
-
-
- 池容量
-
-
-
-
- 默认获取超时设置
-
-
-
-
- 空闲时间,获取时若超出,则重新创建
-
-
-
-
- 异步获取排队队列大小,小于等于0不生效
-
-
-
-
- 获取超时后,是否抛出异常
-
-
-
-
- 监听 AppDomain.CurrentDomain.ProcessExit/Console.CancelKeyPress 事件自动释放
-
-
- ry>
- 获取c#值
-
-
-
-
-
-
- 获取c#类型,int、long
-
-
-
-
-
-
- 获取c#类型对象
-
-
-
-
-
-
- 获取ado.net读取方法, GetBoolean、GetInt64
-
-
-
-
-
-
- 序列化
-
-
-
-
-
-
- 反序列化
-
-
-
-
-
-
- 获取数据库枚举类型,适用 PostgreSQL
-
-
-
-
-
-
- AsType, Ctor, ClearData 三处地方需要重新加载
-
-
-
-
- AsType, Ctor, ClearData 三处地方需要重新加载
-
-
-
-
- 通过属性的注释文本,通过 xml 读取
-
-
- Dict:key=属性名,value=注释
-
-
-
- 创建一个过滤器
-
-
- 名字
- 表达式
-
-
-
-
- 中间表,多对多
-
-
-
-
- 是否可用
-
-
-
-
- 不可用错误
-
-
-
-
- 不可用时间
-
-
-
-
- 将对象池设置为不可用,后续 Get/GetAsync 均会报错,同时启动后台定时检查服务恢复可用
-
-
- 由【可用】变成【不可用】时返回true,否则返回false
-
-
-
- 统计对象池中的对象
-
-
-
-
- 统计对象池中的对象(完整)
-
-
-
-
- 获取资源
-
- 超时
-
-
获取资源
diff --git a/FreeSql/Internal/CommonUtils.cs b/FreeSql/Internal/CommonUtils.cs
index 9ffab8cb..9e8a337c 100644
--- a/FreeSql/Internal/CommonUtils.cs
+++ b/FreeSql/Internal/CommonUtils.cs
@@ -276,6 +276,10 @@ namespace FreeSql.Internal
}
return sb.ToString();
}
+ else if (primarys.Length == 1 && type == typeof(string))
+ {
+ return $"{aliasAndDot}{this.QuoteSqlName(pk1.Attribute.Name)} = {this.FormatSql("{0}", Utils.GetDataReaderValue(pk1.Attribute.MapType, dywhere))}";
+ }
else if (dywhere is IEnumerable)
{
var sb = new StringBuilder();