Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
745 B

using System;
using JetBrains.Annotations;
namespace Volo.Abp.MultiTenancy
{
public static class CurrentTenantExtensions
{
public static Guid GetId([NotNull] this ICurrentTenant currentTenant)
{
Check.NotNull(currentTenant, nameof(currentTenant));
if (currentTenant.Id == null)
{
throw new AbpException("Current Tenant Id is not available!");
}
return currentTenant.Id.Value;
}
public static MultiTenancySides GetMultiTenancySide(this ICurrentTenant currentTenant)
{
return currentTenant.Id.HasValue
? MultiTenancySides.Tenant
: MultiTenancySides.Host;
}
}
}