Skip to content

Commit

Permalink
⛽ Split multi tenant provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkSoul committed Oct 2, 2020
1 parent 6e665df commit 22c2b50
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 26 deletions.
21 changes: 11 additions & 10 deletions framework/Fur/DatabaseAccessor/MultiTenants/Entities/Tenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ namespace Fur.DatabaseAccessor
/// </summary>
public class Tenant : IEntityDependency
{
/// <summary>
/// 构造函数
/// </summary>
public Tenant()
{
CreatedTime = DateTime.Now;
}

/// <summary>
/// 租户Id
/// </summary>
[Key]
[ScaffoldColumn(false)]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
Expand Down Expand Up @@ -53,15 +64,5 @@ public class Tenant : IEntityDependency
/// 创建时间
/// </summary>
public DateTime CreatedTime { get; set; }

/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdatedTime { get; set; }

/// <summary>
/// 软删除
/// </summary>
public bool IsDeleted { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// -----------------------------------------------------------------------------
// Fur 是 .NET 5 平台下极易入门、极速开发的 Web 应用框架。
// Copyright © 2020 Fur, Baiqian Co.,Ltd.
//
// 框架名称:Fur
// 框架作者:百小僧
// 框架版本:1.0.0
// 官方网站:https://chinadot.net
// 源码地址:Gitee:https://gitee.com/monksoul/Fur
// Github:https://github.com/monksoul/Fur
// 开源协议:Apache-2.0(http://www.apache.org/licenses/LICENSE-2.0)
// -----------------------------------------------------------------------------

namespace Fur.DatabaseAccessor
{
/// <summary>
/// 基于多个数据库多租户模式
/// </summary>
public interface IMultiTenantOnDatabaseProvider : IMultiTenantProviderDependency
{
/// <summary>
/// 获取数据库连接字符串
/// </summary>
/// <returns></returns>
string GetDatabaseConnectionString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// -----------------------------------------------------------------------------
// Fur 是 .NET 5 平台下极易入门、极速开发的 Web 应用框架。
// Copyright © 2020 Fur, Baiqian Co.,Ltd.
//
// 框架名称:Fur
// 框架作者:百小僧
// 框架版本:1.0.0
// 官方网站:https://chinadot.net
// 源码地址:Gitee:https://gitee.com/monksoul/Fur
// Github:https://github.com/monksoul/Fur
// 开源协议:Apache-2.0(http://www.apache.org/licenses/LICENSE-2.0)
// -----------------------------------------------------------------------------

namespace Fur.DatabaseAccessor
{
/// <summary>
/// 基于数据库架构的多租户模式
/// </summary>
public interface IMultiTenantOnSchemaProvider : IMultiTenantProviderDependency
{
/// <summary>
/// 获取数据库架构名称
/// </summary>
/// <returns></returns>
string GetSchemaName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,14 @@
namespace Fur.DatabaseAccessor
{
/// <summary>
/// 多租户提供器依赖接口
/// 基于数据库表的多租户模式
/// </summary>
public interface IMultiTenantProvider
public interface IMultiTenantOnTableProvider : IMultiTenantProviderDependency
{
/// <summary>
/// 基于数据库表的多租户模式
/// 获取租户Id
/// </summary>
/// <returns></returns>
Guid? OnTableTenantId();

/// <summary>
/// 基于数据库架构名的多租户模式
/// </summary>
/// <returns></returns>
string OnSchemaName();

/// <summary>
/// 基于数据库的多租户模式
/// </summary>
/// <returns></returns>
string OnDatabaseConnectionString();
Guid? GetTenantId();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// -----------------------------------------------------------------------------
// Fur 是 .NET 5 平台下极易入门、极速开发的 Web 应用框架。
// Copyright © 2020 Fur, Baiqian Co.,Ltd.
//
// 框架名称:Fur
// 框架作者:百小僧
// 框架版本:1.0.0
// 官方网站:https://chinadot.net
// 源码地址:Gitee:https://gitee.com/monksoul/Fur
// Github:https://github.com/monksoul/Fur
// 开源协议:Apache-2.0(http://www.apache.org/licenses/LICENSE-2.0)
// -----------------------------------------------------------------------------

namespace Fur.DatabaseAccessor
{
/// <summary>
/// 多租户提供器依赖接口(禁止外部继承)
/// </summary>
public interface IMultiTenantProviderDependency
{
}
}

0 comments on commit 22c2b50

Please sign in to comment.