示例#1
0
        public virtual T Get <T>(string index = null) where T : class, new()
        {
            var clusteredIndex = ConfigProviderHelper.CreateClusteredIndex <T>(index);
            var context        = ConfigService.GetConfig(clusteredIndex);

            return(string.IsNullOrEmpty(context) ? null : SerializeHelper.XmlDeserialize <T>(context.Trim()));
        }
示例#2
0
        public virtual void Save <T>(T configGroup, string index = null) where T : class, new()
        {
            var clusteredIndex = ConfigProviderHelper.CreateClusteredIndex <T>(index);

            ConfigService.SaveConfig(clusteredIndex, SerializeHelper.XmlSerialize(configGroup));
        }
 /// <summary>
 /// 获取配置索引
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="index">索引名称</param>
 /// <returns>
 /// 索引
 /// </returns>
 public string GetClusteredIndex <T>(string index = null) where T : class, new()
 {
     return($"{Path.Combine(configFolder, ConfigProviderHelper.CreateClusteredIndex<T>(index))}.xml");
 }