Exemplo n.º 1
0
 public static T GetCachedObject <T>(this IConfigSettingElement settingElement, string objectSettingName, bool autoInit, Action <T> initializer)
 {
     return(settingElement.GetObjectContext(objectSettingName, () => settingElement.GetObject(objectSettingName, autoInit, initializer)));
 }
Exemplo n.º 2
0
 public static object GetCachedObject(this IConfigSettingElement settingElement, string objectSettingName, bool autoInit)
 {
     return(settingElement.GetObjectContext(objectSettingName, () => settingElement.GetObject(objectSettingName, autoInit)));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 获取配置值集合
 /// </summary>
 /// <typeparam name="T">值类型</typeparam>
 /// <param name="settingElement">强类型配置实例</param>
 /// <param name="name">值名</param>
 /// <param name="settingName">集合值名</param>
 /// <param name="initializer">对元素进行初始化</param>
 /// <returns>配置值集合</returns>
 public static T[] GetCachedSettingsWithInitializer <T>(this IConfigSettingElement settingElement, string name, string settingName, Action <T> initializer) where T : IConfigSettingElement, new()
 {
     return(settingElement.GetObjectContext(name, () => settingElement.GetSettingsWithInitializer(name, settingName, initializer).ToArray()));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 获取配置值集合
 /// </summary>
 /// <typeparam name="T">值类型</typeparam>
 /// <param name="settingElement">强类型配置实例</param>
 /// <param name="name">值名</param>
 /// <param name="settingName">集合值名</param>
 /// <returns>配置值集合</returns>
 public static T[] GetCachedSettings <T>(this IConfigSettingElement settingElement, string name, string settingName) where T : IConfigSettingElement, new()
 {
     return(settingElement.GetObjectContext(name, () => settingElement.GetSettings <T>(name, settingName).ToArray()));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 获取配置值
 /// </summary>
 /// <param name="settingElement">强类型配置实例</param>
 /// <param name="name">值名</param>
 /// <returns>配置值</returns>
 public static string GetCachedSetting(this IConfigSettingElement settingElement, string name)
 {
     return(settingElement.GetObjectContext(name, () => settingElement.GetSetting(name)));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 获取配置值
 /// </summary>
 /// <typeparam name="T">值类型</typeparam>
 /// <param name="settingElement">强类型配置实例</param>
 /// <returns>配置值</returns>
 public static T GetCachedSetting <T>(this IConfigSettingElement settingElement)
 {
     return(settingElement.GetObjectContext(typeof(IConfigSettingElement), () => settingElement.GetSetting <T>()));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 获取配置值
 /// </summary>
 /// <typeparam name="T">值类型</typeparam>
 /// <param name="settingElement">强类型配置实例</param>
 /// <param name="name">值名</param>
 /// <param name="defaultValue">值缺省值</param>
 /// <returns>配置值</returns>
 public static T GetCachedSetting <T>(this IConfigSettingElement settingElement, string name, T defaultValue)
 {
     return(settingElement.GetObjectContext(name, () => settingElement.GetSetting(name, defaultValue)));
 }