Revision: 161
Author: mhinze
Date: Wed Oct 20 06:52:21 2010
Log: added the ability to use username and password from console database
deployer
http://code.google.com/p/tarantino/source/detail?r=161
Modified:
/trunk/src/Tarantino.DatabaseManager.Console/ConsoleDatabaseDeployer.cs
/trunk/src/Tarantino.DatabaseManager.Console/Program.cs
=======================================
--- /trunk/src/Tarantino.DatabaseManager.Console/ConsoleDatabaseDeployer.cs
Fri Sep 11 14:35:01 2009
+++ /trunk/src/Tarantino.DatabaseManager.Console/ConsoleDatabaseDeployer.cs
Wed Oct 20 06:52:21 2010
@@ -27,13 +27,13 @@
}
- public bool UpdateDatabase(string Server, string Database, string
ScriptDirectory, RequestedDatabaseAction Action)
+ public bool UpdateDatabase(ConnectionSettings settings, string
scriptDirectory, RequestedDatabaseAction action)
{
var manager = new SqlDatabaseManager();
- var settings = new ConnectionSettings(Server, Database, true,
null, null);
- var taskAttributes = new TaskAttributes(settings,
ScriptDirectory)
- {
- RequestedDatabaseAction = Action,
+
+ var taskAttributes = new TaskAttributes(settings,
scriptDirectory)
+ {
+ RequestedDatabaseAction = action,
};
try
{
=======================================
--- /trunk/src/Tarantino.DatabaseManager.Console/Program.cs Fri Sep 11
14:56:33 2009
+++ /trunk/src/Tarantino.DatabaseManager.Console/Program.cs Wed Oct 20
06:52:21 2010
@@ -1,7 +1,7 @@
using System;
using System.IO;
+using Tarantino.Core.DatabaseManager.Model;
using Tarantino.Core.DatabaseManager.Services.Impl;
-using Tarantino.DatabaseManager.Core;
namespace Tarantino.DatabaseManager.Console
{
@@ -9,23 +9,39 @@
{
private static void Main(string[] args)
{
- if(args.Length==4)
- {
- RequestedDatabaseAction Action = (RequestedDatabaseAction)
Enum.Parse(typeof(RequestedDatabaseAction), args[0]);
- string Server = args[1];
- string Database = args[2];
- string ScriptDirectory = args[3];
-
- var deployer = new ConsoleDatabaseDeployer();
- if(deployer.UpdateDatabase(Server, Database,
ScriptDirectory, Action))
- {
- return;
- }
- }
- else
- {
- InvalidArguments();
- }
+ if (args.Length != 4 && args.Length != 6)
+ {
+ InvalidArguments();
+ return;
+ }
+
+ ConnectionSettings settings = null;
+
+ var deployer = new ConsoleDatabaseDeployer();
+
+ var action =
(RequestedDatabaseAction)Enum.Parse(typeof(RequestedDatabaseAction),
args[0]);
+ string server = args[1];
+ string database = args[2];
+ string scriptDirectory = args[3];
+
+ if (args.Length == 4)
+ {
+ settings = new ConnectionSettings(server, database, true,
null, null);
+ }
+
+ else if (args.Length == 6)
+ {
+ string username = args[4];
+ string password = args[5];
+
+ settings = new ConnectionSettings(server, database, false,
username, password);
+ }
+
+ if (deployer.UpdateDatabase(settings, scriptDirectory, action))
+ {
+ return;
+ }
+
Environment.ExitCode = 1;
}
@@ -33,6 +49,8 @@
{
System.Console.WriteLine("Invalid Arguments");
System.Console.WriteLine(
Path.GetFileName(typeof(Program).Assembly.Location) + @" Action(Create|
Update|Rebuild) .\SqlExpress DatabaseName .\DatabaseScripts\ ");
+ System.Console.WriteLine("-- or --");
+ System.Console.WriteLine(
Path.GetFileName(typeof(Program).Assembly.Location) + @" Action(Create|
Update|Rebuild) .\SqlExpress DatabaseName .\DatabaseScripts\ Username
Password");
}
}
}