Skip to content

Commit

Permalink
Added a VS2010 solution file (side-by-side with VS2008). Switched SQL…
Browse files Browse the repository at this point in the history
… tests over to default SQL Express install (.\SQLExpress).
  • Loading branch information
troygoode committed Oct 8, 2010
1 parent 12f272c commit 365d312
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 170 deletions.
115 changes: 115 additions & 0 deletions FluentMigrator (2010).sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Runners", "Runners", "{CB10ADAF-FB42-457B-ADFE-7CF866C5DA6E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{C17FACD1-2740-44B5-8E6E-B7FF0D54CA40}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{D264186F-3ED6-482D-8E1A-F41C2F83C711}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{64A04012-A9E7-4DE9-8927-DD1DD5E2523A}"
ProjectSection(SolutionItems) = preProject
SolutionInfo.cs = SolutionInfo.cs
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentMigrator.Runner", "src\FluentMigrator.Runner\FluentMigrator.Runner.csproj", "{CB468AD6-60C2-42E9-B3B0-01968EF94C65}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentMigrator.Tests", "src\FluentMigrator.Tests\FluentMigrator.Tests.csproj", "{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentMigrator", "src\FluentMigrator\FluentMigrator.csproj", "{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentMigrator.Console", "src\FluentMigrator.Console\FluentMigrator.Console.csproj", "{664C7334-B44B-4D62-A0F8-063805D630AA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentMigrator.NAnt", "src\FluentMigrator.NAnt\FluentMigrator.NAnt.csproj", "{C2B629E5-9394-48DA-A9E8-4999B398F37E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentMigrator.MSBuild", "src\FluentMigrator.MSBuild\FluentMigrator.MSBuild.csproj", "{97849F97-BD7D-453B-B0CF-6CD922BB1596}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
AutomatedRelease|Any CPU = AutomatedRelease|Any CPU
AutomatedRelease|x86 = AutomatedRelease|x86
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.AutomatedRelease|Any CPU.ActiveCfg = AutomatedRelease|Any CPU
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.AutomatedRelease|Any CPU.Build.0 = AutomatedRelease|Any CPU
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.AutomatedRelease|x86.ActiveCfg = AutomatedRelease|x86
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.AutomatedRelease|x86.Build.0 = AutomatedRelease|x86
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.Debug|x86.ActiveCfg = Debug|x86
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.Debug|x86.Build.0 = Debug|x86
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.Release|Any CPU.Build.0 = Release|Any CPU
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.Release|x86.ActiveCfg = Release|x86
{CB468AD6-60C2-42E9-B3B0-01968EF94C65}.Release|x86.Build.0 = Release|x86
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.AutomatedRelease|Any CPU.ActiveCfg = AutomatedRelease|Any CPU
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.AutomatedRelease|Any CPU.Build.0 = AutomatedRelease|Any CPU
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.AutomatedRelease|x86.ActiveCfg = AutomatedRelease|x86
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.AutomatedRelease|x86.Build.0 = AutomatedRelease|x86
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.Debug|x86.ActiveCfg = Debug|x86
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.Debug|x86.Build.0 = Debug|x86
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.Release|Any CPU.Build.0 = Release|Any CPU
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.Release|x86.ActiveCfg = Release|x86
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C}.Release|x86.Build.0 = Release|x86
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.AutomatedRelease|Any CPU.ActiveCfg = AutomatedRelease|Any CPU
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.AutomatedRelease|Any CPU.Build.0 = AutomatedRelease|Any CPU
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.AutomatedRelease|x86.ActiveCfg = AutomatedRelease|x86
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.AutomatedRelease|x86.Build.0 = AutomatedRelease|x86
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.Debug|x86.ActiveCfg = Debug|x86
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.Debug|x86.Build.0 = Debug|x86
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.Release|Any CPU.Build.0 = Release|Any CPU
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.Release|x86.ActiveCfg = Release|x86
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8}.Release|x86.Build.0 = Release|x86
{664C7334-B44B-4D62-A0F8-063805D630AA}.AutomatedRelease|Any CPU.ActiveCfg = AutomatedRelease|Any CPU
{664C7334-B44B-4D62-A0F8-063805D630AA}.AutomatedRelease|Any CPU.Build.0 = AutomatedRelease|Any CPU
{664C7334-B44B-4D62-A0F8-063805D630AA}.AutomatedRelease|x86.ActiveCfg = Release|x86
{664C7334-B44B-4D62-A0F8-063805D630AA}.AutomatedRelease|x86.Build.0 = Release|x86
{664C7334-B44B-4D62-A0F8-063805D630AA}.Debug|Any CPU.ActiveCfg = Debug|x86
{664C7334-B44B-4D62-A0F8-063805D630AA}.Debug|Any CPU.Build.0 = Debug|x86
{664C7334-B44B-4D62-A0F8-063805D630AA}.Debug|x86.ActiveCfg = Debug|x86
{664C7334-B44B-4D62-A0F8-063805D630AA}.Debug|x86.Build.0 = Debug|x86
{664C7334-B44B-4D62-A0F8-063805D630AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{664C7334-B44B-4D62-A0F8-063805D630AA}.Release|Any CPU.Build.0 = Release|Any CPU
{664C7334-B44B-4D62-A0F8-063805D630AA}.Release|x86.ActiveCfg = Release|x86
{664C7334-B44B-4D62-A0F8-063805D630AA}.Release|x86.Build.0 = Release|x86
{C2B629E5-9394-48DA-A9E8-4999B398F37E}.AutomatedRelease|Any CPU.ActiveCfg = AutomatedRelease|Any CPU
{C2B629E5-9394-48DA-A9E8-4999B398F37E}.AutomatedRelease|Any CPU.Build.0 = AutomatedRelease|Any CPU
{C2B629E5-9394-48DA-A9E8-4999B398F37E}.AutomatedRelease|x86.ActiveCfg = Release|Any CPU
{C2B629E5-9394-48DA-A9E8-4999B398F37E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2B629E5-9394-48DA-A9E8-4999B398F37E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2B629E5-9394-48DA-A9E8-4999B398F37E}.Debug|x86.ActiveCfg = Debug|Any CPU
{C2B629E5-9394-48DA-A9E8-4999B398F37E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2B629E5-9394-48DA-A9E8-4999B398F37E}.Release|Any CPU.Build.0 = Release|Any CPU
{C2B629E5-9394-48DA-A9E8-4999B398F37E}.Release|x86.ActiveCfg = Release|Any CPU
{97849F97-BD7D-453B-B0CF-6CD922BB1596}.AutomatedRelease|Any CPU.ActiveCfg = AutomatedRelease|Any CPU
{97849F97-BD7D-453B-B0CF-6CD922BB1596}.AutomatedRelease|Any CPU.Build.0 = AutomatedRelease|Any CPU
{97849F97-BD7D-453B-B0CF-6CD922BB1596}.AutomatedRelease|x86.ActiveCfg = AutomatedRelease|Any CPU
{97849F97-BD7D-453B-B0CF-6CD922BB1596}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97849F97-BD7D-453B-B0CF-6CD922BB1596}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97849F97-BD7D-453B-B0CF-6CD922BB1596}.Debug|x86.ActiveCfg = Debug|Any CPU
{97849F97-BD7D-453B-B0CF-6CD922BB1596}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97849F97-BD7D-453B-B0CF-6CD922BB1596}.Release|Any CPU.Build.0 = Release|Any CPU
{97849F97-BD7D-453B-B0CF-6CD922BB1596}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CB468AD6-60C2-42E9-B3B0-01968EF94C65} = {CB10ADAF-FB42-457B-ADFE-7CF866C5DA6E}
{664C7334-B44B-4D62-A0F8-063805D630AA} = {CB10ADAF-FB42-457B-ADFE-7CF866C5DA6E}
{C2B629E5-9394-48DA-A9E8-4999B398F37E} = {CB10ADAF-FB42-457B-ADFE-7CF866C5DA6E}
{97849F97-BD7D-453B-B0CF-6CD922BB1596} = {CB10ADAF-FB42-457B-ADFE-7CF866C5DA6E}
{FD9410F9-6FEA-47F7-A78E-B4F6FB0539B8} = {C17FACD1-2740-44B5-8E6E-B7FF0D54CA40}
{5DFD1A3B-7258-4C05-88F9-02A1EA3F5D9C} = {D264186F-3ED6-482D-8E1A-F41C2F83C711}
EndGlobalSection
EndGlobal
12 changes: 6 additions & 6 deletions src/FluentMigrator.Runner/IMigrationRunner.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Reflection;

namespace FluentMigrator.Runner
{
using System.Reflection;

namespace FluentMigrator.Runner
{
public interface IMigrationRunner
{
{
IMigrationProcessor Processor { get; }
Assembly MigrationAssembly { get; }
void Up(IMigration migration);
Expand All @@ -12,5 +12,5 @@ public interface IMigrationRunner
void Rollback(int steps);
void RollbackToVersion(long version);
void MigrateDown(long version);
}
}
}
4 changes: 2 additions & 2 deletions src/FluentMigrator.Runner/Initialization/IRunnerContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public interface IRunnerContext
int Steps { get; set; }
string WorkingDirectory { get; set; }
string Profile { get; set; }
IAnnouncer Announcer { get; }
IStopWatch StopWatch { get; }
IAnnouncer Announcer { get; }
IStopWatch StopWatch { get; }
int Timeout { get; set; }
//IMigrationProcessor Processor { get; }
}
Expand Down
10 changes: 5 additions & 5 deletions src/FluentMigrator.Runner/Initialization/RunnerContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ private bool NotUsingConfig
public IAnnouncer Announcer
{
get; set;
}

public IStopWatch StopWatch
{
get; private set;
}

public IStopWatch StopWatch
{
get; private set;
}

public IMigrationProcessor Processor
Expand Down
194 changes: 97 additions & 97 deletions src/FluentMigrator.Runner/Initialization/TaskExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@
#endregion

using System;
using System.Configuration;
using System.IO;
using System.Linq;
using FluentMigrator.Runner.Initialization.AssemblyLoader;
using System.Configuration;
using System.IO;
using System.Linq;
using FluentMigrator.Runner.Initialization.AssemblyLoader;
using FluentMigrator.Runner.Processors;

namespace FluentMigrator.Runner.Initialization
{
public class TaskExecutor
{
private IMigrationRunner Runner { get; set; }
private IRunnerContext RunnerContext { get; set; }
private string ConfigFile;
private string ConnectionString;

private bool NotUsingConfig
{
get { return string.IsNullOrEmpty( ConfigFile ); }
private IRunnerContext RunnerContext { get; set; }
private string ConfigFile;
private string ConnectionString;

private bool NotUsingConfig
{
get { return string.IsNullOrEmpty( ConfigFile ); }
}

public TaskExecutor(IRunnerContext runnerContext)
Expand All @@ -47,8 +47,8 @@ public TaskExecutor(IRunnerContext runnerContext)

private void Initialize()
{
var assembly = AssemblyLoaderFactory.GetAssemblyLoader(RunnerContext.Target).Load();

var assembly = AssemblyLoaderFactory.GetAssemblyLoader(RunnerContext.Target).Load();

var processor = InitializeProcessor();

Runner = new MigrationRunner(assembly, RunnerContext, processor);
Expand Down Expand Up @@ -84,90 +84,90 @@ public void Execute()
Runner.MigrateDown(RunnerContext.Version);
break;
}
}

public IMigrationProcessor InitializeProcessor()
{
var configFile = Path.Combine( Environment.CurrentDirectory, RunnerContext.Target );
if ( File.Exists( configFile + ".config" ) )
{
var config = ConfigurationManager.OpenExeConfiguration( configFile );
var connections = config.ConnectionStrings.ConnectionStrings;

if ( connections.Count > 1 )
{
if ( string.IsNullOrEmpty( RunnerContext.Connection ) )
{
ReadConnectionString( connections[ Environment.MachineName ], config.FilePath );
}
else
{
ReadConnectionString( connections[ RunnerContext.Connection ], config.FilePath );
}
}
else if ( connections.Count == 1 )
{
ReadConnectionString( connections[ 0 ], config.FilePath );
}
}

if ( NotUsingConfig && !string.IsNullOrEmpty( RunnerContext.Connection ) )
{
ConnectionString = RunnerContext.Connection;
}

if ( string.IsNullOrEmpty( ConnectionString ) )
{
throw new ArgumentException( "Connection String or Name is required \"/connection\"" );
}

if ( string.IsNullOrEmpty( RunnerContext.Database ) )
{
throw new ArgumentException(
"Database Type is required \"/db [db type]\". Available db types is [sqlserver], [sqlite]" );
}

if ( NotUsingConfig )
{
Console.WriteLine( "Using Database {0} and Connection String {1}", RunnerContext.Database, ConnectionString );
}
else
{
Console.WriteLine( "Using Connection {0} from Configuration file {1}", RunnerContext.Connection, ConfigFile );
}

if ( RunnerContext.Timeout == 0 )
{
RunnerContext.Timeout = 30; // Set default timeout for command
}

var processorFactory = ProcessorFactory.GetFactory( RunnerContext.Database );
var processor = processorFactory.Create( ConnectionString, RunnerContext.Announcer, new ProcessorOptions
{
PreviewOnly = RunnerContext.PreviewOnly,
Timeout = RunnerContext.Timeout
} );

return processor;
}

private void ReadConnectionString( ConnectionStringSettings connection, string configurationFile )
{
if ( connection != null )
{
var factory = ProcessorFactory.Factories.Where( f => f.IsForProvider( connection.ProviderName ) ).FirstOrDefault();
if ( factory != null )
{
RunnerContext.Database = factory.Name;
RunnerContext.Connection = connection.Name;
ConnectionString = connection.ConnectionString;
ConfigFile = configurationFile;
}
}
else
{
Console.WriteLine( "connection is null!" );
}
}

public IMigrationProcessor InitializeProcessor()
{
var configFile = Path.Combine( Environment.CurrentDirectory, RunnerContext.Target );
if ( File.Exists( configFile + ".config" ) )
{
var config = ConfigurationManager.OpenExeConfiguration( configFile );
var connections = config.ConnectionStrings.ConnectionStrings;

if ( connections.Count > 1 )
{
if ( string.IsNullOrEmpty( RunnerContext.Connection ) )
{
ReadConnectionString( connections[ Environment.MachineName ], config.FilePath );
}
else
{
ReadConnectionString( connections[ RunnerContext.Connection ], config.FilePath );
}
}
else if ( connections.Count == 1 )
{
ReadConnectionString( connections[ 0 ], config.FilePath );
}
}

if ( NotUsingConfig && !string.IsNullOrEmpty( RunnerContext.Connection ) )
{
ConnectionString = RunnerContext.Connection;
}

if ( string.IsNullOrEmpty( ConnectionString ) )
{
throw new ArgumentException( "Connection String or Name is required \"/connection\"" );
}

if ( string.IsNullOrEmpty( RunnerContext.Database ) )
{
throw new ArgumentException(
"Database Type is required \"/db [db type]\". Available db types is [sqlserver], [sqlite]" );
}

if ( NotUsingConfig )
{
Console.WriteLine( "Using Database {0} and Connection String {1}", RunnerContext.Database, ConnectionString );
}
else
{
Console.WriteLine( "Using Connection {0} from Configuration file {1}", RunnerContext.Connection, ConfigFile );
}

if ( RunnerContext.Timeout == 0 )
{
RunnerContext.Timeout = 30; // Set default timeout for command
}

var processorFactory = ProcessorFactory.GetFactory( RunnerContext.Database );
var processor = processorFactory.Create( ConnectionString, RunnerContext.Announcer, new ProcessorOptions
{
PreviewOnly = RunnerContext.PreviewOnly,
Timeout = RunnerContext.Timeout
} );

return processor;
}

private void ReadConnectionString( ConnectionStringSettings connection, string configurationFile )
{
if ( connection != null )
{
var factory = ProcessorFactory.Factories.Where( f => f.IsForProvider( connection.ProviderName ) ).FirstOrDefault();
if ( factory != null )
{
RunnerContext.Database = factory.Name;
RunnerContext.Connection = connection.Name;
ConnectionString = connection.ConnectionString;
ConfigFile = configurationFile;
}
}
else
{
Console.WriteLine( "connection is null!" );
}
}
}
}
Loading

0 comments on commit 365d312

Please sign in to comment.