Ejemplo n.º 1
0
 public Configuration(Options options)
 {
   this.Scope = options.Scope;
   if (!string.IsNullOrEmpty(options.DatabaseType) && options.DatabaseType == "mysql")
   {
     this.ConnectionProviderType = typeof(MySqlConnectionProvider);
     this.SchemaProviderType = typeof(MySqlSchemaProvider);
   }
   else if (!string.IsNullOrEmpty(options.DatabaseType) && options.DatabaseType == "pgsql")
   {
       this.ConnectionProviderType = typeof (PostgreSQLConnectionProvider);
       this.SchemaProviderType = typeof (PostgreSQLSchemaProvider);
   }
   else
   {
     this.ConnectionProviderType = typeof(SqlServerConnectionProvider);
     this.SchemaProviderType = typeof(SqlServerSchemaProvider);
   }
   this.TransactionProviderType = typeof(TransactionProvider);
   this.DatabaseProviderType = typeof(AdoNetDatabaseProvider);
   this.MigrationsDirectory = options.MigrationsDirectory;
   this.CompilerVersion = options.CompilerVersion;
   this.DesiredVersion = options.ToMigration;
   this.ShowDiagnostics = options.ShowDiagnostics;
   this.References = options.References.ToArray();
   this.CommandTimeout = options.CommandTimeout;
   _connectionStrings = options.ParseConnectionStrings();
 }
Ejemplo n.º 2
0
		public Configuration(Options options)
		{
			Scope = options.Scope;
			DriverAssemblyName = options.DriverAssemblyName;
			setDatabaseOptions(options);			
			MigrationsDirectory = options.MigrationsDirectory;
			CompilerVersion = options.CompilerVersion;
			DesiredVersion = options.ToMigration;
			ShowDiagnostics = options.ShowDiagnostics;
			References = options.References.ToArray();
			CommandTimeout = options.CommandTimeout;
			_connectionStrings = options.ParseConnectionStrings();
		}
Ejemplo n.º 3
0
		public ExitCode Run(string[] args)
		{
			try
			{
				var options = new Options();
				options.ParseArguments(args);

				var task = new Migrator();
				task.Run(new Configuration(options));
			}
			catch (Exception err)
			{
				Console.Error.WriteLine(err.ToString());
				return ExitCode.Failure;
			}

			return ExitCode.Success;
		}
Ejemplo n.º 4
0
		private void setDatabaseOptions(Options options)
		{
			TransactionProviderType = typeof (TransactionProvider);

			DetectDataBase.Detect(this, options.Database.ToLower());
		}