From 6a7556fb73a70b24343c93b51cdaff90542d94f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=81=B5=E7=87=95=E7=A9=BA=E9=97=B4?= <1321180895@qq.com>
Date: Mon, 24 Mar 2025 18:12:35 +0800
Subject: [PATCH 01/17] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=A4=9A=E7=A7=9F?=
=?UTF-8?q?=E6=88=B7=E3=80=81=E6=89=A9=E5=B1=95=E5=88=86=E5=BA=93=E5=88=86?=
=?UTF-8?q?=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DbAccess/Impl/SimpleEntityScaner.cs | 68 ++++++++++++++
.../DbAccess/Impl/TenantBaseDbContext.cs | 50 +++++++++++
.../DbAccess/Impl/TenantEntityBuilder.cs | 61 +++++++++++++
.../DbAccess/Interface/IEntityScaner.cs | 11 +++
.../DbAccess/Interface/ITenantDbContext.cs | 9 ++
.../Interface/ITenantEntityBuilder.cs | 25 ++++++
.../DbAccess/TenantModelCacheKey.cs | 56 ++++++++++++
.../DbAccess/TenantModelCacheKeyFactory.cs | 32 +++++++
.../Models/ConnectionResolverType.cs | 28 ++++++
.../Models/DbIntegrationType.cs | 10 +++
.../DbMultiTenants/Models/DbsetProperty.cs | 18 ++++
.../DbMultiTenants/Models/TenantInfo.cs | 89 +++++++++++++++++++
.../DbMultiTenants/Models/TenantOption.cs | 43 +++++++++
13 files changed, 500 insertions(+)
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/SimpleEntityScaner.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/TenantBaseDbContext.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/TenantEntityBuilder.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/IEntityScaner.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/ITenantDbContext.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/ITenantEntityBuilder.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbAccess/TenantModelCacheKey.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbAccess/TenantModelCacheKeyFactory.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Models/ConnectionResolverType.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Models/DbIntegrationType.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Models/DbsetProperty.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Models/TenantInfo.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Models/TenantOption.cs
diff --git a/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/SimpleEntityScaner.cs b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/SimpleEntityScaner.cs
new file mode 100644
index 0000000..49e8bf0
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/SimpleEntityScaner.cs
@@ -0,0 +1,68 @@
+using LingYanAspCoreFramework.DbMultiTenants.Models;
+using Microsoft.EntityFrameworkCore;
+using System.Reflection;
+
+namespace LingYanAspCoreFramework.DbMultiTenants.DbAccess
+{
+ ///
+ /// 简单实体扫描器类,用于扫描数据库上下文中的实体类型
+ ///
+ /// 数据库上下文类型
+ public class SimpleEntityScaner : IEntityScaner
+ where TDbContext : DbContext
+ {
+ private static List dbProperties;
+ private static readonly object locker = new object();
+
+ ///
+ /// 扫描数据库上下文中的实体类型
+ ///
+ /// 实体属性列表
+ public IList ScanEntityTypes()
+ {
+ if (dbProperties == null)
+ {
+ lock (locker)
+ {
+ if (dbProperties == null)
+ {
+ var contextType = typeof(TDbContext);
+ var properties = contextType.GetProperties();
+ var entityProperties = properties.Where(r => IsDbSet(r)).ToList();
+
+ dbProperties = new List();
+ foreach (var property in entityProperties)
+ {
+ dbProperties.Add(new DbsetProperty
+ {
+ PropertyName = property.Name,
+ PropertyType = property.PropertyType.GetGenericArguments()[0]
+ });
+ }
+ }
+ }
+ }
+ return dbProperties;
+ }
+
+ ///
+ /// 判断属性是否为 DbSet 类型
+ ///
+ /// 属性信息
+ /// 如果是 DbSet 类型,返回 true;否则返回 false
+ private bool IsDbSet(PropertyInfo property)
+ {
+ if (property.CanRead && property.PropertyType.IsGenericType
+ && typeof(DbSet<>).GetGenericTypeDefinition().Equals(property.PropertyType.GetGenericTypeDefinition()))
+ {
+ return true;
+ }
+ return false;
+ }
+ }
+}
+
+
+
+
+
diff --git a/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/TenantBaseDbContext.cs b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/TenantBaseDbContext.cs
new file mode 100644
index 0000000..fdddc65
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/TenantBaseDbContext.cs
@@ -0,0 +1,50 @@
+using LingYanAspCoreFramework.DbMultiTenants.Models;
+using Microsoft.EntityFrameworkCore;
+
+namespace LingYanAspCoreFramework.DbMultiTenants.DbAccess
+{
+ ///
+ /// 表示租户基础数据库上下文的抽象类
+ ///
+ public abstract class TenantBaseDbContext : DbContext, ITenantDbContext
+ {
+ ///
+ /// 获取或设置租户信息
+ ///
+ public TenantInfo Tenant { get; protected internal set; }
+
+ private readonly IServiceProvider serviceProvider;
+
+ ///
+ /// 初始化 TenantBaseDbContext 类的新实例
+ ///
+ /// 数据库上下文选项
+ /// 租户信息
+ /// 服务提供程序
+ public TenantBaseDbContext(DbContextOptions options, TenantInfo tenant, IServiceProvider serviceProvider)
+ : base(options)
+ {
+ this.serviceProvider = serviceProvider;
+ this.Tenant = tenant;
+ }
+
+ ///
+ /// 配置模型
+ ///
+ /// 模型构建器
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ var builderType = typeof(ITenantEntityBuilder<>).MakeGenericType(this.GetType());
+
+ ITenantEntityBuilder entityBuilder = (ITenantEntityBuilder)serviceProvider.GetService(builderType);
+
+ entityBuilder.UpdateEntities(modelBuilder);
+ }
+ }
+}
+
+
+
+
+
+
diff --git a/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/TenantEntityBuilder.cs b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/TenantEntityBuilder.cs
new file mode 100644
index 0000000..309e6aa
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Impl/TenantEntityBuilder.cs
@@ -0,0 +1,61 @@
+using LingYanAspCoreFramework.DbMultiTenants.Models;
+using Microsoft.EntityFrameworkCore;
+
+namespace LingYanAspCoreFramework.DbMultiTenants.DbAccess
+{
+ ///
+ /// 表示租户实体构建器的类
+ ///
+ /// 数据库上下文类型
+ public class TenantEntityBuilder : ITenantEntityBuilder
+ where TDbContext : DbContext
+ {
+ private readonly IEntityScaner entityScaner;
+ private readonly TenantOption tenantOption;
+ private readonly TenantInfo tenantInfo;
+
+ ///
+ /// 初始化 TenantEntityBuilder 类的新实例
+ ///
+ /// 实体扫描器
+ /// 租户选项
+ /// 租户信息
+ public TenantEntityBuilder(IEntityScaner entityScaner, TenantOption tenantOption, TenantInfo tenantInfo)
+ {
+ this.tenantInfo = tenantInfo;
+ this.tenantOption = tenantOption;
+ this.entityScaner = entityScaner;
+ }
+
+ ///
+ /// 更新实体模型
+ ///
+ /// 模型构建器
+ public void UpdateEntities(ModelBuilder modelBuilder)
+ {
+ var dbsetProperties = entityScaner.ScanEntityTypes();
+
+ foreach (var property in dbsetProperties)
+ {
+ var entity = modelBuilder.Entity(property.PropertyType);
+ switch (this.tenantOption.ConnectionType)
+ {
+ case ConnectionResolverType.BySchema:
+ var tableName = this.tenantOption.TableNameFunc?.Invoke(this.tenantInfo, property.PropertyName)
+ ?? property.PropertyName;
+ var schemaName = this.tenantOption.SchemaFunc?.Invoke(this.tenantInfo)
+ ?? this.tenantInfo.Name;
+ entity.ToTable(tableName, schemaName);
+ break;
+ case ConnectionResolverType.ByTable:
+ tableName = this.tenantOption.TableNameFunc?.Invoke(this.tenantInfo, property.PropertyName)
+ ?? $"{this.tenantInfo.Name}_{property.PropertyName}";
+ entity.ToTable(tableName);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/IEntityScaner.cs b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/IEntityScaner.cs
new file mode 100644
index 0000000..c75bda3
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/IEntityScaner.cs
@@ -0,0 +1,11 @@
+using LingYanAspCoreFramework.DbMultiTenants.Models;
+using Microsoft.EntityFrameworkCore;
+
+namespace LingYanAspCoreFramework.DbMultiTenants.DbAccess
+{
+ public interface IEntityScaner
+ where TDbContext : DbContext
+ {
+ IList ScanEntityTypes();
+ }
+}
diff --git a/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/ITenantDbContext.cs b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/ITenantDbContext.cs
new file mode 100644
index 0000000..be620a3
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/ITenantDbContext.cs
@@ -0,0 +1,9 @@
+using LingYanAspCoreFramework.DbMultiTenants.Models;
+
+namespace LingYanAspCoreFramework.DbMultiTenants.DbAccess
+{
+ public interface ITenantDbContext
+ {
+ TenantInfo Tenant { get;}
+ }
+}
diff --git a/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/ITenantEntityBuilder.cs b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/ITenantEntityBuilder.cs
new file mode 100644
index 0000000..fc7f1a9
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/Interface/ITenantEntityBuilder.cs
@@ -0,0 +1,25 @@
+using Microsoft.EntityFrameworkCore;
+
+namespace LingYanAspCoreFramework.DbMultiTenants.DbAccess
+{
+ ///
+ /// 表示租户实体构建器的接口
+ ///
+ public interface ITenantEntityBuilder
+ {
+ ///
+ /// 更新实体模型
+ ///
+ /// 模型构建器
+ void UpdateEntities(ModelBuilder modelBuilder);
+ }
+
+ ///
+ /// 表示特定数据库上下文类型的租户实体构建器的接口
+ ///
+ /// 数据库上下文类型
+ public interface ITenantEntityBuilder : ITenantEntityBuilder
+ where TDbContext : DbContext
+ {
+ }
+}
diff --git a/LingYanAspCoreFramework/DbMultiTenants/DbAccess/TenantModelCacheKey.cs b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/TenantModelCacheKey.cs
new file mode 100644
index 0000000..6a4e2e7
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/TenantModelCacheKey.cs
@@ -0,0 +1,56 @@
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+
+namespace LingYanAspCoreFramework.DbMultiTenants.DbAccess
+{
+ ///
+ /// 表示租户模型缓存键的类
+ ///
+ /// 数据库上下文类型
+ internal sealed class TenantModelCacheKey : ModelCacheKey
+ where TDbContext : DbContext, ITenantDbContext
+ {
+ private readonly TDbContext context;
+ private readonly string identifier;
+
+ ///
+ /// 初始化 TenantModelCacheKey 类的新实例
+ ///
+ /// 数据库上下文
+ /// 租户标识符
+ public TenantModelCacheKey(TDbContext context, string identifier) : base(context)
+ {
+ this.context = context;
+ this.identifier = identifier;
+ }
+
+ ///
+ /// 确定当前对象是否等于另一个对象
+ ///
+ /// 要与当前对象进行比较的对象
+ /// 如果相等,返回 true;否则返回 false
+ protected override bool Equals(ModelCacheKey other)
+ {
+ return base.Equals(other) && (other as TenantModelCacheKey)?.identifier == identifier;
+ }
+
+ ///
+ /// 返回当前对象的哈希代码
+ ///
+ /// 当前对象的哈希代码
+ public override int GetHashCode()
+ {
+ var hashCode = base.GetHashCode();
+ if (identifier != null)
+ {
+ hashCode ^= identifier.GetHashCode();
+ }
+
+ return hashCode;
+ }
+ }
+}
+
+
+
+
diff --git a/LingYanAspCoreFramework/DbMultiTenants/DbAccess/TenantModelCacheKeyFactory.cs b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/TenantModelCacheKeyFactory.cs
new file mode 100644
index 0000000..cbb23fa
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/DbAccess/TenantModelCacheKeyFactory.cs
@@ -0,0 +1,32 @@
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+
+namespace LingYanAspCoreFramework.DbMultiTenants.DbAccess
+{
+ ///
+ /// 表示租户模型缓存键工厂的类
+ ///
+ /// 数据库上下文类型
+ public sealed class TenantModelCacheKeyFactory : ModelCacheKeyFactory
+ where TDbContext : DbContext, ITenantDbContext
+ {
+ ///
+ /// 初始化 TenantModelCacheKeyFactory 类的新实例
+ ///
+ /// 模型缓存键工厂的依赖项
+ public TenantModelCacheKeyFactory(ModelCacheKeyFactoryDependencies dependencies) : base(dependencies)
+ {
+ }
+
+ ///
+ /// 创建模型缓存键
+ ///
+ /// 数据库上下文
+ /// 模型缓存键对象
+ public override object Create(DbContext context)
+ {
+ var dbContext = context as TDbContext;
+ return new TenantModelCacheKey(dbContext, dbContext?.Tenant?.Name ?? "no_tenant_identifier");
+ }
+ }
+}
diff --git a/LingYanAspCoreFramework/DbMultiTenants/Models/ConnectionResolverType.cs b/LingYanAspCoreFramework/DbMultiTenants/Models/ConnectionResolverType.cs
new file mode 100644
index 0000000..5811c8c
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/Models/ConnectionResolverType.cs
@@ -0,0 +1,28 @@
+namespace LingYanAspCoreFramework.DbMultiTenants.Models
+{
+ ///
+ /// 表示连接解析器类型的枚举
+ ///
+ public enum ConnectionResolverType
+ {
+ ///
+ /// 默认连接解析器类型
+ ///
+ Default = 0,
+
+ ///
+ /// 按数据库解析连接
+ ///
+ ByDatabase = 1,
+
+ ///
+ /// 按表解析连接
+ ///
+ ByTable = 2,
+
+ ///
+ /// 按模式解析连接
+ ///
+ BySchema = 3
+ }
+}
diff --git a/LingYanAspCoreFramework/DbMultiTenants/Models/DbIntegrationType.cs b/LingYanAspCoreFramework/DbMultiTenants/Models/DbIntegrationType.cs
new file mode 100644
index 0000000..4a24d54
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/Models/DbIntegrationType.cs
@@ -0,0 +1,10 @@
+namespace LingYanAspCoreFramework.DbMultiTenants.Models
+{
+ public enum DbIntegrationType
+ {
+ None = 0,
+ Mysql = 1,
+ SqlServer = 2,
+ Postgre = 3,
+ }
+}
diff --git a/LingYanAspCoreFramework/DbMultiTenants/Models/DbsetProperty.cs b/LingYanAspCoreFramework/DbMultiTenants/Models/DbsetProperty.cs
new file mode 100644
index 0000000..f040560
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/Models/DbsetProperty.cs
@@ -0,0 +1,18 @@
+namespace LingYanAspCoreFramework.DbMultiTenants.Models
+{
+ ///
+ /// 表示数据库集属性的类
+ ///
+ public class DbsetProperty
+ {
+ ///
+ /// 属性的类型
+ ///
+ public Type PropertyType { get; set; }
+
+ ///
+ /// 属性的名称
+ ///
+ public string PropertyName { get; set; }
+ }
+}
diff --git a/LingYanAspCoreFramework/DbMultiTenants/Models/TenantInfo.cs b/LingYanAspCoreFramework/DbMultiTenants/Models/TenantInfo.cs
new file mode 100644
index 0000000..e0b475b
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/Models/TenantInfo.cs
@@ -0,0 +1,89 @@
+锘縰sing System.Dynamic;
+
+namespace LingYanAspCoreFramework.DbMultiTenants.Models
+{
+ ///
+ /// 琛ㄧず绉熸埛淇℃伅鐨勭被
+ ///
+ public class TenantInfo : DynamicObject
+ {
+ ///
+ /// 绉熸埛鍚嶇О
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 绉熸埛鏄惁瀛樺湪
+ ///
+ public bool IsPresent { get; set; }
+
+ ///
+ /// 绉熸埛鐢熸垚鍣
+ ///
+ public object Generator { get; set; }
+
+ ///
+ /// 鍔ㄦ佸鍣紝鐢ㄤ簬瀛樺偍绉熸埛鐨勫姩鎬佸睘鎬
+ ///
+ public dynamic Container { get; set; } = new ExpandoObject();
+
+ ///
+ /// 鍐呴儴瀛楀吀锛岀敤浜庡瓨鍌ㄥ姩鎬佸睘鎬
+ ///
+ private Dictionary dictionary = new Dictionary();
+
+ ///
+ /// 灏濊瘯鑾峰彇鍔ㄦ佹垚鍛樼殑鍊
+ ///
+ /// 鎴愬憳缁戝畾鍣
+ /// 鎴愬憳鐨勫
+ /// 濡傛灉鑾峰彇鎴愬姛锛岃繑鍥 true锛涘惁鍒欒繑鍥 false
+ public override bool TryGetMember(GetMemberBinder binder, out object result)
+ {
+ return dictionary.TryGetValue(binder.Name, out result);
+ }
+
+ ///
+ /// 灏濊瘯璁剧疆鍔ㄦ佹垚鍛樼殑鍊
+ ///
+ /// 鎴愬憳缁戝畾鍣
+ /// 瑕佽缃殑鍊
+ /// 濡傛灉璁剧疆鎴愬姛锛岃繑鍥 true锛涘惁鍒欒繑鍥 false
+ public override bool TrySetMember(SetMemberBinder binder, object value)
+ {
+ dictionary[binder.Name] = value;
+ return true;
+ }
+
+ ///
+ /// 灏濊瘯璁剧疆鍔ㄦ佺储寮曠殑鍊
+ ///
+ /// 绱㈠紩缁戝畾鍣
+ /// 绱㈠紩鏁扮粍
+ /// 瑕佽缃殑鍊
+ /// 濡傛灉璁剧疆鎴愬姛锛岃繑鍥 true锛涘惁鍒欒繑鍥 false
+ public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value)
+ {
+ if (!(indexes?.Length > 0))
+ return false;
+ dictionary[indexes[0].ToString()] = value;
+ return true;
+ }
+
+ ///
+ /// 灏濊瘯鑾峰彇鍔ㄦ佺储寮曠殑鍊
+ ///
+ /// 绱㈠紩缁戝畾鍣
+ /// 绱㈠紩鏁扮粍
+ /// 绱㈠紩鐨勫
+ /// 濡傛灉鑾峰彇鎴愬姛锛岃繑鍥 true锛涘惁鍒欒繑鍥 false
+ public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
+ {
+ result = null;
+ if (!(indexes?.Length > 0))
+ return false;
+ result = dictionary[indexes[0].ToString()];
+ return true;
+ }
+ }
+}
diff --git a/LingYanAspCoreFramework/DbMultiTenants/Models/TenantOption.cs b/LingYanAspCoreFramework/DbMultiTenants/Models/TenantOption.cs
new file mode 100644
index 0000000..78f81a5
--- /dev/null
+++ b/LingYanAspCoreFramework/DbMultiTenants/Models/TenantOption.cs
@@ -0,0 +1,43 @@
+namespace LingYanAspCoreFramework.DbMultiTenants.Models
+{
+ ///
+ /// 表示租户选项的类
+ ///
+ public class TenantOption
+ {
+ ///
+ /// 租户选项的键
+ ///
+ public string Key { get; set; }
+
+ ///
+ /// 连接解析器类型
+ ///
+ public ConnectionResolverType ConnectionType { get; set; }
+
+ ///
+ /// 数据库集成类型
+ ///
+ public DbIntegrationType DbType { get; set; }
+
+ ///
+ /// 连接名称
+ ///
+ public string ConnectionName { get; set; }
+
+ ///
+ /// 连接前缀
+ ///
+ public string ConnectionPrefix { get; set; }
+
+ ///
+ /// 表名生成函数
+ ///
+ public Func TableNameFunc { get; set; }
+
+ ///
+ /// 模式生成函数
+ ///
+ public Func SchemaFunc { get; set; }
+ }
+}
--
Gitee
From d923e52a64b86726d56f9cb2b91606f53d64346d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=81=B5=E7=87=95=E7=A9=BA=E9=97=B4?= <1321180895@qq.com>
Date: Tue, 25 Mar 2025 17:50:57 +0800
Subject: [PATCH 02/17] =?UTF-8?q?=E5=88=86=E5=BA=93=E5=88=86=E8=A1=A8?=
=?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
LingTest/Controllers/ProductController.cs | 51 ++++
LingTest/Controllers/TokenController.cs | 52 ----
LingTest/DbContexts/LingDbContext.cs | 41 ---
LingTest/DbContexts/StoreDbContext.cs | 24 ++
LingTest/Entitys/Product.cs | 18 ++
LingTest/Entitys/RoleEntity.cs | 8 -
LingTest/Entitys/RoleRouteGroupEntity.cs | 8 -
LingTest/Entitys/RouteEntity.cs | 8 -
LingTest/Entitys/UserEntity.cs | 8 -
LingTest/Entitys/UserRoleGroupEntity.cs | 8 -
LingTest/Filters/AuthorFilter.cs | 11 -
LingTest/Filters/PermissionHandle.cs | 13 -
.../Generator/CombindedConnectionGenerator.cs | 37 +++
.../Migrations/20241223072307_v1.Designer.cs | 196 ------------
LingTest/Migrations/20241223072307_v1.cs | 146 ---------
.../Migrations/20241223133026_v2.Designer.cs | 194 ------------
LingTest/Migrations/20241223133026_v2.cs | 74 -----
.../Migrations/20241225083119_v3.Designer.cs | 194 ------------
LingTest/Migrations/20241225083119_v3.cs | 28 --
.../Migrations/20241227064847_v4.Designer.cs | 202 -------------
LingTest/Migrations/20241227064847_v4.cs | 40 ---
.../Migrations/LingDbContextModelSnapshot.cs | 199 ------------
LingTest/RestApiModule.cs | 14 +-
LingTest/appsettings.json | 5 +
.../DbMultiTenants/Core/Constans.cs | 14 +
.../Core/Extension/TenantCoreExtension.cs | 282 ++++++++++++++++++
.../Core/Impl/NamedConnectionGenerator.cs | 43 +++
.../Impl/SimpleHeaderTenantInfoGenerator.cs | 32 ++
.../Core/Impl/TenantConnectionResolver.cs | 69 +++++
.../Core/Interface/IConnectionGenerator.cs | 13 +
.../Interface/ITenantConnectionResolver.cs | 7 +
.../Core/Interface/ITenantInfoGenerator.cs | 11 +
.../Core/TenantInfoMiddleware.cs | 22 ++
.../DbMultiTenants/Core/TenantSettings.cs | 63 ++++
.../DbMultiTenants/Core/TenantSettingsT.cs | 65 ++++
.../DbAccess/Impl/SimpleEntityScaner.cs | 10 +-
.../DbAccess/Impl/TenantBaseDbContext.cs | 11 +-
.../DbAccess/Impl/TenantEntityBuilder.cs | 4 +-
.../DbAccess/Interface/IEntityScaner.cs | 4 +-
.../DbAccess/Interface/ITenantDbContext.cs | 2 +-
.../Interface/ITenantEntityBuilder.cs | 2 +-
.../DbAccess/TenantModelCacheKey.cs | 1 +
.../DbAccess/TenantModelCacheKeyFactory.cs | 1 +
.../DbExtensions/MySqlTenantExtension.cs | 123 ++++++++
.../DbExtensions/PostgreTenantExtension.cs | 90 ++++++
.../DbExtensions/SqlServerTenantExtension.cs | 91 ++++++
.../{ => Enum}/ConnectionResolverType.cs | 2 +-
.../Models/{ => Enum}/DbIntegrationType.cs | 2 +-
.../DbMultiTenants/Models/TenantOption.cs | 2 +
.../Extensions/IocExtension.cs | 116 +++----
.../Helpers/LoggerHelper.cs | 5 +-
.../LingYanAspCoreFramework.csproj | 1 +
52 files changed, 1151 insertions(+), 1516 deletions(-)
create mode 100644 LingTest/Controllers/ProductController.cs
delete mode 100644 LingTest/Controllers/TokenController.cs
delete mode 100644 LingTest/DbContexts/LingDbContext.cs
create mode 100644 LingTest/DbContexts/StoreDbContext.cs
create mode 100644 LingTest/Entitys/Product.cs
delete mode 100644 LingTest/Entitys/RoleEntity.cs
delete mode 100644 LingTest/Entitys/RoleRouteGroupEntity.cs
delete mode 100644 LingTest/Entitys/RouteEntity.cs
delete mode 100644 LingTest/Entitys/UserEntity.cs
delete mode 100644 LingTest/Entitys/UserRoleGroupEntity.cs
delete mode 100644 LingTest/Filters/AuthorFilter.cs
delete mode 100644 LingTest/Filters/PermissionHandle.cs
create mode 100644 LingTest/Generator/CombindedConnectionGenerator.cs
delete mode 100644 LingTest/Migrations/20241223072307_v1.Designer.cs
delete mode 100644 LingTest/Migrations/20241223072307_v1.cs
delete mode 100644 LingTest/Migrations/20241223133026_v2.Designer.cs
delete mode 100644 LingTest/Migrations/20241223133026_v2.cs
delete mode 100644 LingTest/Migrations/20241225083119_v3.Designer.cs
delete mode 100644 LingTest/Migrations/20241225083119_v3.cs
delete mode 100644 LingTest/Migrations/20241227064847_v4.Designer.cs
delete mode 100644 LingTest/Migrations/20241227064847_v4.cs
delete mode 100644 LingTest/Migrations/LingDbContextModelSnapshot.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/Constans.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/Extension/TenantCoreExtension.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/Impl/NamedConnectionGenerator.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/Impl/SimpleHeaderTenantInfoGenerator.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/Impl/TenantConnectionResolver.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/Interface/IConnectionGenerator.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/Interface/ITenantConnectionResolver.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/Interface/ITenantInfoGenerator.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/TenantInfoMiddleware.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/TenantSettings.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/Core/TenantSettingsT.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbExtensions/MySqlTenantExtension.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbExtensions/PostgreTenantExtension.cs
create mode 100644 LingYanAspCoreFramework/DbMultiTenants/DbExtensions/SqlServerTenantExtension.cs
rename LingYanAspCoreFramework/DbMultiTenants/Models/{ => Enum}/ConnectionResolverType.cs (89%)
rename LingYanAspCoreFramework/DbMultiTenants/Models/{ => Enum}/DbIntegrationType.cs (68%)
diff --git a/LingTest/Controllers/ProductController.cs b/LingTest/Controllers/ProductController.cs
new file mode 100644
index 0000000..98b6ad1
--- /dev/null
+++ b/LingTest/Controllers/ProductController.cs
@@ -0,0 +1,51 @@
+using LingTest.DbContexts;
+using LingTest.Entitys;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+
+namespace LingTest.Controllers
+{
+ [ApiController]
+ [Route("api/[controller]s")]
+ [AllowAnonymous]
+ public class ProductController : ControllerBase
+ {
+ private readonly StoreDbContext storeDbContext;
+
+ public ProductController(StoreDbContext storeDbContext)
+ {
+ this.storeDbContext = storeDbContext;
+ //this.storeDbContext.Database.Migrate();
+ this.storeDbContext.Database.EnsureCreated();
+ }
+
+ [HttpPost("")]
+ public async Task> Create(Product product)
+ {
+ var rct = await this.storeDbContext.Products.AddAsync(product);
+
+ await this.storeDbContext.SaveChangesAsync();
+
+ return rct?.Entity;
+
+ }
+
+ [HttpGet("{id}")]
+ public async Task> Get([FromRoute] int id)
+ {
+
+ var rct = await this.storeDbContext.Products.FindAsync(id);
+
+ return rct;
+
+ }
+
+ [HttpGet("")]
+ public async Task>> Search()
+ {
+ var rct = await this.storeDbContext.Products.ToListAsync();
+ return rct;
+ }
+ }
+}
\ No newline at end of file
diff --git a/LingTest/Controllers/TokenController.cs b/LingTest/Controllers/TokenController.cs
deleted file mode 100644
index 269b4b7..0000000
--- a/LingTest/Controllers/TokenController.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using LingYanAspCoreFramework.Extensions;
-using LingYanAspCoreFramework.SampleRoots;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using Yitter.IdGenerator;
-
-namespace LingTest.Controllers
-{
- ///
- /// 天气控制器
- ///
- [ApiController]
- [Route("api/[controller]/[action]")]
- [Authorize(AuthenticationSchemes = SampleHelper.BearerScheme, Policy = SampleHelper.EmpowerPolicy)]
- public class TokenController : ControllerBase
- {
- private readonly ILogger logger;
-
- public TokenController(ILogger logger)
- {
- this.logger = logger;
- }
- ///
- /// 获取Token
- ///
- /// 测试是否引入
- /// 返回默认值
-
- [HttpGet]
- [AllowAnonymous]
- public IActionResult Get(string sss)
- {
- if (string.IsNullOrEmpty(sss))
- {
- throw new Exception("中途测试抛异常");
- }
- Dictionary keyValuePairs = new Dictionary();
- keyValuePairs.Add(SampleHelper.ClaimUserId, "77777");
- var token = keyValuePairs.CreateJwtToken(SampleHelper.RSAPublicKey);
- return Ok(token);
- }
- ///
- /// 水水水水水
- ///
- ///
- [HttpGet]
- public IActionResult Test()
- {
- return Ok("完成");
- }
- }
-}
\ No newline at end of file
diff --git a/LingTest/DbContexts/LingDbContext.cs b/LingTest/DbContexts/LingDbContext.cs
deleted file mode 100644
index 6faff9b..0000000
--- a/LingTest/DbContexts/LingDbContext.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-锘縰sing LingTest.Entitys;
-using LingYanAspCoreFramework.Attributes;
-using LingYanAspCoreFramework.SampleRoots;
-using Microsoft.EntityFrameworkCore;
-
-namespace LingTest.DbContexts
-{
- [LYDbContext("Default")]
- public class LingDbContext : DbContext
- {
- public LingDbContext()
- {
- }
-
- public LingDbContext(DbContextOptions dbContextOptions) : base(dbContextOptions)
- {
- }
-
- public DbSet Users { get; set; }
- public DbSet Roles { get; set; }
- public DbSet Routes { get; set; }
- public DbSet UserRoleGroups { get; set; }
- public DbSet RoleRouteGroups { get; set; }
-
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- base.OnConfiguring(optionsBuilder);
- if (!optionsBuilder.IsConfigured)
- {
- optionsBuilder.UseMySql(SampleHelper.MysqlConnectionDic["Default"], ServerVersion.AutoDetect(SampleHelper.MysqlConnectionDic["Default"]))
- .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking)
- .EnableSensitiveDataLogging();
- }
- }
-
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- base.OnModelCreating(modelBuilder);
- }
- }
-}
\ No newline at end of file
diff --git a/LingTest/DbContexts/StoreDbContext.cs b/LingTest/DbContexts/StoreDbContext.cs
new file mode 100644
index 0000000..610ff81
--- /dev/null
+++ b/LingTest/DbContexts/StoreDbContext.cs
@@ -0,0 +1,24 @@
+using LingTest.Entitys;
+using LingYanAspCoreFramework.DbMultiTenants.DbAccess.Impl;
+using LingYanAspCoreFramework.DbMultiTenants.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Caching.Memory;
+
+namespace LingTest.DbContexts
+{
+ public class StoreDbContext : TenantBaseDbContext
+ {
+ public DbSet Products => this.Set();
+
+ public StoreDbContext(IMemoryCache cache,DbContextOptions options, TenantInfo tenant, IServiceProvider serviceProvider)
+ : base(options, tenant, serviceProvider)
+ {
+ string ab="ab";
+ }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+ }
+ }
+}
diff --git a/LingTest/Entitys/Product.cs b/LingTest/Entitys/Product.cs
new file mode 100644
index 0000000..736a4cc
--- /dev/null
+++ b/LingTest/Entitys/Product.cs
@@ -0,0 +1,18 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace LingTest.Entitys
+{
+ public class Product
+ {
+ [Key]
+ public int Id { get; set; }
+
+ [StringLength(50), Required]
+ public string Name { get; set; }
+
+ [StringLength(50)]
+ public string Category { get; set; }
+
+ public double? Price { get; set; }
+ }
+}
diff --git a/LingTest/Entitys/RoleEntity.cs b/LingTest/Entitys/RoleEntity.cs
deleted file mode 100644
index ebd66c6..0000000
--- a/LingTest/Entitys/RoleEntity.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-锘縰sing LingYanAspCoreFramework.BaseRoots;
-
-namespace LingTest.Entitys
-{
- public class RoleEntity : BaseRole
- {
- }
-}
\ No newline at end of file
diff --git a/LingTest/Entitys/RoleRouteGroupEntity.cs b/LingTest/Entitys/RoleRouteGroupEntity.cs
deleted file mode 100644
index 87f0fd1..0000000
--- a/LingTest/Entitys/RoleRouteGroupEntity.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-锘縰sing LingYanAspCoreFramework.BaseRoots;
-
-namespace LingTest.Entitys
-{
- public class RoleRouteGroupEntity : BaseRoleRouteGroup
- {
- }
-}
\ No newline at end of file
diff --git a/LingTest/Entitys/RouteEntity.cs b/LingTest/Entitys/RouteEntity.cs
deleted file mode 100644
index 29c3e51..0000000
--- a/LingTest/Entitys/RouteEntity.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-锘縰sing LingYanAspCoreFramework.BaseRoots;
-
-namespace LingTest.Entitys
-{
- public class RouteEntity : BaseRoute
- {
- }
-}
\ No newline at end of file
diff --git a/LingTest/Entitys/UserEntity.cs b/LingTest/Entitys/UserEntity.cs
deleted file mode 100644
index 6b8b52f..0000000
--- a/LingTest/Entitys/UserEntity.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-锘縰sing LingYanAspCoreFramework.BaseRoots;
-
-namespace LingTest.Entitys
-{
- public class UserEntity : BaseUser
- {
- }
-}
\ No newline at end of file
diff --git a/LingTest/Entitys/UserRoleGroupEntity.cs b/LingTest/Entitys/UserRoleGroupEntity.cs
deleted file mode 100644
index 9d4a9a9..0000000
--- a/LingTest/Entitys/UserRoleGroupEntity.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-锘縰sing LingYanAspCoreFramework.BaseRoots;
-
-namespace LingTest.Entitys
-{
- public class UserRoleGroupEntity : BaseUserRoleGroup
- {
- }
-}
\ No newline at end of file
diff --git a/LingTest/Filters/AuthorFilter.cs b/LingTest/Filters/AuthorFilter.cs
deleted file mode 100644
index 0e1d204..0000000
--- a/LingTest/Filters/AuthorFilter.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-锘縰sing LingTest.Entitys;
-using LingYanAspCoreFramework.Attributes;
-using LingYanAspCoreFramework.SampleRoots;
-
-namespace LingTest.Filters
-{
- [LYGlobalFilter]
- public class AuthorFilter:SampleGlobalAuthorizationFilterAttribute
- {
- }
-}
diff --git a/LingTest/Filters/PermissionHandle.cs b/LingTest/Filters/PermissionHandle.cs
deleted file mode 100644
index 3fadd71..0000000
--- a/LingTest/Filters/PermissionHandle.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-锘縰sing LingYanAspCoreFramework.Attributes;
-using LingYanAspCoreFramework.SampleRoots;
-
-namespace LingTest.Filters
-{
- [LYAuthorizeHandler]
- public class PermissionHandle : SampleGlobalPermissionHandle
- {
- public PermissionHandle(IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor)
- {
- }
- }
-}
diff --git a/LingTest/Generator/CombindedConnectionGenerator.cs b/LingTest/Generator/CombindedConnectionGenerator.cs
new file mode 100644
index 0000000..3e76d9c
--- /dev/null
+++ b/LingTest/Generator/CombindedConnectionGenerator.cs
@@ -0,0 +1,37 @@
+锘縰sing LingYanAspCoreFramework.Attributes;
+using LingYanAspCoreFramework.DbMultiTenants.Core.Interface;
+using LingYanAspCoreFramework.DbMultiTenants.Models;
+using LingYanAspCoreFramework.Helpers;
+
+namespace LingTest.Generator
+{
+ [LYTService(typeof(IConnectionGenerator),ServiceLifetime =ServiceLifetime.Scoped)]
+ public class CombindedConnectionGenerator : IConnectionGenerator
+ {
+ private readonly IConfiguration configuration;
+ public string TenantKey => "";
+
+ public CombindedConnectionGenerator(IConfiguration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+
+ public string GetConnection(TenantOption option, TenantInfo tenantInfo)
+ {
+ var span = tenantInfo.Name.AsSpan();
+ if (span.Length > 4 && int.TryParse(span[5].ToString(), out var number))
+ {
+ var connection= configuration.GetConnectionString($"{option.ConnectionPrefix}container{number%2+1}");
+ LoggerHelper.DefaultLog(connection);
+ return connection;
+ }
+ throw new NotSupportedException("tenant invalid");
+ }
+
+ public bool MatchTenantKey(string tenantKey)
+ {
+ return true;
+ }
+ }
+}
diff --git a/LingTest/Migrations/20241223072307_v1.Designer.cs b/LingTest/Migrations/20241223072307_v1.Designer.cs
deleted file mode 100644
index 69931f6..0000000
--- a/LingTest/Migrations/20241223072307_v1.Designer.cs
+++ /dev/null
@@ -1,196 +0,0 @@
-锘//
-using LingTest.DbContexts;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace LingTest.Migrations
-{
- [DbContext(typeof(LingDbContext))]
- [Migration("20241223072307_v1")]
- partial class v1
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "8.0.11")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
-
- modelBuilder.Entity("LingTest.Entitys.RoleEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Description")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Roles");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RoleRouteGroup", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("RoleId")
- .HasColumnType("bigint");
-
- b.Property("RouteId")
- .HasColumnType("bigint");
-
- b.HasKey("Id");
-
- b.ToTable("RoleRouteGroups");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RouteEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("ContrillereFullName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Controller")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("ControllerSummary")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Display")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("DisplayFullName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("DisplaySummary")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("HttpMethod")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("ProjectName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("RoutePrefix")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("RouteTemplate")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Routes");
- });
-
- modelBuilder.Entity("LingTest.Entitys.UserEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("NickName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Password")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Phone")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Users");
- });
-
- modelBuilder.Entity("LingTest.Entitys.UserRoleGroupEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("RoleId")
- .HasColumnType("bigint");
-
- b.Property("UserId")
- .HasColumnType("bigint");
-
- b.HasKey("Id");
-
- b.ToTable("UserRoleGroups");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/LingTest/Migrations/20241223072307_v1.cs b/LingTest/Migrations/20241223072307_v1.cs
deleted file mode 100644
index 0f6f5bf..0000000
--- a/LingTest/Migrations/20241223072307_v1.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-锘縰sing Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace LingTest.Migrations
-{
- ///
- public partial class v1 : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterDatabase()
- .Annotation("MySql:CharSet", "utf8mb4");
-
- migrationBuilder.CreateTable(
- name: "RoleRouteGroups",
- columns: table => new
- {
- Id = table.Column(type: "bigint", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- IsDeleted = table.Column(type: "tinyint(1)", nullable: false),
- CreateTimeStamp = table.Column(type: "bigint", nullable: false),
- RoleId = table.Column(type: "bigint", nullable: false),
- RouteId = table.Column(type: "bigint", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_RoleRouteGroups", x => x.Id);
- })
- .Annotation("MySql:CharSet", "utf8mb4");
-
- migrationBuilder.CreateTable(
- name: "Roles",
- columns: table => new
- {
- Id = table.Column(type: "bigint", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- IsDeleted = table.Column(type: "tinyint(1)", nullable: false),
- CreateTimeStamp = table.Column(type: "bigint", nullable: false),
- Name = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Description = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Roles", x => x.Id);
- })
- .Annotation("MySql:CharSet", "utf8mb4");
-
- migrationBuilder.CreateTable(
- name: "Routes",
- columns: table => new
- {
- Id = table.Column(type: "bigint", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- IsDeleted = table.Column(type: "tinyint(1)", nullable: false),
- CreateTimeStamp = table.Column(type: "bigint", nullable: false),
- Display = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- DisplaySummary = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- DisplayFullName = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Controller = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ControllerSummary = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ContrillereFullName = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- RouteTemplate = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- HttpMethod = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- RoutePrefix = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ProjectName = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Routes", x => x.Id);
- })
- .Annotation("MySql:CharSet", "utf8mb4");
-
- migrationBuilder.CreateTable(
- name: "UserRoleGroups",
- columns: table => new
- {
- Id = table.Column(type: "bigint", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- IsDeleted = table.Column(type: "tinyint(1)", nullable: false),
- CreateTimeStamp = table.Column(type: "bigint", nullable: false),
- UserId = table.Column(type: "bigint", nullable: false),
- RoleId = table.Column(type: "bigint", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserRoleGroups", x => x.Id);
- })
- .Annotation("MySql:CharSet", "utf8mb4");
-
- migrationBuilder.CreateTable(
- name: "Users",
- columns: table => new
- {
- Id = table.Column(type: "bigint", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- IsDeleted = table.Column(type: "tinyint(1)", nullable: false),
- CreateTimeStamp = table.Column(type: "bigint", nullable: false),
- NickName = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Phone = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Password = table.Column(type: "longtext", nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Users", x => x.Id);
- })
- .Annotation("MySql:CharSet", "utf8mb4");
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "RoleRouteGroups");
-
- migrationBuilder.DropTable(
- name: "Roles");
-
- migrationBuilder.DropTable(
- name: "Routes");
-
- migrationBuilder.DropTable(
- name: "UserRoleGroups");
-
- migrationBuilder.DropTable(
- name: "Users");
- }
- }
-}
\ No newline at end of file
diff --git a/LingTest/Migrations/20241223133026_v2.Designer.cs b/LingTest/Migrations/20241223133026_v2.Designer.cs
deleted file mode 100644
index 6b3ba8d..0000000
--- a/LingTest/Migrations/20241223133026_v2.Designer.cs
+++ /dev/null
@@ -1,194 +0,0 @@
-锘//
-using LingTest.DbContexts;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace LingTest.Migrations
-{
- [DbContext(typeof(LingDbContext))]
- [Migration("20241223133026_v2")]
- partial class v2
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "8.0.11")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
-
- modelBuilder.Entity("LingTest.Entitys.RoleEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Description")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Roles");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RoleRouteGroupEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("RoleId")
- .HasColumnType("bigint");
-
- b.Property("RouteId")
- .HasColumnType("bigint");
-
- b.HasKey("Id");
-
- b.ToTable("RoleRouteGroups");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RouteEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("ContrillereFullName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Controller")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("ControllerSummary")
- .HasColumnType("longtext");
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Display")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("DisplayFullName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("DisplaySummary")
- .HasColumnType("longtext");
-
- b.Property("HttpMethod")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("ProjectName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("RoutePrefix")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("RouteTemplate")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Routes");
- });
-
- modelBuilder.Entity("LingTest.Entitys.UserEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("NickName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Password")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Phone")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Users");
- });
-
- modelBuilder.Entity("LingTest.Entitys.UserRoleGroupEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("RoleId")
- .HasColumnType("bigint");
-
- b.Property("UserId")
- .HasColumnType("bigint");
-
- b.HasKey("Id");
-
- b.ToTable("UserRoleGroups");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/LingTest/Migrations/20241223133026_v2.cs b/LingTest/Migrations/20241223133026_v2.cs
deleted file mode 100644
index e1795c8..0000000
--- a/LingTest/Migrations/20241223133026_v2.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-锘縰sing Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace LingTest.Migrations
-{
- ///
- public partial class v2 : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn(
- name: "DisplaySummary",
- table: "Routes",
- type: "longtext",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "longtext")
- .Annotation("MySql:CharSet", "utf8mb4")
- .OldAnnotation("MySql:CharSet", "utf8mb4");
-
- migrationBuilder.AlterColumn(
- name: "ControllerSummary",
- table: "Routes",
- type: "longtext",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "longtext")
- .Annotation("MySql:CharSet", "utf8mb4")
- .OldAnnotation("MySql:CharSet", "utf8mb4");
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.UpdateData(
- table: "Routes",
- keyColumn: "DisplaySummary",
- keyValue: null,
- column: "DisplaySummary",
- value: "");
-
- migrationBuilder.AlterColumn(
- name: "DisplaySummary",
- table: "Routes",
- type: "longtext",
- nullable: false,
- oldClrType: typeof(string),
- oldType: "longtext",
- oldNullable: true)
- .Annotation("MySql:CharSet", "utf8mb4")
- .OldAnnotation("MySql:CharSet", "utf8mb4");
-
- migrationBuilder.UpdateData(
- table: "Routes",
- keyColumn: "ControllerSummary",
- keyValue: null,
- column: "ControllerSummary",
- value: "");
-
- migrationBuilder.AlterColumn(
- name: "ControllerSummary",
- table: "Routes",
- type: "longtext",
- nullable: false,
- oldClrType: typeof(string),
- oldType: "longtext",
- oldNullable: true)
- .Annotation("MySql:CharSet", "utf8mb4")
- .OldAnnotation("MySql:CharSet", "utf8mb4");
- }
- }
-}
\ No newline at end of file
diff --git a/LingTest/Migrations/20241225083119_v3.Designer.cs b/LingTest/Migrations/20241225083119_v3.Designer.cs
deleted file mode 100644
index 73b8e92..0000000
--- a/LingTest/Migrations/20241225083119_v3.Designer.cs
+++ /dev/null
@@ -1,194 +0,0 @@
-锘//
-using LingTest.DbContexts;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace LingTest.Migrations
-{
- [DbContext(typeof(LingDbContext))]
- [Migration("20241225083119_v3")]
- partial class v3
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "8.0.11")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
-
- modelBuilder.Entity("LingTest.Entitys.RoleEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Description")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Roles");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RoleRouteGroupEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("RoleId")
- .HasColumnType("bigint");
-
- b.Property("RouteId")
- .HasColumnType("bigint");
-
- b.HasKey("Id");
-
- b.ToTable("RoleRouteGroups");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RouteEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("Controller")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("ControllerFullName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("ControllerSummary")
- .HasColumnType("longtext");
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Display")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("DisplayFullName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("DisplaySummary")
- .HasColumnType("longtext");
-
- b.Property("HttpMethod")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("ProjectName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("RoutePrefix")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("RouteTemplate")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Routes");
- });
-
- modelBuilder.Entity("LingTest.Entitys.UserEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("NickName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Password")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Phone")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Users");
- });
-
- modelBuilder.Entity("LingTest.Entitys.UserRoleGroupEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("RoleId")
- .HasColumnType("bigint");
-
- b.Property("UserId")
- .HasColumnType("bigint");
-
- b.HasKey("Id");
-
- b.ToTable("UserRoleGroups");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/LingTest/Migrations/20241225083119_v3.cs b/LingTest/Migrations/20241225083119_v3.cs
deleted file mode 100644
index 1a60aac..0000000
--- a/LingTest/Migrations/20241225083119_v3.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-锘縰sing Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace LingTest.Migrations
-{
- ///
- public partial class v3 : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.RenameColumn(
- name: "ContrillereFullName",
- table: "Routes",
- newName: "ControllerFullName");
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.RenameColumn(
- name: "ControllerFullName",
- table: "Routes",
- newName: "ContrillereFullName");
- }
- }
-}
diff --git a/LingTest/Migrations/20241227064847_v4.Designer.cs b/LingTest/Migrations/20241227064847_v4.Designer.cs
deleted file mode 100644
index d2d5ab4..0000000
--- a/LingTest/Migrations/20241227064847_v4.Designer.cs
+++ /dev/null
@@ -1,202 +0,0 @@
-锘//
-using LingTest.DbContexts;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace LingTest.Migrations
-{
- [DbContext(typeof(LingDbContext))]
- [Migration("20241227064847_v4")]
- partial class v4
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "8.0.11")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
-
- modelBuilder.Entity("LingTest.Entitys.RoleEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Description")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Roles");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RoleRouteGroupEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("RoleId")
- .HasColumnType("bigint");
-
- b.Property("RouteId")
- .HasColumnType("bigint");
-
- b.HasKey("Id");
-
- b.ToTable("RoleRouteGroups");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RouteEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("Controller")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("ControllerFullName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("ControllerSummary")
- .HasColumnType("longtext");
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Display")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("DisplayFullName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("DisplaySummary")
- .HasColumnType("longtext");
-
- b.Property("HttpMethod")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("ProjectName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("RoutePrefix")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("RouteTemplate")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Routes");
- });
-
- modelBuilder.Entity("LingTest.Entitys.UserEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("Avatar")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Email")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("NickName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Password")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("Phone")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Users");
- });
-
- modelBuilder.Entity("LingTest.Entitys.UserRoleGroupEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("RoleId")
- .HasColumnType("bigint");
-
- b.Property("UserId")
- .HasColumnType("bigint");
-
- b.HasKey("Id");
-
- b.ToTable("UserRoleGroups");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/LingTest/Migrations/20241227064847_v4.cs b/LingTest/Migrations/20241227064847_v4.cs
deleted file mode 100644
index adb5514..0000000
--- a/LingTest/Migrations/20241227064847_v4.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-锘縰sing Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace LingTest.Migrations
-{
- ///
- public partial class v4 : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "Avatar",
- table: "Users",
- type: "longtext",
- nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4");
-
- migrationBuilder.AddColumn(
- name: "Email",
- table: "Users",
- type: "longtext",
- nullable: false)
- .Annotation("MySql:CharSet", "utf8mb4");
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "Avatar",
- table: "Users");
-
- migrationBuilder.DropColumn(
- name: "Email",
- table: "Users");
- }
- }
-}
diff --git a/LingTest/Migrations/LingDbContextModelSnapshot.cs b/LingTest/Migrations/LingDbContextModelSnapshot.cs
deleted file mode 100644
index 777fcb0..0000000
--- a/LingTest/Migrations/LingDbContextModelSnapshot.cs
+++ /dev/null
@@ -1,199 +0,0 @@
-锘//
-using LingTest.DbContexts;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace LingTest.Migrations
-{
- [DbContext(typeof(LingDbContext))]
- partial class LingDbContextModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "8.0.11")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
-
- modelBuilder.Entity("LingTest.Entitys.RoleEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Description")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.HasKey("Id");
-
- b.ToTable("Roles");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RoleRouteGroupEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("IsDeleted")
- .HasColumnType("tinyint(1)");
-
- b.Property("RoleId")
- .HasColumnType("bigint");
-
- b.Property("RouteId")
- .HasColumnType("bigint");
-
- b.HasKey("Id");
-
- b.ToTable("RoleRouteGroups");
- });
-
- modelBuilder.Entity("LingTest.Entitys.RouteEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("bigint");
-
- MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
-
- b.Property("Controller")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("ControllerFullName")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property("ControllerSummary")
- .HasColumnType("longtext");
-
- b.Property("CreateTimeStamp")
- .HasColumnType("bigint");
-
- b.Property("Display")
- .IsRequired()
- .HasColumnType("longtext");
-
- b.Property