public void LoadAssemblyIntoDatabase()
        {
			SqlInstanceInfo sqlInstanceInfo = new SqlInstanceInfo(conn);
			Database database = new Database(conn);
			database.CreateDatabaseIfDoesNotExist();
			if (System.Environment.MachineName != sqlInstanceInfo.ServerName)
			{
				ClrAssemblyFile remoteClrAssemblyFile = null;
				if (directoryToCopyAssemlyTo == null)
				{
					directoryToCopyAssemlyTo = GetTempDirectoryInfo(sqlInstanceInfo.ServerName, CurrentUserNameWithoutDomain);
				}
				if (!directoryToCopyAssemlyTo.Exists)
				{
					directoryToCopyAssemlyTo.Create();
				}
				CopyFilesOverToRemoteServer(clrAssemblyFile.FileInfo.Directory, directoryToCopyAssemlyTo);
				string path = Path.Combine(directoryToCopyAssemlyTo.FullName, clrAssemblyFile.FileInfo.Name);
				remoteClrAssemblyFile = new ClrAssemblyFile(new FileInfo(path));
				UpdateAssembly(database, remoteClrAssemblyFile);
			}
			else
			{
				UpdateAssembly(database, clrAssemblyFile);
			}
			
        }
예제 #2
0
		public void ClrIsEnabledInDatabaseTest_ClrIsEnabled_Returns()
		{
			System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(Common.Properties.ConnectionString);
			Database di = new Database(conn);
			di.CreateDatabaseIfDoesNotExist();
			SetClrEnabled(conn, true);
			Assert.IsTrue(di.ClrIsEnabledInDatabase);
		}
예제 #3
0
		Program(string[] args)
		{
			try
			{
				Common.CommandLine.Log.Write("Daves mods 1.1: " + System.Security.Principal.WindowsIdentity.GetCurrent().Name, "", Log.SeverityLevel.Message);
				Console.WriteLine("Daves mods 1.1: " + System.Security.Principal.WindowsIdentity.GetCurrent().Name);


				logLevel = (Common.CommandLine.Log.SeverityLevel)logLevelArg.Value;
				Database database = new Database(Common.Properties.ConnectionString);
				database.CreateDatabaseIfDoesNotExist();
				Console.WriteLine("CreateDatabaseIfDoesNotExist done OK");
				SqlScriptRunner.ScriptProjectRunner runner = new SqlScriptRunner.ScriptProjectRunner(
					pathToSqlProject.Directory.FullName,
					Common.Properties.ConnectionString,
					encryptScriptsInDatabase.Value,
					applyDataScripts.Value
				);
				ScriptProjectRunner.Message += new SqlScriptRunner.ScriptProjectRunner.MessageHandler(runner_Message);
				runner.SynchroniseDatabaseWithScripts();
				Console.WriteLine("SynchroniseDatabaseWithScripts done OK");
				Console.WriteLine("Finished OK");
				Environment.Exit(0);
			}
			catch (ScriptExecutionException scriptEx)
			{
				Console.WriteLine(scriptEx.ToString());
				Common.CommandLine.Log.Error(scriptEx.Message, scriptEx.ScriptFileName);
			}
			catch (CannotFindDependencyScriptException depEx)
			{
				Console.WriteLine(depEx.ToString());
				Common.CommandLine.Log.Error(depEx.Message, depEx.ExecutingScriptFileName);
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.ToString());
				Common.CommandLine.Log.Error(ex.ToString());
			}
			Environment.Exit(1);
		}