diff --git a/Tiobon.Core.Common/Extensions/GenericTypeExtensions.cs b/Tiobon.Core.Common/Extensions/GenericTypeExtensions.cs
index 99c26abc..a5304fad 100644
--- a/Tiobon.Core.Common/Extensions/GenericTypeExtensions.cs
+++ b/Tiobon.Core.Common/Extensions/GenericTypeExtensions.cs
@@ -34,25 +34,25 @@ namespace Tiobon.Core.Common.Extensions
/// 类型
/// 泛型类型
/// bool
- // public static bool HasImplementedRawGeneric(this Type type, Type generic)
- // {
- // // 检查接口类型
- // var isTheRawGenericType = type.GetInterfaces().Any(IsTheRawGenericType);
- // if (isTheRawGenericType) return true;
+ public static bool HasImplementedRawGeneric(this Type type, Type generic)
+ {
+ // 检查接口类型
+ var isTheRawGenericType = type.GetInterfaces().Any(IsTheRawGenericType);
+ if (isTheRawGenericType) return true;
- // // 检查类型
- // while (type != null && type != typeof(object))
- // {
- // isTheRawGenericType = IsTheRawGenericType(type);
- // if (isTheRawGenericType) return true;
- // type = type.BaseType;
- // }
+ // 检查类型
+ while (type != null && type != typeof(object))
+ {
+ isTheRawGenericType = IsTheRawGenericType(type);
+ if (isTheRawGenericType) return true;
+ type = type.BaseType;
+ }
- // return false;
+ return false;
- // // 判断逻辑
- // bool IsTheRawGenericType(Type type) => generic == (type.IsGenericType ? type.GetGenericTypeDefinition() : type);
- // }
+ // 判断逻辑
+ bool IsTheRawGenericType(Type t) => generic == (t.IsGenericType ? t.GetGenericTypeDefinition() : t);
+ }
///
/// 复制 的副本
diff --git a/Tiobon.Core.Common/Helper/DynamicLinqFactory.cs b/Tiobon.Core.Common/Helper/DynamicLinqFactory.cs
index f2e6017f..c383497c 100644
--- a/Tiobon.Core.Common/Helper/DynamicLinqFactory.cs
+++ b/Tiobon.Core.Common/Helper/DynamicLinqFactory.cs
@@ -1,12 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
+using System.ComponentModel.DataAnnotations;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using Mapster;
+using Tiobon.Core.Common.Extensions;
namespace Tiobon.Core.Common.Helper
{
diff --git a/Tiobon.Core.Common/Helper/GenericTypeExtensions.cs b/Tiobon.Core.Common/Helper/GenericTypeExtensions.cs
deleted file mode 100644
index 3d2192f7..00000000
--- a/Tiobon.Core.Common/Helper/GenericTypeExtensions.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.Linq;
-
-namespace Tiobon.Core.Common.Helper
-{
- public static class GenericTypeExtensions
- {
- ///
- /// 判断类型是否实现某个泛型
- ///
- /// 类型
- /// 泛型类型
- /// bool
- public static bool HasImplementedRawGeneric(this Type type, Type generic)
- {
- // 检查接口类型
- var isTheRawGenericType = type.GetInterfaces().Any(IsTheRawGenericType);
- if (isTheRawGenericType) return true;
-
- // 检查类型
- while (type != null && type != typeof(object))
- {
- isTheRawGenericType = IsTheRawGenericType(type);
- if (isTheRawGenericType) return true;
- type = type.BaseType;
- }
-
- return false;
-
- // 判断逻辑
- bool IsTheRawGenericType(Type t) => generic == (t.IsGenericType ? t.GetGenericTypeDefinition() : t);
- }
-
- public static string GetGenericTypeName(this Type type)
- {
- var typeName = string.Empty;
-
- if (type.IsGenericType)
- {
- var genericTypes = string.Join(",", type.GetGenericArguments().Select(t => t.Name).ToArray());
- typeName = $"{type.Name.Remove(type.Name.IndexOf('`'))}<{genericTypes}>";
- }
- else
- {
- typeName = type.Name;
- }
-
- return typeName;
- }
-
- public static string GetGenericTypeName(this object @object)
- {
- return @object.GetType().GetGenericTypeName();
- }
- }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Extensions/ServiceExtensions/GenericTypeExtensions.cs b/Tiobon.Core.Extensions/ServiceExtensions/GenericTypeExtensions.cs
deleted file mode 100644
index a0cd507e..00000000
--- a/Tiobon.Core.Extensions/ServiceExtensions/GenericTypeExtensions.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.Linq;
-
-namespace Tiobon.Core.Extensions
-{
- public static class GenericTypeExtensions
- {
- public static string GetGenericTypeName(this Type type)
- {
- var typeName = string.Empty;
-
- if (type.IsGenericType)
- {
- var genericTypes = string.Join(",", type.GetGenericArguments().Select(t => t.Name).ToArray());
- typeName = $"{type.Name.Remove(type.Name.IndexOf('`'))}<{genericTypes}>";
- }
- else
- {
- typeName = type.Name;
- }
-
- return typeName;
- }
-
- public static string GetGenericTypeName(this object @object)
- {
- return @object.GetType().GetGenericTypeName();
- }
- }
-}