public async Task Delete(string name, string providerName, string providerKey)
        {
            LinSetting setting = await _settingRepository.FindAsync(name, providerName, providerKey);;

            if (setting != null)
            {
                await _settingRepository.DeleteAsync(setting.Id);
            }
        }
Exemplo n.º 2
0
        public async Task DeleteAsync(string name, string providerName, string providerKey)
        {
            var setting = await SettingRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false);

            if (setting != null)
            {
                await SettingRepository.DeleteAsync(setting).ConfigureAwait(false);
            }
        }
Exemplo n.º 3
0
        public virtual async Task DeleteAsync(string name, string providerName, string providerKey)
        {
            var setting = await SettingRepository.FindAsync(name, providerName, providerKey);

            if (setting != null)
            {
                await SettingRepository.DeleteAsync(setting);
            }
        }
        public virtual async Task DeleteAsync(string name, string providerName, string providerKey)
        {
            var setting = await SettingRepository.FindAsync(name, providerName, providerKey);

            if (setting != null)
            {
                await SettingRepository.DeleteAsync(setting);

                await Cache.RemoveAsync(CalculateCacheKey(CurrentTenant.Id, name, providerName, providerKey), considerUow : true);
            }
        }
Exemplo n.º 5
0
        public async Task SetAsync(string name, string value, string providerName, string providerKey)
        {
            var setting = await SettingRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false);

            if (setting == null)
            {
                setting = new Setting(GuidGenerator.Create(), name, value, providerName, providerKey);
                await SettingRepository.InsertAsync(setting).ConfigureAwait(false);
            }
            else
            {
                setting.Value = value;
                await SettingRepository.UpdateAsync(setting).ConfigureAwait(false);
            }
        }
        public virtual async Task SetAsync(string name, string value, string providerName, string providerKey)
        {
            var setting = await SettingRepository.FindAsync(name, providerName, providerKey);

            if (setting == null)
            {
                setting = new PropertySetting(GuidGenerator.Create(), name, value, providerName, providerKey);
                await SettingRepository.InsertAsync(setting);
            }
            else
            {
                setting.Value = value;
                await SettingRepository.UpdateAsync(setting);
            }

            await Cache.SetAsync(CalculateCacheKey(CurrentTenant.Id, name, providerName, providerKey), new PropertySettingCacheItem(setting?.Value, setting.Visible, setting.RequiredRegEx, setting?.RegExRule), considerUow : true);
        }
Exemplo n.º 7
0
        public virtual 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);
            }

            await Cache.SetAsync(CalculateCacheKey(name, providerName, providerKey), new SettingCacheItem(setting?.Value), considerUow : true);
        }
Exemplo n.º 8
0
        public async Task FindAsync()
        {
            (await SettingRepository.FindAsync(
                 "MySetting1",
                 GlobalSettingValueProvider.ProviderName,
                 null
                 )).Value.ShouldBe("42");

            (await SettingRepository.FindAsync(
                 "MySetting2",
                 UserSettingValueProvider.ProviderName,
                 TestData.User1Id.ToString()
                 )).Value.ShouldBe("user1-store-value");

            (await SettingRepository.FindAsync(
                 "Undefined-Setting",
                 GlobalSettingValueProvider.ProviderName,
                 null
                 )).ShouldBeNull();
        }
Exemplo n.º 9
0
        protected virtual async Task <SettingCacheItem> GetCacheItemAsync(string name, string providerName, string providerKey)
        {
            var cacheKey  = CalculateCacheKey(name, providerName, providerKey);
            var cacheItem = await Cache.GetAsync(cacheKey).ConfigureAwait(false);

            if (cacheItem != null)
            {
                return(cacheItem);
            }

            var setting = await SettingRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false);

            cacheItem = new SettingCacheItem(setting?.Value);

            await Cache.SetAsync(
                cacheKey,
                cacheItem
                ).ConfigureAwait(false);

            return(cacheItem);
        }