feat: initialize Evergreen Health backend
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 通用接口参数验证特性类
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class CommonValidationAttribute : ValidationAttribute
|
||||
{
|
||||
private readonly Dictionary<string, string> _conditions;
|
||||
private static readonly Dictionary<string, Delegate> CompiledConditions = new();
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="conditionPairs">条件对参数,长度必须为偶数<br/>
|
||||
/// 奇数字符串参数:动态条件<br/>
|
||||
/// 偶数字符串参数:提示消息
|
||||
/// </param>
|
||||
/// <example>
|
||||
/// <code lang="C">
|
||||
/// public class ModelInput {
|
||||
///
|
||||
///
|
||||
/// public string A { get; set; }
|
||||
///
|
||||
///
|
||||
/// [CommonValidation(
|
||||
/// "A == 1 <value>&&</value> B == null", "当 A == 1时,B不能为空",
|
||||
/// "C == 2 <value>&&</value> B == null", "当 C == 2时,B不能为空"
|
||||
/// )]
|
||||
/// public string B { get; set; }
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
public CommonValidationAttribute(params string[] conditionPairs)
|
||||
{
|
||||
if (conditionPairs.Length % 2 != 0) throw new ArgumentException("条件对必须以偶数个字符串的形式提供。");
|
||||
|
||||
var conditions = new Dictionary<string, string>();
|
||||
for (int i = 0; i < conditionPairs.Length; i += 2)
|
||||
conditions.Add(conditionPairs[i], conditionPairs[i + 1]);
|
||||
|
||||
_conditions = conditions;
|
||||
}
|
||||
|
||||
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
|
||||
{
|
||||
foreach (var (expr, errorMessage) in _conditions)
|
||||
{
|
||||
var conditionKey = $"{validationContext.ObjectType.FullName}.{expr}";
|
||||
if (!CompiledConditions.TryGetValue(conditionKey, out var condition))
|
||||
{
|
||||
condition = CreateCondition(validationContext.ObjectType, expr);
|
||||
CompiledConditions[conditionKey] = condition;
|
||||
}
|
||||
|
||||
if ((bool)condition.DynamicInvoke(validationContext.ObjectInstance)!)
|
||||
{
|
||||
return new ValidationResult(errorMessage ?? $"[{validationContext.MemberName}]校验失败");
|
||||
}
|
||||
}
|
||||
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
|
||||
private Delegate CreateCondition(Type modelType, string expression)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 创建参数表达式
|
||||
var parameter = Expression.Parameter(typeof(object), "x");
|
||||
|
||||
// 构建 Lambda 表达式
|
||||
var lambda = DynamicExpressionParser.ParseLambda(new[] { Expression.Parameter(modelType, "x") }, typeof(bool), expression);
|
||||
|
||||
// 创建新的 Lambda 表达式,接受 object 参数并调用编译后的表达式
|
||||
var invokeExpression = Expression.Invoke(lambda, Expression.Convert(parameter, modelType));
|
||||
var finalLambda = Expression.Lambda<Func<object, bool>>(invokeExpression, parameter);
|
||||
|
||||
return finalLambda.Compile();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ArgumentException($"无法解析表达式 '{expression}': {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 常量特性
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
|
||||
public class ConstAttribute : Attribute
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public ConstAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义Json转换字段名
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class CustomJsonPropertyAttribute : Attribute
|
||||
{
|
||||
public string Name { get; }
|
||||
|
||||
public CustomJsonPropertyAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义规范化结果特性
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
|
||||
public class CustomUnifyResultAttribute : Attribute
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public CustomUnifyResultAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 数据脱敏特性(支持自定义脱敏位置和脱敏字符)
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class DataMaskAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 脱敏起始位置(从0开始)
|
||||
/// </summary>
|
||||
private int StartIndex { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 脱敏长度
|
||||
/// </summary>
|
||||
private int Length { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 脱敏字符(默认*)
|
||||
/// </summary>
|
||||
private char MaskChar { get; set; } = '*';
|
||||
|
||||
/// <summary>
|
||||
/// 是否保留原始长度(默认true)
|
||||
/// </summary>
|
||||
private bool KeepLength { get; set; } = true;
|
||||
|
||||
public DataMaskAttribute(int startIndex, int length)
|
||||
{
|
||||
if (startIndex < 0) throw new ArgumentOutOfRangeException(nameof(startIndex));
|
||||
if (length <= 0) throw new ArgumentOutOfRangeException(nameof(length));
|
||||
|
||||
StartIndex = startIndex;
|
||||
Length = length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行脱敏处理
|
||||
/// </summary>
|
||||
public string Mask(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input) || input.Length <= StartIndex)
|
||||
return input;
|
||||
|
||||
var maskedLength = Math.Min(Length, input.Length - StartIndex);
|
||||
var maskStr = new string(MaskChar, KeepLength ? maskedLength : Math.Min(4, maskedLength));
|
||||
|
||||
return input.Substring(0, StartIndex) + maskStr +
|
||||
(StartIndex + maskedLength < input.Length ?
|
||||
input.Substring(StartIndex + maskedLength) : "");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 字典值合规性校验特性
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
|
||||
public class DictAttribute : ValidationAttribute, ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典编码
|
||||
/// </summary>
|
||||
public string DictTypeCode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否允许空字符串
|
||||
/// </summary>
|
||||
public bool AllowEmptyStrings { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 允许空值,有值才验证,默认 false
|
||||
/// </summary>
|
||||
public bool AllowNullValue { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 字典值合规性校验特性
|
||||
/// </summary>
|
||||
/// <param name="dictTypeCode"></param>
|
||||
/// <param name="errorMessage"></param>
|
||||
public DictAttribute(string dictTypeCode = "", string errorMessage = "字典值不合法!")
|
||||
{
|
||||
DictTypeCode = dictTypeCode;
|
||||
ErrorMessage = errorMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典值合规性校验
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="validationContext"></param>
|
||||
/// <returns></returns>
|
||||
protected override ValidationResult IsValid(object? value, ValidationContext validationContext)
|
||||
{
|
||||
// 判断是否允许空值
|
||||
if (AllowNullValue && value == null) return ValidationResult.Success;
|
||||
|
||||
// 获取属性的类型
|
||||
var property = validationContext.ObjectType.GetProperty(validationContext.MemberName!);
|
||||
if (property == null) return new ValidationResult($"未知属性: {validationContext.MemberName}");
|
||||
|
||||
string importHeaderName = GetImporterHeaderName(property, validationContext.MemberName);
|
||||
|
||||
var propertyType = Nullable.GetUnderlyingType(property.PropertyType) ?? property.PropertyType;
|
||||
|
||||
// 先尝试从 ValidationContext 的依赖注入容器中拿服务,拿不到或类型不匹配时,再从全局的 App 容器中获取
|
||||
if (validationContext.GetService(typeof(SysDictDataService)) is not SysDictDataService sysDictDataService)
|
||||
sysDictDataService = App.GetRequiredService<SysDictDataService>();
|
||||
|
||||
// 获取字典值列表
|
||||
var dictDataList = sysDictDataService.GetDataList(DictTypeCode).GetAwaiter().GetResult();
|
||||
|
||||
// 使用 HashSet 来提高查找效率
|
||||
var dictHash = new HashSet<string>(dictDataList.Select(u => u.Value));
|
||||
|
||||
// 判断是否为集合类型
|
||||
if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(List<>))
|
||||
{
|
||||
// 如果是空集合并且允许空值,则直接返回成功
|
||||
if (value == null && AllowNullValue) return ValidationResult.Success;
|
||||
|
||||
// 处理集合为空的情况
|
||||
var collection = value as IEnumerable;
|
||||
if (collection == null) return ValidationResult.Success;
|
||||
|
||||
// 获取集合的元素类型
|
||||
var elementType = propertyType.GetGenericArguments()[0];
|
||||
var underlyingElementType = Nullable.GetUnderlyingType(elementType) ?? elementType;
|
||||
|
||||
// 如果元素类型是枚举,则逐个验证
|
||||
if (underlyingElementType.IsEnum)
|
||||
{
|
||||
foreach (var item in collection)
|
||||
{
|
||||
if (item == null && AllowNullValue) continue;
|
||||
|
||||
if (!Enum.IsDefined(underlyingElementType, item!))
|
||||
return new ValidationResult($"提示:{ErrorMessage}|枚举值【{item}】不是有效的【{underlyingElementType.Name}】枚举类型值!", [importHeaderName]);
|
||||
}
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
|
||||
foreach (var item in collection)
|
||||
{
|
||||
if (item == null && AllowNullValue) continue;
|
||||
|
||||
var itemString = item?.ToString();
|
||||
if (!dictHash.Contains(itemString))
|
||||
return new ValidationResult($"提示:{ErrorMessage}|字典【{DictTypeCode}】不包含【{itemString}】!", [importHeaderName]);
|
||||
}
|
||||
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
|
||||
var valueAsString = value?.ToString();
|
||||
|
||||
// 是否忽略空字符串
|
||||
if (AllowEmptyStrings && string.IsNullOrEmpty(valueAsString)) return ValidationResult.Success;
|
||||
|
||||
// 枚举类型验证
|
||||
if (propertyType.IsEnum)
|
||||
{
|
||||
if (!Enum.IsDefined(propertyType, value!)) return new ValidationResult($"提示:{ErrorMessage}|枚举值【{value}】不是有效的【{propertyType.Name}】枚举类型值!", [importHeaderName]);
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
|
||||
if (!dictHash.Contains(valueAsString))
|
||||
return new ValidationResult($"提示:{ErrorMessage}|字典【{DictTypeCode}】不包含【{valueAsString}】!", [importHeaderName]);
|
||||
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取本字段上 [ImporterHeader(Name = "xxx")] 里的Name,如果没有则使用defaultName.
|
||||
/// 用于在从excel导入数据时,能让调用者知道是哪个字段验证失败,而不是抛异常
|
||||
/// </summary>
|
||||
private static string GetImporterHeaderName(PropertyInfo property, string defaultName)
|
||||
{
|
||||
var importerHeader = property.GetCustomAttribute<ImporterHeaderAttribute>();
|
||||
string importerHeaderName = importerHeader?.Name ?? defaultName;
|
||||
return importerHeaderName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 枚举值合规性校验特性
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = true)]
|
||||
public class EnumAttribute : ValidationAttribute, ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 枚举值合规性校验特性
|
||||
/// </summary>
|
||||
/// <param name="errorMessage"></param>
|
||||
public EnumAttribute(string errorMessage = "枚举值不合法!")
|
||||
{
|
||||
ErrorMessage = errorMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 枚举值合规性校验
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="validationContext"></param>
|
||||
/// <returns></returns>
|
||||
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
|
||||
{
|
||||
// 获取属性的类型
|
||||
var property = validationContext.ObjectType.GetProperty(validationContext.MemberName);
|
||||
if (property == null)
|
||||
return new ValidationResult($"未知属性: {validationContext.MemberName}");
|
||||
|
||||
var propertyType = Nullable.GetUnderlyingType(property.PropertyType) ?? property.PropertyType;
|
||||
|
||||
// 检查属性类型是否为枚举或可空枚举类型
|
||||
if (!propertyType.IsEnum)
|
||||
return new ValidationResult($"属性类型'{validationContext.MemberName}'不是有效的枚举类型!");
|
||||
|
||||
// 检查枚举值是否有效
|
||||
if (value == null && Nullable.GetUnderlyingType(property.PropertyType) == null)
|
||||
return new ValidationResult($"提示:{ErrorMessage}|枚举值不能为 null!");
|
||||
|
||||
if (value != null && !Enum.IsDefined(propertyType, value))
|
||||
return new ValidationResult($"提示:{ErrorMessage}|枚举值【{value}】不是有效的【{propertyType.Name}】枚举类型值!");
|
||||
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 防止重复请求过滤器特性(此特性使用了分布式锁,需确保系统支持分布式锁)
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
|
||||
public class IdempotentAttribute : Attribute, IAsyncActionFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求间隔时间/秒
|
||||
/// </summary>
|
||||
public int IntervalTime { get; set; } = 5;
|
||||
|
||||
/// <summary>
|
||||
/// 错误提示内容
|
||||
/// </summary>
|
||||
public string Message { get; set; } = "你操作频率过快,请稍后重试!";
|
||||
|
||||
/// <summary>
|
||||
/// 缓存前缀: Key+请求路由+用户Id+请求参数
|
||||
/// </summary>
|
||||
public string CacheKey { get; set; } = CacheConst.KeyIdempotent;
|
||||
|
||||
/// <summary>
|
||||
/// 是否直接抛出异常:Ture是,False返回上次请求结果
|
||||
/// </summary>
|
||||
public bool ThrowBah { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 锁前缀
|
||||
/// </summary>
|
||||
public string LockPrefix { get; set; } = "lock_";
|
||||
|
||||
public IdempotentAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
||||
{
|
||||
var httpContext = context.HttpContext;
|
||||
var path = httpContext.Request.Path.Value.ToString();
|
||||
var userId = httpContext.User?.FindFirstValue(ClaimConst.UserId);
|
||||
var cacheExpireTime = TimeSpan.FromSeconds(IntervalTime);
|
||||
|
||||
var parameters = JsonConvert.SerializeObject(context.ActionArguments, Formatting.None, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Include,
|
||||
DefaultValueHandling = DefaultValueHandling.Include
|
||||
});
|
||||
|
||||
var cacheKey = CacheKey + MD5Encryption.Encrypt($"{path}{userId}{parameters}");
|
||||
var sysCacheService = httpContext.RequestServices.GetService<SysCacheService>();
|
||||
try
|
||||
{
|
||||
// 分布式锁
|
||||
using var distributedLock = sysCacheService.BeginCacheLock($"{LockPrefix}{cacheKey}") ?? throw Oops.Oh(Message);
|
||||
|
||||
var cacheValue = sysCacheService.Get<ResponseData>(cacheKey);
|
||||
if (cacheValue != null)
|
||||
{
|
||||
if (ThrowBah) throw Oops.Oh(Message);
|
||||
context.Result = new ObjectResult(cacheValue.Value);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
var resultContext = await next();
|
||||
// 缓存请求结果,null值不缓存
|
||||
if (resultContext.Result is ObjectResult { Value: { } } objectResult)
|
||||
{
|
||||
var typeName = objectResult.Value.GetType().Name;
|
||||
var responseData = new ResponseData
|
||||
{
|
||||
Type = typeName,
|
||||
Value = objectResult.Value
|
||||
};
|
||||
sysCacheService.Set(cacheKey, responseData, cacheExpireTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw Oops.Oh($"{Message}-{ex}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求结果数据
|
||||
/// </summary>
|
||||
private class ResponseData
|
||||
{
|
||||
/// <summary>
|
||||
/// 结果类型
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求结果
|
||||
/// </summary>
|
||||
public dynamic Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 忽略枚举类型转字典特性(标记在枚举类型)
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Enum, AllowMultiple = true, Inherited = true)]
|
||||
public class IgnoreEnumToDictAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 忽略表结构初始化特性(标记在实体)
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public class IgnoreTableAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 忽略更新种子特性(标记在种子类)
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public class IgnoreUpdateSeedAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 忽略更新种子列特性(标记在实体属性)
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
|
||||
public class IgnoreUpdateSeedColumnAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 属性字典配置
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class ImportDictAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典Code
|
||||
/// </summary>
|
||||
public string TypeCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 目标对象名称
|
||||
/// </summary>
|
||||
public string TargetPropName { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 增量种子特性
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public class IncreSeedAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 增量表特性
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public class IncreTableAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 日志表特性
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public class LogTableAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 字符串掩码
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class MaskNewtonsoftJsonConverter : JsonConverter<string>
|
||||
{
|
||||
public override string ReadJson(JsonReader reader, Type objectType, string existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return reader.Value.ToString();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, string value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(value?.ToString().Mask());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 身份证掩码
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class MaskIdCardNewtonsoftJsonConverter : JsonConverter<string>
|
||||
{
|
||||
public override string ReadJson(JsonReader reader, Type objectType, string existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return reader.Value.ToString();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, string value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(value?.ToString().MaskIdCard());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱掩码
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class MaskEmailNewtonsoftJsonConverter : JsonConverter<string>
|
||||
{
|
||||
public override string ReadJson(JsonReader reader, Type objectType, string existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return reader.Value.ToString();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, string value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(value?.ToString().MaskEmail());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 字符串掩码
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class MaskSystemTextJsonConverter : JsonConverter<string>
|
||||
{
|
||||
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return reader.GetString();
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStringValue(value?.ToString().Mask());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 身份证掩码
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class MaskIdCardSystemTextJsonConverter : JsonConverter<string>
|
||||
{
|
||||
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return reader.GetString();
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStringValue(value?.ToString().MaskIdCard());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱掩码
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class MaskEmailSystemTextJsonConverter : JsonConverter<string>
|
||||
{
|
||||
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return reader.GetString();
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStringValue(value?.ToString().MaskEmail());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 最大值校验
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class MaxValueAttribute : ValidationAttribute
|
||||
{
|
||||
private double MaxValue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大值
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public MaxValueAttribute(double value) => this.MaxValue = value;
|
||||
|
||||
/// <summary>
|
||||
/// 最大值校验
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override bool IsValid(object value)
|
||||
{
|
||||
return value == null || Convert.ToDouble(value) <= this.MaxValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public override string FormatErrorMessage(string name) => base.FormatErrorMessage(name);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 最小值校验
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class MinValueAttribute : ValidationAttribute
|
||||
{
|
||||
private double MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小值
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public MinValueAttribute(double value) => this.MinValue = value;
|
||||
|
||||
/// <summary>
|
||||
/// 最小值校验
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override bool IsValid(object value)
|
||||
{
|
||||
return value == null || Convert.ToDouble(value) > this.MinValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public override string FormatErrorMessage(string name) => base.FormatErrorMessage(name);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 校验集合不能为空
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class NotEmptyAttribute : ValidationAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 校验集合不能为空
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override bool IsValid(object value) => (value as IEnumerable)?.GetEnumerator().MoveNext() ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public override string FormatErrorMessage(string name) => base.FormatErrorMessage(name);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 所属机构数据权限
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
|
||||
public class OwnerOrgAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 所属用户数据权限
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
|
||||
public class OwnerUserAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 种子数据特性
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public class SeedDataAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 排序(越大越后执行)
|
||||
/// </summary>
|
||||
public int Order { get; set; } = 0;
|
||||
|
||||
public SeedDataAttribute(int orderNo)
|
||||
{
|
||||
Order = orderNo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 系统表特性
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public class SysTableAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 枚举拓展主题样式
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Field)]
|
||||
public class ThemeAttribute : Attribute
|
||||
{
|
||||
public string Theme { get; private set; }
|
||||
|
||||
public ThemeAttribute(string theme)
|
||||
{
|
||||
this.Theme = theme;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user