/// <summary> /// Gets the factory. /// </summary> /// <returns></returns> public static Func <PoolConfiguration, IPEndPoint, IConnectionPool> GetFactory(ConnectionPoolElement element) { return(GetFactory(element.Type)); }
/// <summary> /// Gets the factory. /// </summary> /// <returns></returns> public static Func <PoolConfiguration, IPEndPoint, IConnectionPool> GetFactory(ConnectionPoolElement element) { return((config, endpoint) => { var type = Type.GetType(element.Type); if (type == null) { throw new TypeLoadException(string.Format("Could not find: {0}", element.Type)); } var connectionPool = (IConnectionPool)Activator.CreateInstance(type, config, endpoint); return connectionPool; }); }