/// <summary> /// 通过反射构造对象 /// </summary> /// <param name="componentNodeName">配置节点名称</param> /// <returns>构造的对象</returns> private static T GetPlugin(string componentNodeName) { T plugin = (T)PluginBuilder.GetPlugin(typeof(T)); if (null == plugin) { string key = PluginUtils.ConcisionTypeName <T>(); plugin = GetPluginFromComponentNode(componentNodeName, key); } return(plugin); }
/// <summary> /// 获取指定类型插件 /// 如果没有Cache,则Create /// </summary> /// <returns>构造的对象</returns> public static T GetPlugin() { string key = PluginUtils.ConcisionTypeName <T>(); T plugin = (T)cache[key]; lock (syncObj) { if (null == plugin) { plugin = BuildPlugin(); if (plugin != null) { cache[key] = plugin; } } } return(plugin); }