public static T GetCachedObject <T>(this IConfigSettingElement settingElement, string objectSettingName, bool autoInit, Action <T> initializer) { return(settingElement.GetObjectContext(objectSettingName, () => settingElement.GetObject(objectSettingName, autoInit, initializer))); }
public static object GetCachedObject(this IConfigSettingElement settingElement, string objectSettingName, bool autoInit) { return(settingElement.GetObjectContext(objectSettingName, () => settingElement.GetObject(objectSettingName, autoInit))); }
/// <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())); }
/// <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())); }
/// <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))); }
/// <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>())); }
/// <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))); }