예제 #1
0
        public static void Save(IAutoConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            var genericConfigs = GetConfigDescription(config.GetType()).CreateGenericConfigs(config);

            GetService().AddOrUpdate(genericConfigs);
        }
예제 #2
0
        public IEnumerable <GenericConfig> CreateGenericConfigs(IAutoConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            if (config.GetType() != ConfigType)
            {
                throw new ArgumentException($"config must with type {ConfigType.Name}");
            }
            IList <GenericConfig> list = new List <GenericConfig>();

            foreach (var item in Properties)
            {
                list.Add(item.MakeGenericConfig(config));
            }
            return(list);
        }