mirror of https://github.com/abpframework/abp.git
13 changed files with 152 additions and 31 deletions
@ -0,0 +1,16 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.Client; |
||||
|
|
||||
|
public class AbpAspNetCoreMvcClientCacheOptions |
||||
|
{ |
||||
|
public TimeSpan TenantConfigurationCacheAbsoluteExpiration { get; set; } |
||||
|
|
||||
|
public TimeSpan ApplicationConfigurationDtoCacheAbsoluteExpiration { get; set; } |
||||
|
|
||||
|
public AbpAspNetCoreMvcClientCacheOptions() |
||||
|
{ |
||||
|
TenantConfigurationCacheAbsoluteExpiration = TimeSpan.FromMinutes(5); |
||||
|
TenantConfigurationCacheAbsoluteExpiration = TimeSpan.FromSeconds(300); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,6 @@ |
|||||
|
namespace Volo.Abp; |
||||
|
|
||||
|
public class AbpHostEnvironment : IAbpHostEnvironment |
||||
|
{ |
||||
|
public string EnvironmentName { get; set; } |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
using System; |
||||
|
using Microsoft.Extensions.Hosting; |
||||
|
|
||||
|
namespace Volo.Abp; |
||||
|
|
||||
|
public static class AbpHostEnvironmentExtensions |
||||
|
{ |
||||
|
public static bool IsDevelopment(this IAbpHostEnvironment hostEnvironment) |
||||
|
{ |
||||
|
Check.NotNull(hostEnvironment, nameof(hostEnvironment)); |
||||
|
|
||||
|
return hostEnvironment.IsEnvironment(Environments.Development); |
||||
|
} |
||||
|
|
||||
|
public static bool IsStaging(this IAbpHostEnvironment hostEnvironment) |
||||
|
{ |
||||
|
Check.NotNull(hostEnvironment, nameof(hostEnvironment)); |
||||
|
|
||||
|
return hostEnvironment.IsEnvironment(Environments.Staging); |
||||
|
} |
||||
|
|
||||
|
public static bool IsProduction(this IAbpHostEnvironment hostEnvironment) |
||||
|
{ |
||||
|
Check.NotNull(hostEnvironment, nameof(hostEnvironment)); |
||||
|
|
||||
|
return hostEnvironment.IsEnvironment(Environments.Production); |
||||
|
} |
||||
|
|
||||
|
public static bool IsEnvironment(this IAbpHostEnvironment hostEnvironment, string environmentName) |
||||
|
{ |
||||
|
Check.NotNull(hostEnvironment, nameof(hostEnvironment)); |
||||
|
|
||||
|
return string.Equals( |
||||
|
hostEnvironment.EnvironmentName, |
||||
|
environmentName, |
||||
|
StringComparison.OrdinalIgnoreCase); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,6 @@ |
|||||
|
namespace Volo.Abp; |
||||
|
|
||||
|
public interface IAbpHostEnvironment |
||||
|
{ |
||||
|
string EnvironmentName { get; set; } |
||||
|
} |
||||
Loading…
Reference in new issue