feat: 搭建多租户框架
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
|
||||
namespace Yi.Framework.TenantManagement.Domain;
|
||||
|
||||
[Serializable]
|
||||
[IgnoreMultiTenancy]
|
||||
public class TenantCacheItem
|
||||
{
|
||||
private const string CacheKeyFormat = "i:{0},n:{1}";
|
||||
|
||||
public TenantConfiguration Value { get; set; }
|
||||
|
||||
public TenantCacheItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TenantCacheItem(TenantConfiguration value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public static string CalculateCacheKey(Guid? id, string name)
|
||||
{
|
||||
if (id == null && name.IsNullOrWhiteSpace())
|
||||
{
|
||||
throw new AbpException("Both id and name can't be invalid.");
|
||||
}
|
||||
|
||||
return string.Format(CacheKeyFormat,
|
||||
id?.ToString() ?? "null",
|
||||
name.IsNullOrWhiteSpace() ? "null" : name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user