mirror of https://github.com/abpframework/abp.git
106 changed files with 1174 additions and 623 deletions
@ -0,0 +1,13 @@ |
|||||
|
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; |
||||
|
using Volo.Abp.Threading; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.Client |
||||
|
{ |
||||
|
public static class CachedApplicationConfigurationClientExtensions |
||||
|
{ |
||||
|
public static ApplicationConfigurationDto Get(this ICachedApplicationConfigurationClient client) |
||||
|
{ |
||||
|
return AsyncHelper.RunSync(client.GetAsync); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,70 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Localization; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Microsoft.Extensions.Logging.Abstractions; |
||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.Client |
||||
|
{ |
||||
|
public class RemoteLocalizationContributor : ILocalizationResourceContributor |
||||
|
{ |
||||
|
private LocalizationResource _resource; |
||||
|
private ICachedApplicationConfigurationClient _applicationConfigurationClient; |
||||
|
private ILogger<RemoteLocalizationContributor> _logger; |
||||
|
|
||||
|
public void Initialize(LocalizationResourceInitializationContext context) |
||||
|
{ |
||||
|
_resource = context.Resource; |
||||
|
_applicationConfigurationClient = context.ServiceProvider.GetRequiredService<ICachedApplicationConfigurationClient>(); |
||||
|
_logger = context.ServiceProvider.GetService<ILogger<RemoteLocalizationContributor>>() |
||||
|
?? NullLogger<RemoteLocalizationContributor>.Instance; |
||||
|
} |
||||
|
|
||||
|
public LocalizedString GetOrNull(string cultureName, string name) |
||||
|
{ |
||||
|
var resource = GetResourceOrNull(); |
||||
|
if (resource == null) |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
var value = resource.GetOrDefault(name); |
||||
|
if (value == null) |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
return new LocalizedString(name, value); |
||||
|
} |
||||
|
|
||||
|
public void Fill(string cultureName, Dictionary<string, LocalizedString> dictionary) |
||||
|
{ |
||||
|
var resource = GetResourceOrNull(); |
||||
|
if (resource == null) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
foreach (var keyValue in resource) |
||||
|
{ |
||||
|
dictionary[keyValue.Key] = new LocalizedString(keyValue.Key, keyValue.Value); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private Dictionary<string, string> GetResourceOrNull() |
||||
|
{ |
||||
|
var resource = _applicationConfigurationClient |
||||
|
.Get() |
||||
|
.Localization.Values |
||||
|
.GetOrDefault(_resource.ResourceName); |
||||
|
|
||||
|
if (resource == null) |
||||
|
{ |
||||
|
_logger.LogWarning($"Could not find the localization resource {_resource.ResourceName} on the remote server!"); |
||||
|
} |
||||
|
|
||||
|
return resource; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.Client |
||||
|
{ |
||||
|
public class RemoteSettingProvider : ISettingProvider, ITransientDependency |
||||
|
{ |
||||
|
protected ICachedApplicationConfigurationClient ConfigurationClient { get; } |
||||
|
|
||||
|
public RemoteSettingProvider(ICachedApplicationConfigurationClient configurationClient) |
||||
|
{ |
||||
|
ConfigurationClient = configurationClient; |
||||
|
} |
||||
|
|
||||
|
public async Task<string> GetOrNullAsync(string name) |
||||
|
{ |
||||
|
var configuration = await ConfigurationClient.GetAsync(); |
||||
|
return configuration.Setting.Values.GetOrDefault(name); |
||||
|
} |
||||
|
|
||||
|
public async Task<List<SettingValue>> GetAllAsync() |
||||
|
{ |
||||
|
var configuration = await ConfigurationClient.GetAsync(); |
||||
|
return configuration |
||||
|
.Setting.Values |
||||
|
.Select(s => new SettingValue(s.Key, s.Value)) |
||||
|
.ToList(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations |
||||
|
{ |
||||
|
[Serializable] |
||||
|
public class ApplicationSettingConfigurationDto |
||||
|
{ |
||||
|
public Dictionary<string, string> Values { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -1,20 +1,13 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
using Volo.Abp.Data; |
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
using Volo.Abp.Settings; |
|
||||
|
|
||||
namespace Volo.Abp.MultiTenancy |
namespace Volo.Abp.MultiTenancy |
||||
{ |
{ |
||||
[DependsOn(typeof(AbpDataModule))] |
[DependsOn( |
||||
[DependsOn(typeof(AbpSettingsModule))] |
typeof(AbpDataModule) |
||||
public class AbpMultiTenancyAbstractionsModule : AbpModule //TODO: Rename to AbpMultiTenancyModule
|
)] |
||||
|
public class AbpMultiTenancyAbstractionsModule : AbpModule //TODO: Rename to AbpMultiTenancyModule?
|
||||
{ |
{ |
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
Configure<SettingOptions>(options => |
|
||||
{ |
|
||||
options.ValueProviders.Add<TenantSettingValueProvider>(); |
|
||||
}); |
|
||||
} |
|
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,45 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Settings; |
|
||||
|
|
||||
namespace Volo.Abp.MultiTenancy |
|
||||
{ |
|
||||
public class TenantSettingValueProvider : SettingValueProvider |
|
||||
{ |
|
||||
public const string ProviderName = "Tenant"; |
|
||||
|
|
||||
public override string Name => ProviderName; |
|
||||
|
|
||||
protected ICurrentTenant CurrentTenant { get; } |
|
||||
|
|
||||
public TenantSettingValueProvider(ISettingStore settingStore, ICurrentTenant currentTenant) |
|
||||
: base(settingStore) |
|
||||
{ |
|
||||
CurrentTenant = currentTenant; |
|
||||
} |
|
||||
|
|
||||
public override async Task<string> GetOrNullAsync(SettingDefinition setting, string providerKey) |
|
||||
{ |
|
||||
return await SettingStore.GetOrNullAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); |
|
||||
} |
|
||||
|
|
||||
public override Task SetAsync(SettingDefinition setting, string value, string providerKey) |
|
||||
{ |
|
||||
return SettingStore.SetAsync(setting.Name, value, Name, NormalizeProviderKey(providerKey)); |
|
||||
} |
|
||||
|
|
||||
public override Task ClearAsync(SettingDefinition setting, string providerKey) |
|
||||
{ |
|
||||
return SettingStore.DeleteAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); |
|
||||
} |
|
||||
|
|
||||
private string NormalizeProviderKey(string providerKey) |
|
||||
{ |
|
||||
if (providerKey == null && CurrentTenant.Id.HasValue) |
|
||||
{ |
|
||||
return CurrentTenant.Id.Value.ToString(); |
|
||||
} |
|
||||
|
|
||||
return providerKey; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,15 +1,27 @@ |
|||||
using Volo.Abp.Localization; |
using Volo.Abp.Localization; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
using Volo.Abp.Security; |
using Volo.Abp.Security; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
namespace Volo.Abp.Settings |
namespace Volo.Abp.Settings |
||||
{ |
{ |
||||
[DependsOn( |
[DependsOn( |
||||
typeof(AbpLocalizationAbstractionsModule), |
typeof(AbpLocalizationAbstractionsModule), |
||||
typeof(AbpSecurityModule) |
typeof(AbpSecurityModule), |
||||
|
typeof(AbpMultiTenancyAbstractionsModule) |
||||
)] |
)] |
||||
public class AbpSettingsModule : AbpModule |
public class AbpSettingsModule : AbpModule |
||||
{ |
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<SettingOptions>(options => |
||||
|
{ |
||||
|
options.ValueProviders.Add<DefaultValueSettingValueProvider>(); |
||||
|
options.ValueProviders.Add<GlobalSettingValueProvider>(); |
||||
|
options.ValueProviders.Add<TenantSettingValueProvider>(); |
||||
|
options.ValueProviders.Add<UserSettingValueProvider>(); |
||||
|
}); |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,13 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace Volo.Abp.Settings |
||||
|
{ |
||||
|
public interface ISettingProvider |
||||
|
{ |
||||
|
Task<string> GetOrNullAsync([NotNull]string name); |
||||
|
|
||||
|
Task<List<SettingValue>> GetAllAsync(); |
||||
|
} |
||||
|
} |
||||
@ -1,17 +1,14 @@ |
|||||
using System.Collections.Generic; |
using System.Threading.Tasks; |
||||
using System.Threading.Tasks; |
|
||||
using JetBrains.Annotations; |
using JetBrains.Annotations; |
||||
|
|
||||
namespace Volo.Abp.Settings |
namespace Volo.Abp.Settings |
||||
{ |
{ |
||||
public interface ISettingStore |
public interface ISettingStore |
||||
{ |
{ |
||||
Task<string> GetOrNullAsync([NotNull] string name, [CanBeNull] string providerName, [CanBeNull] string providerKey); |
Task<string> GetOrNullAsync( |
||||
|
[NotNull] string name, |
||||
Task SetAsync([NotNull] string name, [NotNull] string value, [CanBeNull] string providerName, [CanBeNull] string providerKey); |
[CanBeNull] string providerName, |
||||
|
[CanBeNull] string providerKey |
||||
Task<List<SettingValue>> GetListAsync([CanBeNull] string providerName, [CanBeNull] string providerKey); |
); |
||||
|
|
||||
Task DeleteAsync([NotNull] string name, [CanBeNull]string providerName, [CanBeNull]string providerKey); |
|
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,31 +0,0 @@ |
|||||
using System; |
|
||||
using System.Threading.Tasks; |
|
||||
using JetBrains.Annotations; |
|
||||
|
|
||||
namespace Volo.Abp.Settings |
|
||||
{ |
|
||||
public static class SettingManagerExtensions |
|
||||
{ |
|
||||
public static async Task<bool> IsTrueAsync([NotNull] this ISettingManager settingManager, [NotNull] string name) |
|
||||
{ |
|
||||
Check.NotNull(settingManager, nameof(settingManager)); |
|
||||
Check.NotNull(name, nameof(name)); |
|
||||
|
|
||||
return string.Equals( |
|
||||
await settingManager.GetOrNullAsync(name), |
|
||||
"true", |
|
||||
StringComparison.OrdinalIgnoreCase |
|
||||
); |
|
||||
} |
|
||||
|
|
||||
public static async Task<T> GetAsync<T>([NotNull] this ISettingManager settingManager, [NotNull] string name, T defaultValue = default) |
|
||||
where T : struct |
|
||||
{ |
|
||||
Check.NotNull(settingManager, nameof(settingManager)); |
|
||||
Check.NotNull(name, nameof(name)); |
|
||||
|
|
||||
var value = await settingManager.GetOrNullAsync(name); |
|
||||
return value?.To<T>() ?? defaultValue; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,34 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
using JetBrains.Annotations; |
|
||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace Volo.Abp.Settings |
|
||||
{ |
|
||||
public static class SettingManagerSyncExtensions |
|
||||
{ |
|
||||
public static string GetOrNull([NotNull] this ISettingManager settingManager, [NotNull] string name) |
|
||||
{ |
|
||||
Check.NotNull(settingManager, nameof(settingManager)); |
|
||||
|
|
||||
return AsyncHelper.RunSync(() => settingManager.GetOrNullAsync(name)); |
|
||||
} |
|
||||
|
|
||||
public static List<SettingValue> GetAll([NotNull] this ISettingManager settingManager) |
|
||||
{ |
|
||||
Check.NotNull(settingManager, nameof(settingManager)); |
|
||||
|
|
||||
return AsyncHelper.RunSync(settingManager.GetAllAsync); |
|
||||
} |
|
||||
|
|
||||
public static T Get<T>([NotNull] this ISettingManager settingManager, [NotNull] string name, T defaultValue = default) |
|
||||
where T : struct |
|
||||
{ |
|
||||
return AsyncHelper.RunSync(() => settingManager.GetAsync(name, defaultValue)); |
|
||||
} |
|
||||
|
|
||||
public static bool IsTrue([NotNull] this ISettingManager settingManager, [NotNull] string name) |
|
||||
{ |
|
||||
return AsyncHelper.RunSync(() => settingManager.IsTrueAsync(name)); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,101 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace Volo.Abp.Settings |
||||
|
{ |
||||
|
public class SettingProvider : ISettingProvider, ITransientDependency |
||||
|
{ |
||||
|
protected ISettingDefinitionManager SettingDefinitionManager { get; } |
||||
|
protected Lazy<List<ISettingValueProvider>> Providers { get; } |
||||
|
protected ISettingEncryptionService SettingEncryptionService { get; } |
||||
|
protected SettingOptions Options { get; } |
||||
|
|
||||
|
public SettingProvider( |
||||
|
IOptions<SettingOptions> options, |
||||
|
IServiceProvider serviceProvider, |
||||
|
ISettingDefinitionManager settingDefinitionManager, |
||||
|
ISettingEncryptionService settingEncryptionService) |
||||
|
{ |
||||
|
SettingDefinitionManager = settingDefinitionManager; |
||||
|
SettingEncryptionService = settingEncryptionService; |
||||
|
|
||||
|
Options = options.Value; |
||||
|
|
||||
|
Providers = new Lazy<List<ISettingValueProvider>>( |
||||
|
() => Options |
||||
|
.ValueProviders |
||||
|
.Select(c => serviceProvider.GetRequiredService(c) as ISettingValueProvider) |
||||
|
.ToList(), |
||||
|
true |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<string> GetOrNullAsync(string name) |
||||
|
{ |
||||
|
var setting = SettingDefinitionManager.Get(name); |
||||
|
var providers = Enumerable |
||||
|
.Reverse(Providers.Value); |
||||
|
|
||||
|
if (setting.Providers.Any()) |
||||
|
{ |
||||
|
providers = providers.Where(p => setting.Providers.Contains(p.Name)); |
||||
|
} |
||||
|
|
||||
|
//TODO: How to implement setting.IsInherited?
|
||||
|
|
||||
|
var value = await GetOrNullValueFromProvidersAsync(providers, setting); |
||||
|
if (setting.IsEncrypted) |
||||
|
{ |
||||
|
value = SettingEncryptionService.Decrypt(setting, value); |
||||
|
} |
||||
|
|
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<List<SettingValue>> GetAllAsync() |
||||
|
{ |
||||
|
var settingValues = new Dictionary<string, SettingValue>(); |
||||
|
var settingDefinitions = SettingDefinitionManager.GetAll(); |
||||
|
|
||||
|
foreach (var provider in Providers.Value) |
||||
|
{ |
||||
|
foreach (var setting in settingDefinitions) |
||||
|
{ |
||||
|
var value = await provider.GetOrNullAsync(setting); |
||||
|
if (value != null) |
||||
|
{ |
||||
|
if (setting.IsEncrypted) |
||||
|
{ |
||||
|
value = SettingEncryptionService.Decrypt(setting, value); |
||||
|
} |
||||
|
|
||||
|
settingValues[setting.Name] = new SettingValue(setting.Name, value); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return settingValues.Values.ToList(); |
||||
|
} |
||||
|
|
||||
|
protected virtual async Task<string> GetOrNullValueFromProvidersAsync( |
||||
|
IEnumerable<ISettingValueProvider> providers, |
||||
|
SettingDefinition setting) |
||||
|
{ |
||||
|
foreach (var provider in providers) |
||||
|
{ |
||||
|
var value = await provider.GetOrNullAsync(setting); |
||||
|
if (value != null) |
||||
|
{ |
||||
|
return value; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,56 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
using Volo.Abp.Threading; |
||||
|
|
||||
|
namespace Volo.Abp.Settings |
||||
|
{ |
||||
|
public static class SettingProviderExtensions |
||||
|
{ |
||||
|
public static async Task<bool> IsTrueAsync([NotNull] this ISettingProvider settingProvider, [NotNull] string name) |
||||
|
{ |
||||
|
Check.NotNull(settingProvider, nameof(settingProvider)); |
||||
|
Check.NotNull(name, nameof(name)); |
||||
|
|
||||
|
return string.Equals( |
||||
|
await settingProvider.GetOrNullAsync(name), |
||||
|
"true", |
||||
|
StringComparison.OrdinalIgnoreCase |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
public static async Task<T> GetAsync<T>([NotNull] this ISettingProvider settingProvider, [NotNull] string name, T defaultValue = default) |
||||
|
where T : struct |
||||
|
{ |
||||
|
Check.NotNull(settingProvider, nameof(settingProvider)); |
||||
|
Check.NotNull(name, nameof(name)); |
||||
|
|
||||
|
var value = await settingProvider.GetOrNullAsync(name); |
||||
|
return value?.To<T>() ?? defaultValue; |
||||
|
} |
||||
|
|
||||
|
public static string GetOrNull([NotNull] this ISettingProvider settingProvider, [NotNull] string name) |
||||
|
{ |
||||
|
Check.NotNull(settingProvider, nameof(settingProvider)); |
||||
|
return AsyncHelper.RunSync(() => settingProvider.GetOrNullAsync(name)); |
||||
|
} |
||||
|
|
||||
|
public static List<SettingValue> GetAll([NotNull] this ISettingProvider settingProvider) |
||||
|
{ |
||||
|
Check.NotNull(settingProvider, nameof(settingProvider)); |
||||
|
return AsyncHelper.RunSync(settingProvider.GetAllAsync); |
||||
|
} |
||||
|
|
||||
|
public static T Get<T>([NotNull] this ISettingProvider settingProvider, [NotNull] string name, T defaultValue = default) |
||||
|
where T : struct |
||||
|
{ |
||||
|
return AsyncHelper.RunSync(() => settingProvider.GetAsync(name, defaultValue)); |
||||
|
} |
||||
|
|
||||
|
public static bool IsTrue([NotNull] this ISettingProvider settingProvider, [NotNull] string name) |
||||
|
{ |
||||
|
return AsyncHelper.RunSync(() => settingProvider.IsTrueAsync(name)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace Volo.Abp.Settings |
||||
|
{ |
||||
|
public class TenantSettingValueProvider : SettingValueProvider |
||||
|
{ |
||||
|
public const string ProviderName = "Tenant"; |
||||
|
|
||||
|
public override string Name => ProviderName; |
||||
|
|
||||
|
protected ICurrentTenant CurrentTenant { get; } |
||||
|
|
||||
|
public TenantSettingValueProvider(ISettingStore settingStore, ICurrentTenant currentTenant) |
||||
|
: base(settingStore) |
||||
|
{ |
||||
|
CurrentTenant = currentTenant; |
||||
|
} |
||||
|
|
||||
|
public override async Task<string> GetOrNullAsync(SettingDefinition setting) |
||||
|
{ |
||||
|
return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentTenant.Id?.ToString()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Volo.Abp.Settings |
||||
|
{ |
||||
|
public class UserSettingValueProvider : SettingValueProvider |
||||
|
{ |
||||
|
public const string ProviderName = "User"; |
||||
|
|
||||
|
public override string Name => ProviderName; |
||||
|
|
||||
|
protected ICurrentUser CurrentUser { get; } |
||||
|
|
||||
|
public UserSettingValueProvider(ISettingStore settingStore, ICurrentUser currentUser) |
||||
|
: base(settingStore) |
||||
|
{ |
||||
|
CurrentUser = currentUser; |
||||
|
} |
||||
|
|
||||
|
public override async Task<string> GetOrNullAsync(SettingDefinition setting) |
||||
|
{ |
||||
|
if (CurrentUser.Id == null) |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentUser.Id.ToString()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,53 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Shouldly; |
|
||||
using Xunit; |
|
||||
|
|
||||
namespace Volo.Abp.Settings |
|
||||
{ |
|
||||
public class SettingManager_Tests : AbpIntegratedTest<AbpSettingsTestModule> |
|
||||
{ |
|
||||
private readonly ISettingManager _settingManager; |
|
||||
|
|
||||
public SettingManager_Tests() |
|
||||
{ |
|
||||
_settingManager = GetRequiredService<ISettingManager>(); |
|
||||
} |
|
||||
|
|
||||
[Fact] |
|
||||
public async Task Should_Get_Null_If_No_Value_Provided_And_No_Default_Value() |
|
||||
{ |
|
||||
(await _settingManager.GetOrNullAsync(TestSettingNames.TestSettingWithoutDefaultValue)) |
|
||||
.ShouldBeNull(); |
|
||||
} |
|
||||
|
|
||||
[Fact] |
|
||||
public async Task Should_Get_Default_Value_If_No_Value_Provided_And_There_Is_A_Default_Value() |
|
||||
{ |
|
||||
(await _settingManager.GetOrNullAsync(TestSettingNames.TestSettingWithDefaultValue)) |
|
||||
.ShouldBe("default-value"); |
|
||||
} |
|
||||
|
|
||||
[Theory] |
|
||||
[InlineData(null)] |
|
||||
[InlineData("")] |
|
||||
[InlineData("abc")] |
|
||||
[InlineData("This is a relatively long text... This is a relatively long text... This is a relatively long text... ")] |
|
||||
public async Task Should_Set_And_Get_Encrypted_Values(string plainValue) |
|
||||
{ |
|
||||
(await _settingManager.GetOrNullAsync(TestSettingNames.TestSettingEncrypted)) |
|
||||
.ShouldBeNull(); |
|
||||
|
|
||||
await _settingManager.SetAsync( |
|
||||
TestSettingNames.TestSettingEncrypted, |
|
||||
plainValue, |
|
||||
TestSettingValueProvider.ProviderName, |
|
||||
null |
|
||||
); |
|
||||
|
|
||||
(await _settingManager.GetOrNullAsync(TestSettingNames.TestSettingEncrypted)) |
|
||||
.ShouldBe(plainValue); |
|
||||
} |
|
||||
|
|
||||
//TODO: Needs more tests with more advanced scenarios.
|
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,30 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Shouldly; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp.Settings |
||||
|
{ |
||||
|
public class SettingProvider_Tests : AbpIntegratedTest<AbpSettingsTestModule> |
||||
|
{ |
||||
|
private readonly ISettingProvider _settingProvider; |
||||
|
|
||||
|
public SettingProvider_Tests() |
||||
|
{ |
||||
|
_settingProvider = GetRequiredService<ISettingProvider>(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task Should_Get_Null_If_No_Value_Provided_And_No_Default_Value() |
||||
|
{ |
||||
|
(await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithoutDefaultValue)) |
||||
|
.ShouldBeNull(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task Should_Get_Default_Value_If_No_Value_Provided_And_There_Is_A_Default_Value() |
||||
|
{ |
||||
|
(await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithDefaultValue)) |
||||
|
.ShouldBe("default-value"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,9 +1,21 @@ |
|||||
using Volo.Abp.Modularity; |
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.PermissionManagement.Localization; |
||||
|
|
||||
namespace Volo.Abp.PermissionManagement |
namespace Volo.Abp.PermissionManagement |
||||
{ |
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpLocalizationModule) |
||||
|
)] |
||||
public class AbpPermissionManagementDomainSharedModule : AbpModule |
public class AbpPermissionManagementDomainSharedModule : AbpModule |
||||
{ |
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Resources |
||||
|
.Add<AbpPermissionManagementResource>("en"); |
||||
|
}); |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,10 @@ |
|||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace Volo.Abp.PermissionManagement.Localization |
||||
|
{ |
||||
|
[LocalizationResourceName("AbpPermissionManagement")] |
||||
|
public class AbpPermissionManagementResource |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -1,15 +0,0 @@ |
|||||
using Localization.Resources.AbpUi; |
|
||||
using Volo.Abp.Localization; |
|
||||
using Volo.Abp.Localization.Resources.AbpValidation; |
|
||||
|
|
||||
namespace Volo.Abp.PermissionManagement.Web.Localization.Resources.AbpPermissionManagement |
|
||||
{ |
|
||||
[InheritResource( |
|
||||
typeof(AbpValidationResource), |
|
||||
typeof(AbpUiResource))] |
|
||||
[LocalizationResourceName("AbpPermissionManagement")] |
|
||||
public class AbpPermissionManagementResource |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,26 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public class DefaultValueSettingManagementProvider : ISettingManagementProvider, ISingletonDependency |
||||
|
{ |
||||
|
public string Name => DefaultValueSettingValueProvider.ProviderName; |
||||
|
|
||||
|
public Task<string> GetOrNullAsync(SettingDefinition setting, string providerKey) |
||||
|
{ |
||||
|
return Task.FromResult(setting.DefaultValue); |
||||
|
} |
||||
|
|
||||
|
public Task SetAsync(SettingDefinition setting, string value, string providerKey) |
||||
|
{ |
||||
|
throw new AbpException($"Can not set default value of a setting. It is only possible while defining the setting in a {typeof(ISettingDefinitionProvider)} implementation."); |
||||
|
} |
||||
|
|
||||
|
public Task ClearAsync(SettingDefinition setting, string providerKey) |
||||
|
{ |
||||
|
throw new AbpException($"Can not clear default value of a setting. It is only possible while defining the setting in a {typeof(ISettingDefinitionProvider)} implementation."); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public static class DefaultValueSettingManagerExtensions |
||||
|
{ |
||||
|
public static Task<string> GetOrNullDefaultAsync(this ISettingManager settingManager, [NotNull] string name, bool fallback = true) |
||||
|
{ |
||||
|
return settingManager.GetOrNullAsync(name, DefaultValueSettingValueProvider.ProviderName, null, fallback); |
||||
|
} |
||||
|
|
||||
|
public static Task<List<SettingValue>> GetAllDefaultAsync(this ISettingManager settingManager, bool fallback = true) |
||||
|
{ |
||||
|
return settingManager.GetAllAsync(DefaultValueSettingValueProvider.ProviderName, null, fallback); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public class GlobalSettingManagementProvider : SettingManagementProvider, ITransientDependency |
||||
|
{ |
||||
|
public override string Name => GlobalSettingValueProvider.ProviderName; |
||||
|
|
||||
|
public GlobalSettingManagementProvider(ISettingManagementStore settingManagementStore) |
||||
|
: base(settingManagementStore) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
protected override string NormalizeProviderKey(string providerKey) |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,8 +1,9 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using JetBrains.Annotations; |
using JetBrains.Annotations; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
namespace Volo.Abp.Settings |
namespace Volo.Abp.SettingManagement |
||||
{ |
{ |
||||
public static class GlobalSettingManagerExtensions |
public static class GlobalSettingManagerExtensions |
||||
{ |
{ |
||||
@ -0,0 +1,17 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public interface ISettingManagementProvider |
||||
|
{ |
||||
|
string Name { get; } |
||||
|
|
||||
|
Task<string> GetOrNullAsync([NotNull] SettingDefinition setting, [CanBeNull] string providerKey); |
||||
|
|
||||
|
Task SetAsync([NotNull] SettingDefinition setting, [NotNull] string value, [CanBeNull] string providerKey); |
||||
|
|
||||
|
Task ClearAsync([NotNull] SettingDefinition setting, [CanBeNull] string providerKey); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public interface ISettingManagementStore |
||||
|
{ |
||||
|
Task<string> GetOrNullAsync(string name, string providerName, string providerKey); |
||||
|
|
||||
|
Task<List<SettingValue>> GetListAsync(string providerName, string providerKey); |
||||
|
|
||||
|
Task SetAsync(string name, string value, string providerName, string providerKey); |
||||
|
|
||||
|
Task DeleteAsync(string name, string providerName, string providerKey); |
||||
|
} |
||||
|
} |
||||
@ -1,17 +1,14 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using JetBrains.Annotations; |
using JetBrains.Annotations; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
namespace Volo.Abp.Settings |
namespace Volo.Abp.SettingManagement |
||||
{ |
{ |
||||
public interface ISettingManager |
public interface ISettingManager |
||||
{ |
{ |
||||
Task<string> GetOrNullAsync([NotNull]string name); |
|
||||
|
|
||||
Task<string> GetOrNullAsync([NotNull]string name, [NotNull] string providerName, [CanBeNull] string providerKey, bool fallback = true); |
Task<string> GetOrNullAsync([NotNull]string name, [NotNull] string providerName, [CanBeNull] string providerKey, bool fallback = true); |
||||
|
|
||||
Task<List<SettingValue>> GetAllAsync(); |
|
||||
|
|
||||
Task<List<SettingValue>> GetAllAsync([NotNull] string providerName, [CanBeNull] string providerKey, bool fallback = true); |
Task<List<SettingValue>> GetAllAsync([NotNull] string providerName, [CanBeNull] string providerKey, bool fallback = true); |
||||
|
|
||||
Task SetAsync([NotNull] string name, [CanBeNull] string value, [NotNull] string providerName, [CanBeNull] string providerKey, bool forceToSet = false); |
Task SetAsync([NotNull] string name, [CanBeNull] string value, [NotNull] string providerName, [CanBeNull] string providerKey, bool forceToSet = false); |
||||
@ -0,0 +1,14 @@ |
|||||
|
using Volo.Abp.Collections; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public class SettingManagementOptions |
||||
|
{ |
||||
|
public ITypeList<ISettingManagementProvider> Providers { get; } |
||||
|
|
||||
|
public SettingManagementOptions() |
||||
|
{ |
||||
|
Providers = new TypeList<ISettingManagementProvider>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public abstract class SettingManagementProvider : ISettingManagementProvider |
||||
|
{ |
||||
|
public abstract string Name { get; } |
||||
|
|
||||
|
protected ISettingManagementStore SettingManagementStore { get; } |
||||
|
|
||||
|
protected SettingManagementProvider(ISettingManagementStore settingManagementStore) |
||||
|
{ |
||||
|
SettingManagementStore = settingManagementStore; |
||||
|
} |
||||
|
|
||||
|
public async Task<string> GetOrNullAsync(SettingDefinition setting, string providerKey) |
||||
|
{ |
||||
|
return await SettingManagementStore.GetOrNullAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task SetAsync(SettingDefinition setting, string value, string providerKey) |
||||
|
{ |
||||
|
await SettingManagementStore.SetAsync(setting.Name, value, Name, NormalizeProviderKey(providerKey)); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task ClearAsync(SettingDefinition setting, string providerKey) |
||||
|
{ |
||||
|
await SettingManagementStore.DeleteAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); |
||||
|
} |
||||
|
|
||||
|
protected virtual string NormalizeProviderKey(string providerKey) |
||||
|
{ |
||||
|
return providerKey; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,90 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Caching; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public class SettingManagementStore : ISettingManagementStore, ITransientDependency |
||||
|
{ |
||||
|
protected IDistributedCache<SettingCacheItem> Cache { get; } |
||||
|
protected ISettingRepository SettingRepository { get; } |
||||
|
protected IGuidGenerator GuidGenerator { get; } |
||||
|
|
||||
|
public SettingManagementStore( |
||||
|
ISettingRepository settingRepository, |
||||
|
IGuidGenerator guidGenerator, |
||||
|
IDistributedCache<SettingCacheItem> cache) |
||||
|
{ |
||||
|
SettingRepository = settingRepository; |
||||
|
GuidGenerator = guidGenerator; |
||||
|
Cache = cache; |
||||
|
} |
||||
|
|
||||
|
public async Task<string> GetOrNullAsync(string name, string providerName, string providerKey) |
||||
|
{ |
||||
|
var cacheItem = await GetCacheItemAsync(name, providerName, providerKey); |
||||
|
return cacheItem.Value; |
||||
|
} |
||||
|
|
||||
|
public async Task SetAsync(string name, string value, string providerName, string providerKey) |
||||
|
{ |
||||
|
var setting = await SettingRepository.FindAsync(name, providerName, providerKey); |
||||
|
if (setting == null) |
||||
|
{ |
||||
|
setting = new Setting(GuidGenerator.Create(), name, value, providerName, providerKey); |
||||
|
await SettingRepository.InsertAsync(setting); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
setting.Value = value; |
||||
|
await SettingRepository.UpdateAsync(setting); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public async Task<List<SettingValue>> GetListAsync(string providerName, string providerKey) |
||||
|
{ |
||||
|
var settings = await SettingRepository.GetListAsync(providerName, providerKey); |
||||
|
return settings.Select(s => new SettingValue(s.Name, s.Value)).ToList(); |
||||
|
} |
||||
|
|
||||
|
public async Task DeleteAsync(string name, string providerName, string providerKey) |
||||
|
{ |
||||
|
var setting = await SettingRepository.FindAsync(name, providerName, providerKey); |
||||
|
if (setting != null) |
||||
|
{ |
||||
|
await SettingRepository.DeleteAsync(setting); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected virtual async Task<SettingCacheItem> GetCacheItemAsync(string name, string providerName, string providerKey) |
||||
|
{ |
||||
|
var cacheKey = CalculateCacheKey(name, providerName, providerKey); |
||||
|
var cacheItem = await Cache.GetAsync(cacheKey); |
||||
|
|
||||
|
if (cacheItem != null) |
||||
|
{ |
||||
|
return cacheItem; |
||||
|
} |
||||
|
|
||||
|
var setting = await SettingRepository.FindAsync(name, providerName, providerKey); |
||||
|
|
||||
|
cacheItem = new SettingCacheItem(setting?.Value); |
||||
|
|
||||
|
await Cache.SetAsync( |
||||
|
cacheKey, |
||||
|
cacheItem |
||||
|
); |
||||
|
|
||||
|
return cacheItem; |
||||
|
} |
||||
|
|
||||
|
protected virtual string CalculateCacheKey(string name, string providerName, string providerKey) |
||||
|
{ |
||||
|
return SettingCacheItem.CalculateCacheKey(name, providerName, providerKey); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public class TenantSettingManagementProvider : SettingManagementProvider, ITransientDependency |
||||
|
{ |
||||
|
public override string Name => TenantSettingValueProvider.ProviderName; |
||||
|
|
||||
|
protected ICurrentTenant CurrentTenant { get; } |
||||
|
|
||||
|
public TenantSettingManagementProvider( |
||||
|
ISettingManagementStore settingManagementStore, |
||||
|
ICurrentTenant currentTenant) |
||||
|
: base(settingManagementStore) |
||||
|
{ |
||||
|
CurrentTenant = currentTenant; |
||||
|
} |
||||
|
|
||||
|
protected override string NormalizeProviderKey(string providerKey) |
||||
|
{ |
||||
|
if (providerKey != null) |
||||
|
{ |
||||
|
return providerKey; |
||||
|
} |
||||
|
|
||||
|
return CurrentTenant.Id?.ToString(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Settings; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Volo.Abp.SettingManagement |
||||
|
{ |
||||
|
public class UserSettingManagementProvider : SettingManagementProvider, ITransientDependency |
||||
|
{ |
||||
|
public override string Name => UserSettingValueProvider.ProviderName; |
||||
|
|
||||
|
protected ICurrentUser CurrentUser { get; } |
||||
|
|
||||
|
public UserSettingManagementProvider( |
||||
|
ISettingManagementStore settingManagementStore, |
||||
|
ICurrentUser currentUser) |
||||
|
: base(settingManagementStore) |
||||
|
{ |
||||
|
CurrentUser = currentUser; |
||||
|
} |
||||
|
|
||||
|
protected override string NormalizeProviderKey(string providerKey) |
||||
|
{ |
||||
|
if (providerKey != null) |
||||
|
{ |
||||
|
return providerKey; |
||||
|
} |
||||
|
|
||||
|
return CurrentUser.Id?.ToString(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,48 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Settings; |
|
||||
|
|
||||
namespace Volo.Abp.Users |
|
||||
{ |
|
||||
//TODO: Optimization: Get all settings and cache it!
|
|
||||
//TODO: Think if it's true to have this provider in this project?
|
|
||||
|
|
||||
public class UserSettingValueProvider : SettingValueProvider |
|
||||
{ |
|
||||
public const string ProviderName = "User"; |
|
||||
|
|
||||
public override string Name => ProviderName; |
|
||||
|
|
||||
protected ICurrentUser CurrentUser { get; } |
|
||||
|
|
||||
public UserSettingValueProvider(ISettingStore settingStore, ICurrentUser currentUser) |
|
||||
: base(settingStore) |
|
||||
{ |
|
||||
CurrentUser = currentUser; |
|
||||
} |
|
||||
|
|
||||
public override async Task<string> GetOrNullAsync(SettingDefinition setting, string providerKey) |
|
||||
{ |
|
||||
return await SettingStore.GetOrNullAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); |
|
||||
} |
|
||||
|
|
||||
public override Task SetAsync(SettingDefinition setting, string value, string providerKey) |
|
||||
{ |
|
||||
return SettingStore.SetAsync(setting.Name, value, Name, NormalizeProviderKey(providerKey)); |
|
||||
} |
|
||||
|
|
||||
public override Task ClearAsync(SettingDefinition setting, string providerKey) |
|
||||
{ |
|
||||
return SettingStore.DeleteAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); |
|
||||
} |
|
||||
|
|
||||
private string NormalizeProviderKey(string providerKey) |
|
||||
{ |
|
||||
if (providerKey == null && CurrentUser.Id.HasValue) |
|
||||
{ |
|
||||
return CurrentUser.Id.Value.ToString(); |
|
||||
} |
|
||||
|
|
||||
return providerKey; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,22 @@ |
|||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace ProductManagement |
||||
|
{ |
||||
|
/* These setting definitions will be visible to clients that has a ProductManagement.Application.Contracts |
||||
|
* reference. Settings those should be hidden from clients should be defined in the ProductManagement.Application |
||||
|
* package. |
||||
|
*/ |
||||
|
public class ProductManagementSettingDefinitionProvider : SettingDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(ISettingDefinitionContext context) |
||||
|
{ |
||||
|
context.Add( |
||||
|
new SettingDefinition( |
||||
|
ProductManagementSettings.MaxPageSize, |
||||
|
"100", |
||||
|
isVisibleToClients: true |
||||
|
) |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
namespace ProductManagement |
||||
|
{ |
||||
|
public static class ProductManagementSettings |
||||
|
{ |
||||
|
public const string GroupName = "ProductManagement"; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Maximum allowed page size for paged list requests.
|
||||
|
/// </summary>
|
||||
|
public const string MaxPageSize = GroupName + ".MaxPageSize"; |
||||
|
} |
||||
|
} |
||||
@ -1,14 +0,0 @@ |
|||||
using Volo.Abp.Settings; |
|
||||
|
|
||||
namespace ProductManagement |
|
||||
{ |
|
||||
public class ProductManagementSettingDefinitionProvider : SettingDefinitionProvider |
|
||||
{ |
|
||||
public override void Define(ISettingDefinitionContext context) |
|
||||
{ |
|
||||
/* Define module settings here. |
|
||||
* Use names from ProductManagementSettings class. |
|
||||
*/ |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
namespace ProductManagement |
|
||||
{ |
|
||||
public static class ProductManagementSettings |
|
||||
{ |
|
||||
public const string GroupName = "ProductManagement"; |
|
||||
|
|
||||
/* Add constants for setting names. Example: |
|
||||
* public const string MySettingName = GroupName + ".MySettingName"; |
|
||||
*/ |
|
||||
} |
|
||||
} |
|
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue