注释
This commit is contained in:
41
Yi.Framework.Net6/Yi.Framework.Model/TenantEntity.cs
Normal file
41
Yi.Framework.Net6/Yi.Framework.Model/TenantEntity.cs
Normal file
@@ -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
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 主键唯一标识
|
||||
// /// </summary>
|
||||
// [SugarColumn(IsPrimaryKey = true)]
|
||||
// public long Id { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 租户id
|
||||
// /// </summary>
|
||||
// public string? TenantId { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 业务库连接字符串
|
||||
// /// </summary>
|
||||
// public string? Connection { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 业务库连接类型
|
||||
// /// </summary>
|
||||
// public string? DbType { get; set; }
|
||||
|
||||
|
||||
// }
|
||||
//}
|
||||
@@ -60,6 +60,8 @@ namespace Yi.Framework.Repository
|
||||
// //3:根据租户id获取到对应db对象,替换仓储中的db对象即可
|
||||
// base.Context = _Db.AsTenant().GetConnectionScope(tenantId);
|
||||
//}
|
||||
//这里有个问题,如果想通过上下文请求获取用户信息,就依赖到web相关。需要进行协调好
|
||||
//同时还要考虑动态的业务库初始化问题,这个判断不应该写到仓储中,会很吃性能,可以添加租户、程序启动,两个地方同时进行业务库的数据库初始化判断
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user