Skip to content

Commit

Permalink
修改多租户配置实现
Browse files Browse the repository at this point in the history
  • Loading branch information
yihango committed Dec 4, 2020
1 parent 904a520 commit 538e727
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/Riven.Domain/MultiTenancy/MultiTenancyConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Text;

Expand All @@ -9,12 +9,10 @@ namespace Riven.MultiTenancy
/// </summary>
public static class MultiTenancyConfig
{
/// <summary>
/// 默认存储租户名称键值
/// </summary>
public const string DEFAULT_TENANT_NAME_KEY = "TenantName";

private static bool? _isEnabled = null;
#region 是否启用

static bool? _isEnabled = null;

/// <summary>
/// 是否启用多租户,默认值为false,只有第一次设置值会生效
Expand All @@ -41,7 +39,17 @@ public static bool IsEnabled
}
}

private static string _tenantNameKey = DEFAULT_TENANT_NAME_KEY;
#endregion


#region 多租户键值

/// <summary>
/// 默认存储租户名称键值
/// </summary>
const string DEFAULT_TENANT_NAME_KEY = "tenantname";

static string _tenantNameKey = DEFAULT_TENANT_NAME_KEY;

/// <summary>
/// 存储租户名称键值 ,默认值为 <see cref="DEFAULT_TENANT_NAME_KEY"/>, 值不能为空, 第一次设置值会生效
Expand All @@ -58,9 +66,11 @@ public static string TenantNameKey

if (_tenantNameKey == DEFAULT_TENANT_NAME_KEY)
{
_tenantNameKey = value;
_tenantNameKey = value.ToLower();
}
}
}
}

#endregion
}
}

0 comments on commit 538e727

Please sign in to comment.