From 922f64524922447eb548d0fcfb734c7d77596a10 Mon Sep 17 00:00:00 2001 From: hyzx86 Date: Tue, 26 Sep 2023 22:54:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E5=A4=9A=E5=AE=9E=E4=BE=8B=20?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E8=A1=A8=E5=90=8D=E8=A7=84=E5=88=99=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E5=BC=80=E6=94=BE=E7=BC=93=E5=AD=98=E6=9C=BA?= =?UTF-8?q?=E5=88=B6=EF=BC=8C=E5=8F=AF=E4=BD=BF=E7=94=A8MemoryCache?= =?UTF-8?q?=E7=AD=89=E5=8A=9F=E8=83=BD=E6=9B=BF=E6=8D=A2=E4=B8=BA=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免全局静态缓存表名称无法替换 --- FreeSql/Internal/UtilsExpressionTree.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/FreeSql/Internal/UtilsExpressionTree.cs b/FreeSql/Internal/UtilsExpressionTree.cs index aa95c1cf..683406f6 100644 --- a/FreeSql/Internal/UtilsExpressionTree.cs +++ b/FreeSql/Internal/UtilsExpressionTree.cs @@ -19,8 +19,10 @@ namespace FreeSql.Internal { public class Utils { - - static ConcurrentDictionary> _cacheGetTableByEntity = new ConcurrentDictionary>(); + public static ConcurrentDictionary> _cacheGetTableByEntity + { + get; set; + } = new ConcurrentDictionary>(); internal static void RemoveTableByEntity(Type entity, CommonUtils common) { if (entity.IsAnonymousType() || @@ -534,7 +536,7 @@ namespace FreeSql.Internal { col.Attribute.IsNullable = false; col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "").Replace(" NULL", "").Trim(); - switch(common._orm.Ado.DataType) + switch (common._orm.Ado.DataType) { case DataType.Sqlite: col.Attribute.DbType += " NOT NULL"; //sqlite 主键也可以插入 null