public static AssemblyCreatorGenerator newInstance(Assembly assembly) { AssemblyCreatorGenerator generator = new AssemblyCreatorGenerator(); generator.assembly = assembly; return(generator); }
private static AssemblyCreatorGenerator[] getGenerators(Assembly[] assemblies) { AssemblyCreatorGenerator[] generators = new AssemblyCreatorGenerator[assemblies.Length]; for (int i = 0; i < assemblies.Length; ++i) { generators[i] = AssemblyCreatorGenerator.newInstance(assemblies[i]); generators[i].registerPredicate(type => typeof(IDataSource).IsAssignableFrom(type)); } return generators; }
public static AssemblyBasedFactoryProxy newInstance(IFactory factory, AssemblyCreatorGenerator[] generators) { if (factory == null) { throw new NullReferenceException("Parameter 'factory' is Null"); } if (generators == null) { throw new NullReferenceException("Parameter 'generator' is Null"); } foreach (AssemblyCreatorGenerator generator in generators) { foreach (ICanCreateT<object> creator in generator.getCreators()) { factory.registerCreator(creator.creating(), creator); } } return new AssemblyBasedFactoryProxy(factory); }
/// <summary> /// Factory method implementation. /// </summary> /// <param name="assembly">Assembly to generate creators for.</param> /// <returns>New instance of AssemblyCreatorGenerator.</returns> public static AssemblyCreatorGenerator newInstance(Assembly assembly) { AssemblyCreatorGenerator generator = new AssemblyCreatorGenerator(); generator.assembly = assembly; return generator; }