/// <summary> /// Factory method for creating the installer client. /// </summary> /// <param name="parameters">The parameters to use during the install.</param> /// <returns>The client to use for install</returns> public static BaseClient Create(Parameters parameters) { BaseClient client = null; switch (parameters.Provider.Name) { case Constants.Firebird: client = new FirebirdClient(); break; case Constants.Oracle: client = new CommercialClient(Constants.OracleAlterSession); break; case Constants.DB2: client = new CommercialClient(Constants.DB2AlterSession); break; case Constants.Teradata: client = new CommercialClient(Constants.TeradataAlterSession); break; case Constants.SqlServer: client = new SqlServerClient(); break; case Constants.SQLite: client = new SQLiteClient(); break; default: client = new BaseClient(); break; } string provConfig = Resources.ProviderFactory; string provConfigPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Constants.ProviderFactory + Constants.XmlExt); if (File.Exists(provConfigPath)) { using (StreamReader r = new StreamReader(provConfigPath)) { provConfig = r.ReadToEnd(); } } ProviderFactory providerFactory = ProviderFactory.Load(provConfig); if (!providerFactory.Providers.Contains(parameters.Provider.Name)) { throw new ArgumentException(Resources.ErrorUnknownProvider + parameters.Provider.Name); } client.Provider = providerFactory.Providers[parameters.Provider.Name]; if (!string.IsNullOrEmpty(parameters.Provider.InvariantName)) { client.Provider.InvariantName = parameters.Provider.InvariantName; } foreach (Script s in parameters.Provider.Scripts) { client.Provider.Scripts[s.Type].CommandText = s.CommandText; } client.DbProviderFactory = DbProviderFactories.GetFactory(client.Provider.InvariantName); client.ConnectionString = parameters.ConnectionString; client.Database = parameters.Database; return(client); }