diff --git a/Yi.Framework.Net6/Yi.Framework.Model/TenantEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/TenantEntity.cs
new file mode 100644
index 00000000..4c75aa7b
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Model/TenantEntity.cs
@@ -0,0 +1,41 @@
+//using SqlSugar;
+//using System;
+//using System.Collections.Generic;
+//using System.Linq;
+//using System.Text;
+//using System.Threading.Tasks;
+
+//namespace Yi.Framework.Model
+//{
+// //需要在用户表中关联好该租户信息,一个用户关联一个租户
+// //不同租户下,用户可以相同
+// //用户登录后,token中可包含租户id,同时缓存一份用户信息(包含租户信息)
+// [Tenant("0")]
+// //当然,像用户、角色、菜单、租户为共享库了
+// [SugarTable("Tenant")]
+// public class TenantEntity
+// {
+// ///
+// /// 主键唯一标识
+// ///
+// [SugarColumn(IsPrimaryKey = true)]
+// public long Id { get; set; }
+
+// ///
+// /// 租户id
+// ///
+// public string? TenantId { get; set; }
+
+// ///
+// /// 业务库连接字符串
+// ///
+// public string? Connection { get; set; }
+
+// ///
+// /// 业务库连接类型
+// ///
+// public string? DbType { get; set; }
+
+
+// }
+//}
diff --git a/Yi.Framework.Net6/Yi.Framework.Repository/Repository.cs b/Yi.Framework.Net6/Yi.Framework.Repository/Repository.cs
index 94a7ed38..5f3a17a0 100644
--- a/Yi.Framework.Net6/Yi.Framework.Repository/Repository.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Repository/Repository.cs
@@ -60,6 +60,8 @@ namespace Yi.Framework.Repository
// //3:根据租户id获取到对应db对象,替换仓储中的db对象即可
// base.Context = _Db.AsTenant().GetConnectionScope(tenantId);
//}
+ //这里有个问题,如果想通过上下文请求获取用户信息,就依赖到web相关。需要进行协调好
+ //同时还要考虑动态的业务库初始化问题,这个判断不应该写到仓储中,会很吃性能,可以添加租户、程序启动,两个地方同时进行业务库的数据库初始化判断
}
///
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs
index 3d8cbc69..b44816ab 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs
@@ -2,6 +2,7 @@
using SqlSugar;
using System;
using System.Linq;
+using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Models;
using Yi.Framework.DTOModel;
@@ -28,7 +29,7 @@ namespace Yi.Framework.Core
}
//超级管理员直接放行
- if (ServiceLocator.Admin.Equals(userName))
+ if (SystemConst.Admin.Equals(userName))
{
return;
}
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs
index 8d72a516..87a30d30 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs
@@ -9,8 +9,7 @@ namespace Yi.Framework.WebCore
{
public static IServiceProvider? Instance { get; set; }
- public static string Admin { get; set; } = "cc";
-
+ //需要兼容不存在http请求的情况
public static bool GetHttp(out HttpContext? httpContext)
{
httpContext = null;