Esempio n. 1
0
 public static DynamicDataSourceProvider newInstance(string pathToDataSourceLib, IDocumentDetails documentDetails)
 {
     if (String.IsNullOrEmpty(pathToDataSourceLib.Trim()))
     {
         throw new ArgumentException("No path is provided for data sources", "pathToDataSourceLib");
     }
     Assembly[] assemblies = getAssemblies(pathToDataSourceLib);
     AssemblyCreatorGenerator[] generators = getGenerators(assemblies);
     AssemblyBasedFactoryProxy factory = AssemblyBasedFactoryProxy.newInstance(Factory.newInstance(), generators);
     return new DynamicDataSourceProvider(DataSourceProvider.newInstance(factory, documentDetails);
 }
        /// <summary>
        /// Factory method.
        /// </summary>
        /// <param name="factory">Data source factory to be used.</param>
        /// <param name="documentDetails">Current document details.</param>
        /// <returns></returns>
        public static DataSourceProvider newInstance(IFactory factory, IDocumentDetails documentDetails)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }

            DataSourceProvider provider = new DataSourceProvider();
            provider.factory = factory;
            provider.documentDetails = documentDetails;
            return provider;
        }
        public static DataSourceProvider newInstance(IFactory factory, IDocumentDetails documentDetails)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            if (factory.creating().Count <= 0)
            {
                throw new ArgumentException("Factory produce nothing", "factory");
            }

            DataSourceProvider provider = new DataSourceProvider();
            provider.factory = factory;
            return provider;
        }
Esempio n. 4
0
        public static DataSourceProvider newInstance(IFactory factory, IDocumentDetails documentDetails)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            if (factory.creating().Count <= 0)
            {
                throw new ArgumentException("Factory produce nothing", "factory");
            }

            DataSourceProvider provider = new DataSourceProvider();

            provider.factory = factory;
            return(provider);
        }