anjoy8 / Blog.Core

💖 ASP.NET Core 8.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
http://apk.neters.club/.doc
Apache License 2.0
5k stars 1.37k forks source link

✨🎨 多租户 #326

Closed LemonNoCry closed 1 year ago

LemonNoCry commented 1 year ago

在兼容原有框架上,进行升级

新增表: [SysTenant] 系统租户表

public class SysTenant : RootEntityTkey<long>
{
    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 租户类型
    /// </summary>
    public TenantTypeEnum TenantType { get; set; }

    /// <summary>
    /// 数据库/租户标识 不可重复<br/>
    /// 使用Id方案,可无需配置
    /// </summary>
    [SugarColumn(Length = 64)]
    public string ConfigId { get; set; }

   ...
}

根据TenantType 分为两种方案: