コード例 #1
0
        public async Task <ConfigInstance> GetAsync(Type type, ConfigurationIdentity id)
        {
            var setModel = registry.GetConfigSetForConfig(type);
            var model    = setModel.Get(type);

            var configurationSet = await configurationSetService.GetConfigurationSet(setModel.ConfigSetType, id);

            var config = model.GetConfigInstanceFromConfigurationSet(configurationSet);

            return(config);
        }
コード例 #2
0
        private void ClearConfig(Type configurationtype, ConfigurationIdentity identity)
        {
            var setModel = registry.GetConfigSetForConfig(configurationtype);

            ClearCache(setModel.ConfigSetType, identity);
            if (setModel.Get(configurationtype) is ConfigurationOptionModel model)
            {
                var dependencies = registry.SelectMany(s => s.Configs).Where(set => set.ConfigurationSetType != setModel.ConfigSetType && set.GetDependencies().Any(a => a.ConfigurationSet == setModel.ConfigSetType && a.PropertyPath == model.Name)).ToArray();
                foreach (var dependency in dependencies)
                {
                    ClearConfig(dependency.Type, identity);
                }
            }
        }