ow
This commit is contained in:
1 parent
31fbe199c1
commit
1c0c83af5f
469 files changed
+62544
-5
No files matched your search
@@ -0,0 +1,140 @@
|
||||
using CloudBuilder.Core.Application.Options;
|
||||
using CloudBuilder.Core.Application.Packs;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Builders
|
||||
{
|
||||
/// <summary>
|
||||
/// CloudBuilder构建器
|
||||
/// </summary>
|
||||
public class CloudBuilderBuilder
|
||||
{
|
||||
public CloudBuilderBuilder(IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
this.Services = services;
|
||||
AddOptions(configuration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取 服务集合
|
||||
/// </summary>
|
||||
public IServiceCollection Services { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取 CloudBuilder选项配置委托
|
||||
/// </summary>
|
||||
public CloudBuilderOptions CloudBuilderOptions { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 添加所有模块
|
||||
/// </summary>
|
||||
/// <typeparam name="TPack">要添加的模块类型</typeparam>
|
||||
public CloudBuilderBuilder AddPack()
|
||||
{
|
||||
var baseType = typeof(CloudBuilderPack);
|
||||
|
||||
var allAssemblies = GetAssemblies();
|
||||
|
||||
var types = allAssemblies
|
||||
.SelectMany(a => a.DefinedTypes)
|
||||
.Select(type => type.AsType())
|
||||
.Where(type => type != baseType && baseType.IsAssignableFrom(type))
|
||||
.Where(x => x.IsClass)
|
||||
.OrderBy(x => x.GetCustomAttribute<PackLevelAttribute>()?.Level).ToList();
|
||||
|
||||
foreach (var implementType in types)
|
||||
{
|
||||
if (Services.Any(m => m.ServiceType == baseType && m.ImplementationType == implementType))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//注入CloudBuilderPack模块内的服务
|
||||
CloudBuilderPack pack = (CloudBuilderPack)Activator.CreateInstance(
|
||||
implementType,
|
||||
BindingFlags.Public | BindingFlags.Instance,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
|
||||
pack.AddServices(Services, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加CloudBuilder选项配置
|
||||
/// </summary>
|
||||
/// <param name="optionsAction">CloudBuilder操作选项</param>
|
||||
/// <returns>CloudBuilder构建器</returns>
|
||||
public CloudBuilderBuilder AddOptions(IConfiguration configuration)
|
||||
{
|
||||
CloudBuilderOptions options = new CloudBuilderOptions();
|
||||
new CloudBuilderOptionsSetup(configuration).Configure(options);
|
||||
|
||||
CloudBuilderOptions = options;
|
||||
return this;
|
||||
}
|
||||
|
||||
public T GetTransientService<T>()
|
||||
{
|
||||
object? t = Services.BuildServiceProvider().GetService(typeof(T));
|
||||
if (t == null) return default(T)!;
|
||||
return (T)t;
|
||||
}
|
||||
|
||||
public T GetTransientRequiredService<T>()
|
||||
{
|
||||
return (T)Services.BuildServiceProvider().GetRequiredService(typeof(T));
|
||||
}
|
||||
|
||||
public static Assembly[] GetAssemblies()
|
||||
{
|
||||
// 获取入口程序集
|
||||
var entryAssembly = Assembly.GetEntryAssembly();
|
||||
List<string> reference = new List<string>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(entryAssembly.Location))
|
||||
{
|
||||
var dependencyContext = DependencyContext.Default;
|
||||
|
||||
// 读取项目程序集或 Furion 官方发布的包,或手动添加引用的dll,或配置特定的包前缀
|
||||
reference = dependencyContext.RuntimeLibraries
|
||||
.Where(u => u.Type == "project" || u.Type == "reference")
|
||||
.Select(x => x.Name).ToList();
|
||||
}
|
||||
|
||||
string[] filters =
|
||||
{
|
||||
"mscorlib",
|
||||
"netstandard",
|
||||
"dotnet",
|
||||
"api-ms-win-core",
|
||||
"runtime.",
|
||||
"System",
|
||||
"Microsoft",
|
||||
"Window",
|
||||
};
|
||||
|
||||
//遍历文件夹的方式,用于传统.netfx
|
||||
string path = AppContext.BaseDirectory;
|
||||
string[] files = Directory.GetFiles(path, "*.dll", SearchOption.TopDirectoryOnly)
|
||||
.Where(x => reference.Contains(Path.GetFileNameWithoutExtension(x))).ToArray();
|
||||
|
||||
return files.Where(file => filters.All(token => Path.GetFileName(file)?.StartsWith(token) != true)).Select(Assembly.LoadFrom).ToArray();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Options
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据上下文配置节点
|
||||
/// </summary>
|
||||
public class CloudBuilderDbContextOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化一个<see cref="CloudBuilderDbContextOptions"/>类型的新实例
|
||||
/// </summary>
|
||||
public CloudBuilderDbContextOptions()
|
||||
{
|
||||
LazyLoadingProxiesEnabled = false;
|
||||
AuditEntityEnabled = false;
|
||||
AutoMigrationEnabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 上下文类型全名
|
||||
/// </summary>
|
||||
public string DbContextTypeName { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 连接字符串
|
||||
/// </summary>
|
||||
public string ConnectionString { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 数据库类型
|
||||
/// </summary>
|
||||
public DatabaseType DatabaseType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 是否启用延迟加载代理
|
||||
/// </summary>
|
||||
public bool LazyLoadingProxiesEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 是否允许审计实体
|
||||
/// </summary>
|
||||
public bool AuditEntityEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 是否自动迁移
|
||||
/// </summary>
|
||||
public bool AutoMigrationEnabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Options
|
||||
{
|
||||
/// <summary>
|
||||
/// CloudBuilder框架配置选项信息
|
||||
/// </summary>
|
||||
public class CloudBuilderOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化一个<see cref="CloudBuilderOptions"/>类型的新实例
|
||||
/// </summary>
|
||||
public CloudBuilderOptions()
|
||||
{
|
||||
DbContexts = new ConcurrentDictionary<string, CloudBuilderDbContextOptions>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取 数据上下文配置信息
|
||||
/// </summary>
|
||||
public IDictionary<string, CloudBuilderDbContextOptions> DbContexts { get; }
|
||||
|
||||
///// <summary>
|
||||
///// 获取 第三方OAuth2登录配置信息
|
||||
///// </summary>
|
||||
//public IDictionary<string, OAuth2Options> OAuth2S { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 邮件发送选项
|
||||
/// </summary>
|
||||
public MailSenderOptions MailSender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 全局授权
|
||||
/// </summary>
|
||||
public bool EnableGlobalAuthorize { get; set; }
|
||||
/// <summary>
|
||||
/// 获取或设置 JWT身份认证选项
|
||||
/// </summary>
|
||||
public JwtOptions Jwt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 Redis选项
|
||||
/// </summary>
|
||||
public RedisOptions Redis { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 获取或设置 Swagger选项
|
||||
///// </summary>
|
||||
//public SwaggerOptions Swagger { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 获取或设置 Http传输加密选项
|
||||
///// </summary>
|
||||
//public HttpEncryptOptions HttpEncrypt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定上下文类和指定数据库类型的上下文配置信息
|
||||
/// </summary>
|
||||
public CloudBuilderDbContextOptions GetDbContextOptions(string dbContextType)
|
||||
{
|
||||
return DbContexts.Values.SingleOrDefault(m => m.DbContextTypeName == dbContextType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
using CloudBuilder.Core.Extensions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Options
|
||||
{
|
||||
/// <summary>
|
||||
/// CloudBuilder配置选项创建器
|
||||
/// </summary>
|
||||
public class CloudBuilderOptionsSetup : IConfigureOptions<CloudBuilderOptions>
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化一个<see cref="CloudBuilderOptionsSetup"/>类型的新实例
|
||||
/// </summary>
|
||||
public CloudBuilderOptionsSetup(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>Invoked to configure a TOptions instance.</summary>
|
||||
/// <param name="options">The options instance to configure.</param>
|
||||
public void Configure(CloudBuilderOptions options)
|
||||
{
|
||||
SetDbContextOptions(options);
|
||||
|
||||
IConfigurationSection section;
|
||||
|
||||
//MailSender
|
||||
section = _configuration.GetSection("CloudBuilder:MailSender");
|
||||
MailSenderOptions sender = section.Get<MailSenderOptions>();
|
||||
if (sender != null)
|
||||
{
|
||||
if (sender.Password == null)
|
||||
{
|
||||
sender.Password = _configuration["CloudBuilder:MailSender:Password"];
|
||||
}
|
||||
options.MailSender = sender;
|
||||
}
|
||||
|
||||
//EnableGlobalAuthorize
|
||||
section = _configuration.GetSection("CloudBuilder:Authorization:EnableGlobalAuthorize");
|
||||
options.EnableGlobalAuthorize = section.Get<bool>();
|
||||
|
||||
//JwtOptions
|
||||
section = _configuration.GetSection("CloudBuilder:Jwt");
|
||||
JwtOptions jwt = section.Get<JwtOptions>();
|
||||
if (jwt != null)
|
||||
{
|
||||
if (jwt.Secret == null)
|
||||
{
|
||||
jwt.Secret = _configuration["CloudBuilder:Jwt:Secret"];
|
||||
}
|
||||
options.Jwt = jwt;
|
||||
}
|
||||
|
||||
// RedisOptions
|
||||
section = _configuration.GetSection("CloudBuilder:Redis");
|
||||
RedisOptions redis = section.Get<RedisOptions>();
|
||||
if (redis != null)
|
||||
{
|
||||
if (redis.Configuration.IsMissing())
|
||||
{
|
||||
throw new Exception("配置文件中Redis节点的Configuration不能为空");
|
||||
}
|
||||
options.Redis = redis;
|
||||
}
|
||||
|
||||
//// SwaggerOptions
|
||||
//section = _configuration.GetSection("CloudBuilder:Swagger");
|
||||
//SwaggerOptions swagger = section.Get<SwaggerOptions>();
|
||||
//if (swagger != null)
|
||||
//{
|
||||
// if (swagger.Url.IsMissing())
|
||||
// {
|
||||
// throw new CloudBuilderException("配置文件中Swagger节点的Url不能为空");
|
||||
// }
|
||||
// options.Swagger = swagger;
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化上下文配置信息,首先以CloudBuilder配置节点中的为准,
|
||||
/// 不存在CloudBuilder节点,才使用ConnectionStrings的数据连接串来构造SqlServer的配置,
|
||||
/// 保证同一上下文类型只有一个配置节点
|
||||
/// </summary>
|
||||
/// <param name="options"></param>
|
||||
private void SetDbContextOptions(CloudBuilderOptions options)
|
||||
{
|
||||
IConfigurationSection section = _configuration.GetSection("CloudBuilder:DbContexts");
|
||||
IDictionary<string, CloudBuilderDbContextOptions> dict = section.Get<Dictionary<string, CloudBuilderDbContextOptions>>();
|
||||
|
||||
var repeated = dict.Values.GroupBy(m => m.DbContextTypeName).FirstOrDefault(m => m.Count() > 1);
|
||||
if (repeated != null)
|
||||
{
|
||||
throw new Exception($"数据上下文配置中存在多个配置节点指向同一个上下文类型:{repeated.First().DbContextTypeName}");
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, CloudBuilderDbContextOptions> pair in dict)
|
||||
{
|
||||
options.DbContexts.Add(pair.Key, pair.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Options
|
||||
{
|
||||
/// <summary>
|
||||
/// JWT身份认证选项
|
||||
/// </summary>
|
||||
public class JwtOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置 密钥
|
||||
/// </summary>
|
||||
public string Secret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 发行方
|
||||
/// </summary>
|
||||
public string Issuer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 订阅方
|
||||
/// </summary>
|
||||
public string Audience { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 AccessToken有效期分钟数
|
||||
/// </summary>
|
||||
public double AccessExpireMins { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 RefreshToken有效期分钟数
|
||||
/// </summary>
|
||||
public double RefreshExpireMins { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 RefreshToken是否绝对过期
|
||||
/// </summary>
|
||||
public bool IsRefreshAbsoluteExpired { get; set; } = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Options
|
||||
{
|
||||
/// <summary>
|
||||
/// 邮件发送选项
|
||||
/// </summary>
|
||||
public class MailSenderOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置 邮件发送服务器
|
||||
/// </summary>
|
||||
public string Host { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 端口
|
||||
/// </summary>
|
||||
public int Port { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 是否SSL
|
||||
/// </summary>
|
||||
public bool EnableSsl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 发送方显示名
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 发送方用户名
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 发送方密码
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Options
|
||||
{
|
||||
/// <summary>
|
||||
/// Redis选项
|
||||
/// </summary>
|
||||
public class RedisOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置 Redis连接配置
|
||||
/// </summary>
|
||||
public string Configuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 Redis实例名称
|
||||
/// </summary>
|
||||
public string InstanceName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using CloudBuilder.Core.Application.Builders;
|
||||
using CloudBuilder.Core.Application.Options;
|
||||
using CloudBuilder.Core.DatabaseAccessor;
|
||||
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Packs
|
||||
{
|
||||
/// <summary>
|
||||
/// CloudBuilder核心模块
|
||||
/// </summary>
|
||||
[Description("CloudBuilder核心模块")]
|
||||
[PackLevel(0)]
|
||||
public class CloudBuilderCorePack : CloudBuilderPack
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 模块级别
|
||||
/// </summary>
|
||||
public override PackLevel Level => PackLevel.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 将全局应用添加到依赖注入服务容器中
|
||||
/// </summary>
|
||||
/// <param name="services">依赖注入服务容器</param>
|
||||
/// <returns></returns>
|
||||
public override IServiceCollection AddServices(IServiceCollection services, CloudBuilderBuilder builder)
|
||||
{
|
||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
services.AddSingleton(new WebService(services));
|
||||
|
||||
services.AddScoped<IApplicationService, ApplicationService>();
|
||||
|
||||
//services.TryAddSingleton<IInputDtoTypeFinder, InputDtoTypeFinder>();
|
||||
//services.TryAddSingleton<IOutputDtoTypeFinder, OutputDtoTypeFinder>();
|
||||
//services.TryAddSingleton<ICancellationTokenProvider, NoneCancellationTokenProvider>();
|
||||
//services.TryAddSingleton<IEmailSender, DefaultEmailSender>();
|
||||
|
||||
//services.TryAddSingleton<ICacheService, CacheService>();
|
||||
//services.TryAddScoped<IFilterService, FilterService>();
|
||||
|
||||
//services.TryAddTransient<IClientHttpCrypto, ClientHttpCrypto>();
|
||||
//services.AddTransient<ClientHttpCryptoHandler>();
|
||||
|
||||
//services.AddDistributedMemoryCache();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using CloudBuilder.Core.Application.Builders;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Packs
|
||||
{
|
||||
/// <summary>
|
||||
/// CloudBuilder模块基类
|
||||
/// </summary>
|
||||
public abstract class CloudBuilderPack
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 模块级别,级别越小越先启动
|
||||
/// </summary>
|
||||
public virtual PackLevel Level => PackLevel.Business;
|
||||
|
||||
/// <summary>
|
||||
/// 获取 模块启动顺序,模块启动的顺序先按级别启动,同一级别内部再按此顺序启动,
|
||||
/// 级别默认为0,表示无依赖,需要在同级别有依赖顺序的时候,再重写为>0的顺序值
|
||||
/// </summary>
|
||||
public virtual int Order => 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取 是否已可用
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// 将模块服务添加到依赖注入服务容器中
|
||||
/// </summary>
|
||||
/// <param name="services">依赖注入服务容器</param>
|
||||
/// <returns></returns>
|
||||
public virtual IServiceCollection AddServices(IServiceCollection services, CloudBuilderBuilder builder)
|
||||
{
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用模块服务
|
||||
/// </summary>
|
||||
/// <param name="provider">服务提供者</param>
|
||||
public virtual void UsePack(IServiceProvider provider)
|
||||
{
|
||||
IsEnabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Packs
|
||||
{
|
||||
/// <summary>
|
||||
/// 模块级别,级别越核心,优先启动
|
||||
/// </summary>
|
||||
public enum PackLevel
|
||||
{
|
||||
/// <summary>
|
||||
/// 核心级别,表示系统的核心模块,
|
||||
/// 这些模块不涉及第三方组件,在系统运行中是不可替换的,核心模块将始终加载
|
||||
/// </summary>
|
||||
Core = 1,
|
||||
/// <summary>
|
||||
/// 框架级别,表示涉及第三方组件的基础模块
|
||||
/// </summary>
|
||||
Framework = 10,
|
||||
/// <summary>
|
||||
/// 应用级别,表示涉及应用数据的基础模块
|
||||
/// </summary>
|
||||
Application = 20,
|
||||
/// <summary>
|
||||
/// 业务级别,表示涉及真实业务处理的模块
|
||||
/// </summary>
|
||||
Business = 30
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Application.Packs
|
||||
{
|
||||
public class PackLevelAttribute : Attribute
|
||||
{
|
||||
public PackLevelAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
public PackLevelAttribute(int level)
|
||||
{
|
||||
this.Level = level;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取权限名称
|
||||
/// </summary>
|
||||
public int Level { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user