Subtext.Installation.SqlInstaller.Install C# (CSharp) Method

Install() public method

public Install ( System.Version assemblyVersion ) : void
assemblyVersion System.Version
return void
        public void Install(Version assemblyVersion)
        {
            using (SqlConnection connection = new SqlConnection(this.connectionString))
            {
                connection.Open();
                using (SqlTransaction transaction = connection.BeginTransaction())
                {
                    try
                    {
                        string[] scripts = ListInstallationScripts(this.GetCurrentInstallationVersion(), VersionInfo.FrameworkVersion);
                        foreach (string scriptName in scripts)
                        {
                            ScriptHelper.ExecuteScript(scriptName, transaction, _dbUser);
                        }

                        ScriptHelper.ExecuteScript("StoredProcedures.sql", transaction, _dbUser);
                        UpdateInstallationVersionNumber(assemblyVersion, transaction);
                        transaction.Commit();
                    }
                    catch (Exception)
                    {
                        transaction.Rollback();
                        throw;
                    }
                }
            }
        }

Usage Example

Ejemplo n.º 1
0
        public static void CreateAndInstallDatabase(ConnectionString connectionString, string databaseName, string directory)
        {
            DeleteDatabase(connectionString.Server, databaseName, directory);
            CreateDatabase(connectionString.Server, databaseName, directory);

            SqlInstaller installer = new SqlInstaller(connectionString);
            installer.Install(VersionInfo.FrameworkVersion);
        }
All Usage Examples Of Subtext.Installation.SqlInstaller::Install