From 818b8b80133eb6b672df1df04f93b4dfa6e64ce0 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Wed, 28 May 2025 17:36:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JiShe.CollectBus.IoTDB.csproj | 5 +- .../Options/QueryCondition.cs | 3 +- .../SourceEntityAccessorFactory3.cs | 52 ------------------- .../JiShe.CollectBus.Kafka.csproj | 3 ++ .../SourceEntityAccessorFactory2.cs | 1 - 5 files changed, 8 insertions(+), 56 deletions(-) delete mode 100644 modules/JiShe.CollectBus.IoTDB/SourceEntityAccessorFactory3.cs delete mode 100644 shared/JiShe.CollectBus.Analyzers.Shared/SourceEntityAccessorFactory2.cs diff --git a/modules/JiShe.CollectBus.IoTDB/JiShe.CollectBus.IoTDB.csproj b/modules/JiShe.CollectBus.IoTDB/JiShe.CollectBus.IoTDB.csproj index 78b81e3..981ea2f 100644 --- a/modules/JiShe.CollectBus.IoTDB/JiShe.CollectBus.IoTDB.csproj +++ b/modules/JiShe.CollectBus.IoTDB/JiShe.CollectBus.IoTDB.csproj @@ -3,7 +3,10 @@ net8.0 enable - enable + enable + 1.0.1 + 1.0.1 + 1.0.1 diff --git a/modules/JiShe.CollectBus.IoTDB/Options/QueryCondition.cs b/modules/JiShe.CollectBus.IoTDB/Options/QueryCondition.cs index bccf017..e754833 100644 --- a/modules/JiShe.CollectBus.IoTDB/Options/QueryCondition.cs +++ b/modules/JiShe.CollectBus.IoTDB/Options/QueryCondition.cs @@ -1,5 +1,4 @@ -using JiShe.CollectBus.Common.Extensions; -using JiShe.CollectBus.Common.Helpers; + namespace JiShe.CollectBus.IoTDB.Options { diff --git a/modules/JiShe.CollectBus.IoTDB/SourceEntityAccessorFactory3.cs b/modules/JiShe.CollectBus.IoTDB/SourceEntityAccessorFactory3.cs deleted file mode 100644 index 4712b67..0000000 --- a/modules/JiShe.CollectBus.IoTDB/SourceEntityAccessorFactory3.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Reflection; - -namespace JiShe.CollectBus.Analyzers.Shared; - -public static class SourceEntityAccessorFactory3 -{ - private static readonly ConcurrentDictionary _accessors = new(); - - public static ISourceEntityAccessor GetAccessor() - { - return (ISourceEntityAccessor)_accessors.GetOrAdd(typeof(T), t => - { - // 获取泛型类型定义信息(如果是泛型类型) - var isGeneric = t.IsGenericType; - var genericTypeDef = isGeneric ? t.GetGenericTypeDefinition() : null; - var arity = isGeneric ? genericTypeDef!.GetGenericArguments().Length : 0; - - // 构建访问器类名 - var typeName = isGeneric - ? $"{t.Namespace}.{genericTypeDef!.Name.Split('`')[0]}Accessor`{arity}" - : $"{t.Namespace}.{t.Name}Accessor"; - - // 尝试从当前程序集加载 - var accessorType = Assembly.GetAssembly(t)!.GetType(typeName) - ?? throw new InvalidOperationException($"Accessor type {typeName} not found"); - - // 处理泛型参数 - if (isGeneric && accessorType.IsGenericTypeDefinition) - { - accessorType = accessorType.MakeGenericType(t.GetGenericArguments()); - } - - return Activator.CreateInstance(accessorType)!; - }); - } - - public static object GetAccessor(Type type) - { - MethodInfo getAccessorMethod = typeof(SourceEntityAccessorFactory) - .GetMethod( - name: nameof(GetAccessor), - bindingAttr: BindingFlags.Public | BindingFlags.Static, - - types: Type.EmptyTypes - ); - - MethodInfo genericMethod = getAccessorMethod.MakeGenericMethod(type); - return genericMethod.Invoke(null, null); - } -} \ No newline at end of file diff --git a/modules/JiShe.CollectBus.Kafka/JiShe.CollectBus.Kafka.csproj b/modules/JiShe.CollectBus.Kafka/JiShe.CollectBus.Kafka.csproj index a0fd2f7..a98693b 100644 --- a/modules/JiShe.CollectBus.Kafka/JiShe.CollectBus.Kafka.csproj +++ b/modules/JiShe.CollectBus.Kafka/JiShe.CollectBus.Kafka.csproj @@ -4,6 +4,9 @@ net8.0 enable enable + 1.0.1 + 1.0.1 + 1.0.1 diff --git a/shared/JiShe.CollectBus.Analyzers.Shared/SourceEntityAccessorFactory2.cs b/shared/JiShe.CollectBus.Analyzers.Shared/SourceEntityAccessorFactory2.cs deleted file mode 100644 index 5f28270..0000000 --- a/shared/JiShe.CollectBus.Analyzers.Shared/SourceEntityAccessorFactory2.cs +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file