diff --git a/Easy.Snowflakes/Easy/Realization/AutoDelayTimers.cs b/Easy.Snowflakes/Easy/Realization/AutoDelayTimers.cs
index 988d344..a9e819e 100644
--- a/Easy.Snowflakes/Easy/Realization/AutoDelayTimers.cs
+++ b/Easy.Snowflakes/Easy/Realization/AutoDelayTimers.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Concurrent;
-using System.Threading;
+using System.Collections.Concurrent;
namespace Easy.Realization;
diff --git a/Easy.sln b/Easy.sln
index c34f717..539ff0c 100644
--- a/Easy.sln
+++ b/Easy.sln
@@ -37,8 +37,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Easy.EventBus", "src\Easy.E
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Guid.Test", "src\Guid.Test\Guid.Test.csproj", "{AB0828ED-6432-4647-8970-B57757ACD945}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Easy.Abstract", "src\Easy.Abstract\Easy.Abstract.csproj", "{EE29B72B-407F-4360-BB38-7CC1F6561D98}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -101,10 +99,6 @@ Global
{AB0828ED-6432-4647-8970-B57757ACD945}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB0828ED-6432-4647-8970-B57757ACD945}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB0828ED-6432-4647-8970-B57757ACD945}.Release|Any CPU.Build.0 = Release|Any CPU
- {EE29B72B-407F-4360-BB38-7CC1F6561D98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EE29B72B-407F-4360-BB38-7CC1F6561D98}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {EE29B72B-407F-4360-BB38-7CC1F6561D98}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {EE29B72B-407F-4360-BB38-7CC1F6561D98}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -118,7 +112,7 @@ Global
{A263D7E3-0153-48D0-822D-E3E0B51A4890} = {A420E7C6-F5D7-43F5-9BA8-6FB3341177BC}
{E2F1B3BA-DD92-4729-BDD0-91BB936520C0} = {A420E7C6-F5D7-43F5-9BA8-6FB3341177BC}
{1B91E50D-7E98-4B94-9BCA-76BB0423FB97} = {E2F1B3BA-DD92-4729-BDD0-91BB936520C0}
- {EF3CD7D3-DC58-4A36-BB6D-BB87EDAE7408} = {A420E7C6-F5D7-43F5-9BA8-6FB3341177BC}
+ {EF3CD7D3-DC58-4A36-BB6D-BB87EDAE7408} = {E2F1B3BA-DD92-4729-BDD0-91BB936520C0}
{8EC50AAD-EB45-402A-B474-A94EDBD342A3} = {A420E7C6-F5D7-43F5-9BA8-6FB3341177BC}
{1029F049-FBC4-4706-8985-9F05296F989C} = {A420E7C6-F5D7-43F5-9BA8-6FB3341177BC}
{4D135A3C-64AC-44DA-9386-877D7BBABFFB} = {E2F1B3BA-DD92-4729-BDD0-91BB936520C0}
@@ -126,7 +120,6 @@ Global
{9D31086B-1333-4745-AEC2-7966141E503C} = {E2F1B3BA-DD92-4729-BDD0-91BB936520C0}
{F464D123-49B6-4DC7-AE88-2F78CA0B6A3D} = {E2F1B3BA-DD92-4729-BDD0-91BB936520C0}
{AB0828ED-6432-4647-8970-B57757ACD945} = {E2F1B3BA-DD92-4729-BDD0-91BB936520C0}
- {EE29B72B-407F-4360-BB38-7CC1F6561D98} = {E2F1B3BA-DD92-4729-BDD0-91BB936520C0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7260112B-0232-4725-AB84-EF4DCCABFD77}
diff --git a/src/Easy.Abstract/Easy.Abstract.csproj b/src/Easy.Abstract/Easy.Abstract.csproj
index 5bb4aff..52896db 100644
--- a/src/Easy.Abstract/Easy.Abstract.csproj
+++ b/src/Easy.Abstract/Easy.Abstract.csproj
@@ -5,6 +5,8 @@
enable
+ True
+ 1.1.0
diff --git a/src/Easy.Authorization/Easy/Authorization/Realization/PermissionDefinitionContext.cs b/src/Easy.Authorization/Easy/Authorization/Realization/PermissionDefinitionContext.cs
index 91a2d60..619726c 100644
--- a/src/Easy.Authorization/Easy/Authorization/Realization/PermissionDefinitionContext.cs
+++ b/src/Easy.Authorization/Easy/Authorization/Realization/PermissionDefinitionContext.cs
@@ -1,5 +1,4 @@
using Easy.Authorization.Abstractions;
-using Easy.Exceptions;
namespace Easy.Authorization.Realization;
public class PermissionDefinitionContext : IPermissionDefinitionContext
@@ -13,7 +12,7 @@ public class PermissionDefinitionContext : IPermissionDefinitionContext
{
if (Groups.ContainsKey(name))
{
- throw new EasyException($"已经有一个名为{{ {name} }}的权限组");
+ //throw new EasyException($"已经有一个名为{{ {name} }}的权限组");
}
return Groups[name] = new PermissionDefinitionGroup(name);
diff --git a/src/Easy.Core/Easy.Core.csproj b/src/Easy.Core/Easy.Core.csproj
index 845194f..146a8cc 100644
--- a/src/Easy.Core/Easy.Core.csproj
+++ b/src/Easy.Core/Easy.Core.csproj
@@ -4,6 +4,8 @@
net6.0
enable
+ True
+ 1.1.5
diff --git a/src/Easy.Core/Easy/Abstract/IPagingRequest.cs b/src/Easy.Core/Easy/Abstract/IPagingRequest.cs
new file mode 100644
index 0000000..20c3d86
--- /dev/null
+++ b/src/Easy.Core/Easy/Abstract/IPagingRequest.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Easy.Abstract;
+public interface IPagingRequest
+{
+ ///
+ /// 页面索引
+ ///
+ public int PageIndex { get; set; }
+ ///
+ /// 页面大小
+ ///
+ public int PageSize { get; set; }
+}
diff --git a/src/Easy.Core/Easy/Abstract/IPagingSortingRequest.cs b/src/Easy.Core/Easy/Abstract/IPagingSortingRequest.cs
new file mode 100644
index 0000000..e962ce7
--- /dev/null
+++ b/src/Easy.Core/Easy/Abstract/IPagingSortingRequest.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Easy.Abstract;
+public interface IPagingSortingRequest : IPagingRequest
+{
+ ///
+ /// Sorting information.
+ /// 应包括排序字段和可选方向(ASC或DESC)
+ /// 可以包含多个由逗号(,)分隔的字段。
+ ///
+ ///
+ /// 例子:
+ /// "Name"
+ /// "Name DESC"
+ /// "Name ASC, Age DESC"
+ /// "ClassName Name ASC, Age DESC"
+ ///
+ public string Sorting { get; set; }
+}
diff --git a/src/Easy.Core/Easy/Check.cs b/src/Easy.Core/Easy/Check.cs
deleted file mode 100644
index 3f8af22..0000000
--- a/src/Easy.Core/Easy/Check.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System.Diagnostics.CodeAnalysis;
-
-namespace Easy;
-
-public static class Check
-{
- public static T NotNull(T value, [NotNull] string parameterName)
- {
- if (value == null)
- {
- throw new ArgumentNullException(parameterName);
- }
- return value;
- }
-
- public static T NotNull(T value, [NotNull] string parameterName, string message)
- {
- if (value == null)
- {
- throw new ArgumentNullException(parameterName, message);
- }
- return value;
- }
-
- public static string NotNullOrWhiteSpace(string value, [NotNull] string parameterName, int maxLength = int.MaxValue, int minLength = 0)
- {
- if (string.IsNullOrWhiteSpace(value))
- {
- throw new ArgumentException($"{parameterName} can not be null, empty or white space!", parameterName);
- }
-
- if (value.Length > maxLength)
- {
- throw new ArgumentException($"{parameterName} length must be equal to or lower than {maxLength}!", parameterName);
- }
-
- if (minLength > 0 && value.Length < minLength)
- {
- throw new ArgumentException($"{parameterName} length must be equal to or bigger than {minLength}!", parameterName);
- }
-
- return value;
- }
-}
diff --git a/src/Easy.Core/Easy/Exceptions/BusinessException.cs b/src/Easy.Core/Easy/Exceptions/BusinessException.cs
deleted file mode 100644
index 28cb8c6..0000000
--- a/src/Easy.Core/Easy/Exceptions/BusinessException.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace Easy.Exceptions;
-
-///
-/// 业务异常
-///
-public class BusinessException : Exception
-{
- ///
- /// 业务异常
- ///
- /// 消息
- public BusinessException(string message)
- : base(message)
- {
-
- }
-
-}
\ No newline at end of file
diff --git a/src/Easy.Core/Easy/Exceptions/EasyException.cs b/src/Easy.Core/Easy/Exceptions/EasyException.cs
deleted file mode 100644
index 6ea1ba9..0000000
--- a/src/Easy.Core/Easy/Exceptions/EasyException.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace Easy.Exceptions;
-public class EasyException : Exception
-{
- public EasyException()
- {
-
- }
-
- public EasyException(string message)
- : base(message)
- {
-
- }
-
- public EasyException(string message, Exception innerException)
- : base(message, innerException)
- {
-
- }
-}
diff --git a/src/Easy.Core/Easy/When.cs b/src/Easy.Core/Easy/When.cs
deleted file mode 100644
index 105aa76..0000000
--- a/src/Easy.Core/Easy/When.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Easy.Exceptions;
-
-namespace Easy;
-
-///
-/// when 语句
-///
-public class When
-{
- ///
- /// 是
- ///
- /// 是否
- /// 消息
- /// 服务异常会被中间件拦截
- public static void Is(bool isOk, string message)
- {
- if (isOk) throw new BusinessException(message);
- }
-
-}
diff --git a/src/Easy.Core/System/EnumDefineAttribute.cs b/src/Easy.Core/System/EnumDefineAttribute.cs
new file mode 100644
index 0000000..96a5fac
--- /dev/null
+++ b/src/Easy.Core/System/EnumDefineAttribute.cs
@@ -0,0 +1,35 @@
+namespace System
+{
+ [AttributeUsage(AttributeTargets.Field)]
+ public class EnumDefineAttribute : Attribute
+ {
+ ///
+ /// 枚举值。
+ ///
+ public int Value { get; internal set; }
+
+ ///
+ /// 枚举描述。
+ ///
+ public string Description { get; set; }
+
+ ///
+ /// 枚举获取列表分组标识。
+ ///
+ public string[] Group { get; set; }
+
+ ///
+ /// 枚举获取列表排序号,不指定则采用枚举值排序。
+ ///
+ public int? Sort { get; set; }
+
+ public EnumDefineAttribute()
+ {
+ }
+
+ public EnumDefineAttribute(string description)
+ {
+ Description = description;
+ }
+ }
+}
diff --git a/src/Easy.Core/System/EnumExtension.cs b/src/Easy.Core/System/EnumExtension.cs
new file mode 100644
index 0000000..8f79d2d
--- /dev/null
+++ b/src/Easy.Core/System/EnumExtension.cs
@@ -0,0 +1,174 @@
+using System.Collections;
+using System.Reflection;
+
+namespace System
+{
+ public static class EnumExtension
+ {
+ ///
+ /// A T extension method to determines whether the object is equal to any of the provided values.
+ ///
+ /// The object to be compared.
+ /// The value list to compare with the object.
+ /// true if the values list contains the object, else false.
+ public static bool In(this Enum @this, params Enum[] values)
+ {
+ return Array.IndexOf(values, @this) >= 0;
+ }
+
+ ///
+ /// 根据枚举值获得枚举。
+ ///
+ public static TEnum GetEnum(this int enValue) where TEnum : struct
+ {
+ Type typeFromHandle = typeof(TEnum);
+ if (!typeFromHandle.IsEnum)
+ {
+ throw new Exception("GetEnum 中的 TEnum 必须为枚举类型!");
+ }
+
+ return (TEnum)Enum.Parse(typeFromHandle, Convert.ToString(enValue));
+ }
+
+ ///
+ /// 获得枚举值。
+ ///
+ public static int GetValue(this Enum en)
+ {
+ return Convert.ToInt32(en);
+ }
+
+ ///
+ /// 获得枚举项定义的名称。
+ ///
+ ///
+ ///
+ public static string GetName(this Enum en)
+ {
+ return Enum.GetName(en.GetType(), en);
+ }
+
+ ///
+ /// 获得枚举EnumDefineAttribute定义的Description内容。
+ ///
+ public static string GetDescription(this Enum en)
+ {
+ EnumDefineAttribute enumDefineAttribute = GetEnumDefineAttribute(en);
+ return enumDefineAttribute.Description;
+ }
+
+ ///
+ /// 根据枚举值获得EnumDefineAttribute定义的Description内容。
+ ///
+ public static string GetDescription(this int enValue) where TEnum : struct
+ {
+ return (GetEnum(enValue) as Enum).GetDescription();
+ }
+
+ ///
+ /// 获得枚举的EnumDefineAttribute定义。
+ ///
+ public static EnumDefineAttribute GetEnumDefineAttribute(this Enum en)
+ {
+ string name = Enum.GetName(en.GetType(), en);
+ FieldInfo field = en.GetType().GetField(name);
+ return Attribute.GetCustomAttribute(field, typeof(EnumDefineAttribute)) as EnumDefineAttribute;
+ }
+
+ ///
+ /// 返回类型为 IEnumerable 的输入。
+ ///
+ static IEnumerable AsEnumerable() where T : struct
+ {
+ Type typeFromHandle = typeof(T);
+ if (!typeFromHandle.IsEnum)
+ {
+ throw new Exception("AsEnumerable 中的 T 必须为枚举类型!");
+ }
+
+ return new Enum();
+ }
+
+ ///
+ /// 返回枚举项的EnumDefineAttribute集合。
+ ///
+ public static List GetEnumDefines(string groupName) where T : struct
+ {
+ Type typeFromHandle = typeof(T);
+ if (!typeFromHandle.IsEnum)
+ {
+ throw new Exception("GetEnumDefineAttributes 中的 T 必须为枚举类型!");
+ }
+
+ List list = new List();
+ EnumDefineAttribute eda = null;
+ foreach (var en in AsEnumerable())
+ {
+ eda = GetEnumDefineAttribute(en as Enum);
+ eda.Value = Convert.ToInt32(en);
+ if (!eda.Sort.HasValue) eda.Sort = eda.Value;
+
+ if (!string.IsNullOrEmpty(groupName) && !eda.Group.Contains(groupName))
+ {
+ continue;
+ }
+ else
+ {
+ list.Add(eda);
+ }
+ }
+
+ return list.OrderBy(o => o.Sort).ToList();
+ }
+ }
+
+ ///
+ /// T 类型枚举列表
+ ///
+ /// 枚举类型
+ public class Enum : IEnumerable
+ {
+ #region IEnumerable 成员
+
+ ///
+ /// 返回一个循环访问集合的枚举数。
+ ///
+ /// 可用于循环访问集合的 IEnumerator。
+ public IEnumerator GetEnumerator()
+ {
+ foreach (T item in Enum.GetValues(typeof(T)))
+ {
+ yield return item;
+ }
+ }
+
+ #endregion
+
+ #region IEnumerable 成员
+
+ ///
+ /// 返回一个循环访问集合的枚举数。
+ ///
+ /// 可用于循环访问集合的 IEnumerator 。
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ #endregion
+
+ #region IEnumerable 成员
+
+ ///
+ /// 返回一个循环访问集合的枚举数。
+ ///
+ ///
+ /// 可用于循环访问集合的 IEnumerator<T> 。
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Easy.DDD.Application/Easy.DDD.Application.csproj b/src/Easy.DDD.Application/Easy.DDD.Application.csproj
index 18815ca..b5c70ef 100644
--- a/src/Easy.DDD.Application/Easy.DDD.Application.csproj
+++ b/src/Easy.DDD.Application/Easy.DDD.Application.csproj
@@ -4,14 +4,14 @@
enable
True
- 1.1.2
+ 1.1.3
-
+
diff --git a/src/Easy.Result/Easy.Result.csproj b/src/Easy.Result/Easy.Result.csproj
index e667d2a..534fc5f 100644
--- a/src/Easy.Result/Easy.Result.csproj
+++ b/src/Easy.Result/Easy.Result.csproj
@@ -4,7 +4,7 @@
net6.0
enable
True
- 1.1.4
+ 1.1.5
@@ -12,6 +12,6 @@
-
+