From b18f9a5264e29ff9364e0d2dd570e665b6303ca4 Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Tue, 27 Feb 2024 16:47:13 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20Clickhouse=20ToInt32/T?= =?UTF-8?q?oInt64=20=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FreeSql/FreeSql.xml | 98 +++++++++++++++++++ .../ClickHouseExpression.cs | 10 +- 2 files changed, 103 insertions(+), 5 deletions(-) diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml index 8adf6d85f..8f213e5ce 100644 --- a/FreeSql/FreeSql.xml +++ b/FreeSql/FreeSql.xml @@ -1104,6 +1104,82 @@ + + + 动态创建实体类型 + + + + + 配置Class + + 类名 + 类标记的特性[Table(Name = "xxx")] [Index(xxxx)] + + + + + 配置属性 + + 属性名称 + 属性类型 + 属性标记的特性-支持多个 + + + + + 配置属性 + + 属性名称 + 属性类型 + 该属性是否重写父类属性 + 属性标记的特性-支持多个 + + + + + 配置属性 + + 属性名称 + 属性类型 + 该属性是否重写父类属性 + 属性默认值 + 属性标记的特性-支持多个 + + + + + 配置父类 + + 父类类型 + + + + + Override属性 + + + + + + Emit动态创建出Class - Type + + + + + + 首字母小写 + + + + + + + 首字母大写 + + + + 获取实体的主键值,以 "*|_,[,_|*" 分割,当任意一个主键属性无值时,返回 null @@ -5821,6 +5897,28 @@ 请使用 fsql.InsertDict(dict) 方法插入字典数据 + + + 动态构建Class Type + + + + + + 根据字典,创建 table 对应的实体对象 + + + + + + + + 根据实体对象,创建 table 对应的字典 + + + + + C#: that >= between && that <= and diff --git a/Providers/FreeSql.Provider.ClickHouse/ClickHouseExpression.cs b/Providers/FreeSql.Provider.ClickHouse/ClickHouseExpression.cs index 64a24a3c4..292bd6209 100644 --- a/Providers/FreeSql.Provider.ClickHouse/ClickHouseExpression.cs +++ b/Providers/FreeSql.Provider.ClickHouse/ClickHouseExpression.cs @@ -604,14 +604,14 @@ public override string ExpressionLambdaToSqlCallConvert(MethodCallExpression exp case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as DateTime)"; case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as Decimal128(19))"; case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as Float64)"; - case "ToInt16": - case "ToInt32": - case "ToInt64": + case "ToInt16": return $"cast({getExp(exp.Arguments[0])} as Int16)"; + case "ToInt32": return $"cast({getExp(exp.Arguments[0])} as Int32)"; + case "ToInt64": return $"cast({getExp(exp.Arguments[0])} as Int64)"; case "ToSByte": return $"cast({getExp(exp.Arguments[0])} as UInt8)"; case "ToSingle": return $"cast({getExp(exp.Arguments[0])} as Float32)"; case "ToString": return $"cast({getExp(exp.Arguments[0])} as String)"; - case "ToUInt16": - case "ToUInt32": + case "ToUInt16": return $"cast({getExp(exp.Arguments[0])} as UInt16)"; + case "ToUInt32": return $"cast({getExp(exp.Arguments[0])} as UInt32)"; case "ToUInt64": return $"cast({getExp(exp.Arguments[0])} as UInt64)"; } }