Esempio n. 1
0
 /// <summary>
 /// Creates an upgrader for PostgreSQL databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">PostgreSQL database connection string.</param>
 /// <returns>
 /// A builder for a database upgrader designed for PostgreSQL databases.
 /// </returns>
 public static UpgradeEngineBuilder PostgresqlDatabase(this SupportedDatabases supported, string connectionString)
 {
     return(PostgresqlDatabase(new PostgresqlConnectionManager(connectionString)));
 }
Esempio n. 2
0
 /// <summary>
 /// Creates an upgrader for Firebird databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionManager">The <see cref="FirebirdConnectionManager"/> to be used during a database upgrade.</param>
 /// <returns>
 /// A builder for a database upgrader designed for Firebird databases.
 /// </returns>
 public static UpgradeEngineBuilder FirebirdDatabase(this SupportedDatabases supported, IConnectionManager connectionManager)
 => FirebirdDatabase(connectionManager);
Esempio n. 3
0
 public static bool CreateDatabase(SupportedDatabases database, DatabaseInfo databaseInfo)
 {
     DatabaseFactory.CreateDatabase(database, databaseInfo);
     return(true);
 }
Esempio n. 4
0
 /// <summary>
 /// Creates an upgrader for SQL Server databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="schema">The SQL schema name to use. Defaults to 'dbo'.</param>
 /// <returns>
 /// A builder for a database upgrader designed for SQL Server databases.
 /// </returns>
 public static UpgradeEngineBuilder SqlDatabase(this SupportedDatabases supported, string connectionString, string schema)
 {
     return(SqlDatabase(new SqlConnectionManager(connectionString), schema));
 }
Esempio n. 5
0
 /// <summary>
 /// Creates an upgrader for SQL Server databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionManager">The <see cref="IConnectionManager"/> to be used during a database
 /// upgrade. See <see cref="SqlConnectionManager"/> for an example implementation</param>
 /// <param name="schema">The SQL schema name to use. Defaults to 'dbo'.</param>
 /// <returns>
 /// A builder for a database upgrader designed for SQL Server databases.
 /// </returns>
 public static UpgradeEngineBuilder SqlDatabase(this SupportedDatabases supported, IConnectionManager connectionManager, string schema = null)
 => SqlDatabase(connectionManager, schema);
Esempio n. 6
0
 /// <summary>
 /// Creates an upgrader for PostgreSQL databases that use SSL.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">PostgreSQL database connection string.</param>
 /// <param name="schema">The schema in which to check for changes</param>
 /// <param name="certificate">Certificate for securing connection.</param>
 /// <returns>
 /// A builder for a database upgrader designed for PostgreSQL databases.
 /// </returns>
 public static UpgradeEngineBuilder PostgresqlDatabase(this SupportedDatabases supported, string connectionString, string schema, X509Certificate2 certificate)
 => PostgresqlDatabase(new PostgresqlConnectionManager(connectionString, certificate), schema);
Esempio n. 7
0
 /// <summary>
 /// Creates an upgrader for Oracle databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionManager">The <see cref="OracleConnectionManager"/> to be used during a database upgrade.</param>
 /// <param name="schema">The schema in which to check for changes</param>
 /// <returns>
 /// A builder for a database upgrader designed for Oracle databases.
 /// </returns>
 public static UpgradeEngineBuilder OracleDatabase(this SupportedDatabases supported, IConnectionManager connectionManager, string schema)
 => OracleDatabase(connectionManager, schema);
Esempio n. 8
0
 /// <summary>
 /// This constructor allows an instance of the data access library to be created and cached
 /// assuming a valid connection string is provided along with the enumeration indicating 
 /// which database provider to utilize.  In the case of a standard application configuration 
 /// file not being utilized, this would be the constructor to use.
 /// </summary>
 ///
 /// <param name="connectionString" type = "string">The fully compliant .NET connection string</param>
 /// <param name="databaseToUse" type="SupportedDatabases">Indicates the type of database to connect with</param>
 ///
 ///	<remarks>
 ///	
 /// <RevisionHistory>
 /// Author			      	  	Date		          Description
 /// DLGenerator		12/27/2014 6:55:52 PM			Created function
 /// 
 /// </RevisionHistory>
 /// 
 /// </remarks>
 public DatabaseHelper(SupportedDatabases databaseToUse, string connectionString)
 {
     CacheConnection(GetFactory(GetFactoryProviderName(databaseToUse)), connectionString);
 }
Esempio n. 9
0
 /// <summary>
 /// Creates an upgrader for Redshift databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">Redshift database connection string.</param>
 /// <returns>
 /// A builder for a database upgrader designed for Redshift databases.
 /// </returns>
 public static UpgradeEngineBuilder RedshiftDatabase(this SupportedDatabases supported, string connectionString)
 => RedshiftDatabase(supported, connectionString, null);
 public UpgradeEngineBuilder DeployTo(SupportedDatabases supported, MigrationConfig config)
 {
     return(supported
            .PostgresqlDatabase(config.ConnectionString)
            .JournalToPostgresqlTable(DefaultSchema, config.JournalingTable));
 }
Esempio n. 11
0
        /// <summary>
        /// This method will determine the name of the identified enumerated database.
        /// </summary>
        ///
        /// <param name="databaseToUse" type="SupportedDatabases">The enumeration of the database in which to find it's name.</param>
        ///
        /// <returns>The name of the database factory provider.</returns>
        /// 
        ///	<remarks>
        ///	
        /// <RevisionHistory>
        /// Author					        Date		          Description
        /// DLGenerator		12/27/2014 6:55:52 PM			Created function
        /// 
        /// </RevisionHistory>
        /// 
        /// </remarks>
        private string GetFactoryProviderName(SupportedDatabases databaseToUse)
        {
            string newFactoryName = string.Empty;

            switch (databaseToUse)
            {
                case SupportedDatabases.SqlServer:
                    newFactoryName = "System.Data.SqlClient";
                    break;

                case SupportedDatabases.OleDb:
                    newFactoryName = "System.Data.OleDb";
                    break;

                case SupportedDatabases.Oracle:
                    newFactoryName = "System.Data.OracleClient";
                    break;

                case SupportedDatabases.ODBC:
                    newFactoryName = "System.Data.Odbc";
                    break;
                case SupportedDatabases.SqlCe:
                    newFactoryName = "System.Data.SqlServerCe";
                    break;
            }

            return newFactoryName;
        }
Esempio n. 12
0
            /*
             * =====
             * MySQL
             * =====
             * CREATE TABLE `persons` (
             *  `idPerson` INT NOT NULL AUTO_INCREMENT,
             *  `Name` VARCHAR(120) NOT NULL,
             *  `BirthDate` DATETIME NULL,
             *   PRIMARY KEY (`idPerson`));
             * =========
             * SQLServer
             * =========
             * CREATE TABLE Persons(
             *  IdPerson INT NOT NULL IDENTITY(1,1)
             *      CONSTRAINT PK_Persons PRIMARY KEY,
             *  Name VARCHAR(120) NOT NULL,
             *  BirthDate DATETIME);
             */

            public TableDefinition(Type type, string modelNamespace, SupportedDatabases database)
            {
                foreach (var item in type.GetCustomAttributes(true))
                {
                    if (item is DBMappedClass)
                    {
                        Map = (DBMappedClass)item;
                    }
                }

                if (Map == null)
                {
                    return;
                }

                if (Map.Table == null || Map.Table.Length == 0 || Map.PrimaryKey == null || Map.PrimaryKey.Length == 0)
                {
                    throw new DBBrokerException(string.Format(Resources.ErrorIncompleteMap, type.FullName));
                }

                Type            = type;
                Namespace       = modelNamespace;
                DatabaseContext = database;
                Relationships   = new List <Relationship>();

                Script += DatabaseContext == SupportedDatabases.SQLServer ?
                          "CREATE TABLE " + Map.Table + "(\r\n" + Map.PrimaryKey + " INT NOT NULL IDENTITY(1, 1) CONSTRAINT PK_" + Map.Table + " PRIMARY KEY,\r\n"
                                                  : "CREATE TABLE " + Map.Table.ToLower() + "(\r\nPRIMARY KEY (" + Map.PrimaryKey + "),\r\n" + Map.PrimaryKey + " INT NOT NULL AUTO_INCREMENT,\r\n";
                foreach (PropertyInfo prop in type.GetProperties())
                {
                    if (IsTransiente(prop))
                    {
                        continue;
                    }

                    if (IsModelClass(prop.PropertyType, Namespace))
                    {
                        ScriptForeignKeys += ForeignKey(Map, prop);
                    }
                    else if (IsMappedList(prop))
                    {
                        Type[] generic_type = prop.PropertyType.GetGenericArguments();

                        if (generic_type == null || generic_type.Length == 0)
                        {
                            throw new DBBrokerException(string.Format(Resources.ErrorBadList, new object[] { prop.PropertyType.FullName, prop.Name }));
                        }

                        Relationships.Add(new Relationship((DBMappedList)GetPropMap(prop, typeof(DBMappedList)), GetClassMap(type), GetClassMap(generic_type[0])));
                        continue;
                    }

                    if (prop.Name.ToLower() == "id")
                    {
                        continue;
                    }

                    string dbcolumn = PropConversion(prop);

                    if (dbcolumn == null)
                    {
                        Warnings += "\r\n/* " + string.Format(Resources.WarningPropertyNotMapped, new object[] { type.Name + "." + prop.Name, prop.PropertyType.Name }) + " */";
                        continue;
                    }

                    DBReadOnly read_only = (DBReadOnly)GetPropMap(prop, typeof(DBReadOnly));
                    if (read_only != null && !string.IsNullOrEmpty(read_only.DBDefaultValue))
                    {
                        Script += dbcolumn;
                        Script += " DEFAULT " + read_only.DBDefaultValue + ", \r\n";
                        continue;
                    }
                    else if (read_only != null)
                    {
                        continue;
                    }

                    Script += dbcolumn + ", \r\n";
                }

                Script = Script.Substring(0, Script.Length - 4) + ");";
            }
Esempio n. 13
0
        private string GetRelationshipTableScript(Relationship relationship)
        {
            SupportedDatabases DatabaseContext = ConfigurationContext.DatabaseContext;
            string             TabelaBase      = null;
            string             Script          = "";

            foreach (var table in Tabelas)
            {
                if (relationship.Map.RelationshipTable == table.Map.Table)
                {
                    TabelaBase = table.Map.Table;
                    break;
                }
            }

            // Create table... if necessary
            if (TabelaBase == null)
            {
                TabelaBase = DatabaseContext == SupportedDatabases.MySQL ?
                             relationship.Map.RelationshipTable.ToLower()
                              : relationship.Map.RelationshipTable;

                Script  = "\r\n\r\nCREATE TABLE " + TabelaBase + "(\r\n";
                Script += ConfigurationContext.DatabaseContext == SupportedDatabases.SQLServer ?
                          "Id" + TabelaBase + " INT NOT NULL IDENTITY(1, 1) CONSTRAINT PK_" + TabelaBase + " PRIMARY KEY,\r\n"
                                                  : "PRIMARY KEY (Id" + TabelaBase + "),\r\nId" + TabelaBase + " INT NOT NULL AUTO_INCREMENT,\r\n";
                Script += relationship.Map.ParentColumnIds + " INT NOT NULL,\r\n";
                Script += relationship.Map.ChildrenColumnIds + " INT NOT NULL, \r\n";
                Script  = Script.Substring(0, Script.Length - 4) + "\r\n);";
            }

            // Parent Foreign key
            string[] args = new string[4];
            args[0] = TabelaBase;
            args[1] = relationship.ParentMap.Table;
            args[2] = relationship.Map.ParentColumnIds;
            args[3] = relationship.ParentMap.PrimaryKey;

            if (ConfigurationContext.DatabaseContext == SupportedDatabases.SQLServer)
            {
                Script += string.Format(SqlScriptMaker.SQLServerFK, args);
            }
            else if (ConfigurationContext.DatabaseContext == SupportedDatabases.MySQL)
            {
                Script += string.Format(SqlScriptMaker.MySqlFK, args);
            }

            //Children Foreign key
            args[1] = DatabaseContext == SupportedDatabases.MySQL ? relationship.ChildrenMap.Table.ToLower() : relationship.ChildrenMap.Table;
            args[2] = relationship.Map.ChildrenColumnIds;
            args[3] = relationship.ChildrenMap.PrimaryKey;

            if (DatabaseContext == SupportedDatabases.SQLServer)
            {
                Script += string.Format(SqlScriptMaker.SQLServerFK, args);
            }
            else if (DatabaseContext == SupportedDatabases.MySQL)
            {
                Script += string.Format(SqlScriptMaker.MySqlFK, args);
            }

            return(Script);
        }
Esempio n. 14
0
 /// <summary>Creates an upgrader for Azure SQL Databases using Azure AD Integrated Security.</summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="schema">The SQL schema name to use. Defaults to 'dbo' if <see langword="null" />.</param>
 /// <param name="resource">Resource to access. e.g. https://management.azure.com/.</param>
 /// <param name="tenantId">If not specified, default tenant is used. Managed Service Identity REST protocols do not accept tenantId, so this can only be used with certificate and client secret based authentication.</param>
 /// <param name="azureAdInstance">Specify a value for clouds other than the Public Cloud.</param>
 /// <returns>A builder for a database upgrader designed for Azure SQL Server databases.</returns>
 public static UpgradeEngineBuilder AzureSqlDatabaseWithIntegratedSecurity(this SupportedDatabases supported, string connectionString, string schema, string resource, string tenantId, string azureAdInstance = "https://login.microsoftonline.com/")
 {
     return(supported.SqlDatabase(new AzureSqlConnectionManager(connectionString, resource, tenantId, azureAdInstance), schema));
 }
Esempio n. 15
0
 /// <summary>Creates an upgrader for Azure SQL Databases using Azure AD Integrated Security.</summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="schema">The SQL schema name to use. Defaults to 'dbo' if <see langword="null" />.</param>
 /// <returns>A builder for a database upgrader designed for Azure SQL Server databases.</returns>
 public static UpgradeEngineBuilder AzureSqlDatabaseWithIntegratedSecurity(this SupportedDatabases supported, string connectionString, string schema, string resource)
 {
     return(AzureSqlDatabaseWithIntegratedSecurity(supported, connectionString, schema, resource, null));
 }
Esempio n. 16
0
 /// <summary>
 /// Creates an upgrader for Redshift databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">Redshift database connection string.</param>
 /// <param name="schema">The schema in which to check for changes</param>
 /// <returns>
 /// A builder for a database upgrader designed for Redshift databases.
 /// </returns>
 public static UpgradeEngineBuilder RedshiftDatabase(this SupportedDatabases supported, string connectionString, string schema)
 => RedshiftDatabase(new RedshiftConnectionManager(connectionString), schema);
Esempio n. 17
0
 /// <summary>
 /// Creates an upgrader for PostgreSQL databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">PostgreSQL database connection string.</param>
 /// <returns>
 /// A builder for a database upgrader designed for PostgreSQL databases.
 /// </returns>
 public static UpgradeEngineBuilder PostgresqlDatabase(this SupportedDatabases supported, string connectionString)
 => PostgresqlDatabase(supported, connectionString, null);
Esempio n. 18
0
 /// <summary>
 /// Creates an upgrader for Redshift databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionManager">The <see cref="RedshiftConnectionManager"/> to be used during a database upgrade.</param>
 /// <returns>
 /// A builder for a database upgrader designed for Redshift databases.
 /// </returns>
 public static UpgradeEngineBuilder RedshiftDatabase(this SupportedDatabases supported, IConnectionManager connectionManager)
 => RedshiftDatabase(connectionManager);
Esempio n. 19
0
 /// <summary>
 /// Creates an upgrader for PostgreSQL databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionManager">The <see cref="PostgresqlConnectionManager"/> to be used during a database upgrade.</param>
 /// <returns>
 /// A builder for a database upgrader designed for PostgreSQL databases.
 /// </returns>
 public static UpgradeEngineBuilder PostgresqlDatabase(this SupportedDatabases supported, IConnectionManager connectionManager)
 => PostgresqlDatabase(connectionManager);
Esempio n. 20
0
 protected abstract UpgradeEngineBuilder For(SupportedDatabases supportedDatabases, string connectionString);
Esempio n. 21
0
 /// <summary>
 /// Creates an upgrader for Oracle databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">Oracle database connection string.</param>
 /// <param name="schema">Which Oracle schema to check for changes</param>
 /// <param name="delimiter">Delimiter character</param>
 /// <returns>
 /// A builder for a database upgrader designed for Oracle databases.
 /// </returns>
 public static UpgradeEngineBuilder OracleDatabase(this SupportedDatabases supported, string connectionString, string schema, char delimiter)
 {
     return(OracleDatabase(new DbUp.Oracle.OracleConnectionManager(connectionString, new DbUp.Oracle.OracleCommandSplitter(delimiter)), schema));
 }
Esempio n. 22
0
 public static UpgradeEngineBuilder SqlCeDatabase(this SupportedDatabases supported, Func <SqlCeConnection> connectionFactory)
 {
     return(SqlCeDatabase(new LegacySqlConnectionManager(connectionFactory)));
 }
Esempio n. 23
0
 /// <summary>
 /// Creates an upgrader for SQL Server databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="schema">The SQL schema name to use. Defaults to 'dbo' if null.</param>
 /// <param name="useAzureSqlIntegratedSecurity">Whether to use Azure SQL Integrated Security</param>
 /// <returns>
 /// A builder for a database upgrader designed for SQL Server databases.
 /// </returns>
 public static UpgradeEngineBuilder SqlDatabase(this SupportedDatabases supported, string connectionString, string schema, bool useAzureSqlIntegratedSecurity)
 {
     return(SqlDatabase(new SqlConnectionManager(connectionString, useAzureSqlIntegratedSecurity), schema));
 }
Esempio n. 24
0
 /// <summary>
 /// Creates an upgrader for SQL Server databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">The connection string.</param>
 /// <returns>
 /// A builder for a database upgrader designed for SQL Server databases.
 /// </returns>
 public static UpgradeEngineBuilder SnowflakeDatabase(this SupportedDatabases supported, string connectionString)
 {
     return(SnowflakeDatabase(supported, connectionString, null));
 }
Esempio n. 25
0
        public async Task <ActionResult> CreateAdmin(AdminViewModel viewModel)
        {
            if (viewModel.AdminPassword != viewModel.ConfirmPassword)
            {
                ViewBag.Languages = new SelectList(SupportedCultures.Cultures.Select(x => new { Value = x.TwoLetterISOLanguageName, Text = x.DisplayName }).ToList(), "Value", "Text");
                ModelState.AddModelError("ConfirmPassword", "Password does not match");
                return(View(viewModel));
            }

            SetupHelper.InitilizeDatabase();

            if (SetupHelper.IsDbCreateComplete == true && SetupHelper.IsAdminCreateComplete == false)
            {
                if (!ModelState.IsValid)
                {
                    ViewBag.Languages = new SelectList(SupportedCultures.Cultures.Select(x => new { Value = x.TwoLetterISOLanguageName, Text = x.DisplayName }).ToList(), "Value", "Text");
                    return(View(viewModel));
                }

                var optionBuilder = new DbContextOptionsBuilder <NccDbContext>();

                SupportedDatabases supportedDatabases = TypeConverter.TryParseDatabaseEnum(SetupHelper.SelectedDatabase);

                switch (supportedDatabases)
                {
                case SupportedDatabases.MSSQL:
                    optionBuilder.UseSqlServer(SetupHelper.ConnectionString, opts => opts.MigrationsAssembly("NetCoreCMS.Framework"));
                    break;

                case SupportedDatabases.MsSqlLocalStorage:
                    break;

                case SupportedDatabases.MySql:
                    optionBuilder.UseMySql(SetupHelper.ConnectionString, opts => opts.MigrationsAssembly("NetCoreCMS.Framework"));
                    break;

                case SupportedDatabases.SqLite:
                    optionBuilder.UseSqlite(SetupHelper.ConnectionString, opts => opts.MigrationsAssembly("NetCoreCMS.Framework"));
                    break;

                case SupportedDatabases.PgSql:
                    break;
                }

                var nccDbConetxt = new NccDbContext(optionBuilder.Options);

                var userStore              = new NccUserStore(nccDbConetxt);
                var identityOptions        = Options.Create(new IdentityOptions());
                var passwordHasher         = new PasswordHasher <NccUser>();
                var userValidatorList      = new List <UserValidator <NccUser> >();
                var passwordValidatorList  = new List <PasswordValidator <NccUser> >();
                var lookupNormalizer       = new UpperInvariantLookupNormalizer();
                var identityErrorDescriber = new IdentityErrorDescriber();
                var logger     = _loggerFactory.CreateLogger <UserManager <NccUser> >();
                var authOption = new AuthenticationOptions();
                var options    = Options.Create <AuthenticationOptions>(authOption);
                var scheme     = new AuthenticationSchemeProvider(options);

                var userManager = new UserManager <NccUser>(
                    userStore,
                    identityOptions,
                    passwordHasher,
                    userValidatorList,
                    passwordValidatorList,
                    lookupNormalizer,
                    identityErrorDescriber,
                    GlobalContext.App.ApplicationServices,
                    logger
                    );

                var roleStore         = new NccRoleStore(nccDbConetxt);
                var roleValidatorList = new List <RoleValidator <NccRole> >();
                var roleLogger        = _loggerFactory.CreateLogger <RoleManager <NccRole> >();

                var roleManager = new RoleManager <NccRole>(
                    roleStore,
                    roleValidatorList,
                    new UpperInvariantLookupNormalizer(),
                    new IdentityErrorDescriber(),
                    roleLogger
                    );

                var claimsFactory = new UserClaimsPrincipalFactory <NccUser, NccRole>(userManager, roleManager, identityOptions);
                var signInLogger  = _loggerFactory.CreateLogger <SignInManager <NccUser> >();
                var signInManager = new NccSignInManager <NccUser>(userManager, _httpContextAccessor, claimsFactory, identityOptions, signInLogger, scheme);

                //nccDbConetxt.Database.Migrate();

                var setupInfo = new WebSiteInfo()
                {
                    SiteName         = viewModel.SiteName,
                    Tagline          = viewModel.Tagline,
                    AdminPassword    = viewModel.AdminPassword,
                    AdminUserName    = viewModel.AdminUserName,
                    ConnectionString = SetupHelper.ConnectionString,
                    Database         = TypeConverter.TryParseDatabaseEnum(SetupHelper.SelectedDatabase),
                    Email            = viewModel.Email,
                    Language         = viewModel.Language,
                    TablePrefix      = viewModel.TablePrefix
                };

                //SetupHelper.RegisterAuthServices(supportedDatabases);
                var admin = await SetupHelper.CreateSuperAdminUser(nccDbConetxt, userManager, roleManager, signInManager, setupInfo);

                if (admin != null)
                {
                    SetupHelper.IsAdminCreateComplete = true;
                    SetupHelper.Language = viewModel.Language;
                    SetupHelper.SaveSetup();
                    SetupHelper.CrateNccWebSite(nccDbConetxt, setupInfo);

                    await SetupHelper.SaveBasicData(admin, nccDbConetxt, userManager, roleManager, signInManager, setupInfo);

                    return(Redirect("/Home/SetupSuccess"));
                }
                else
                {
                    TempData["ErrorMessage"] = "Could not create Admin user and Roles.";
                    return(Redirect("/Home/Error"));
                }
            }

            TempData["ErrorMessage"] = "Setup already completed.";
            return(Redirect("/Home/Error"));
        }
Esempio n. 26
0
 protected override UpgradeEngineBuilder For(SupportedDatabases supportedDatabases, string connectionString)
 {
     return(supportedDatabases.PostgresqlDatabase(connectionString));
 }
Esempio n. 27
0
 /// <summary>
 /// This constructor allows an instance of the data access library to be created and cached
 /// assuming a valid connection string is provided along with the enumeration indicating
 /// which database provider to utilize.  In the case of a standard application configuration
 /// file not being utilized, this would be the constructor to use.
 /// </summary>
 ///
 /// <param name="connectionString" type = "string">The fully compliant .NET connection string</param>
 /// <param name="databaseToUse" type="SupportedDatabases">Indicates the type of database to connect with</param>
 ///
 ///	<remarks>
 ///
 /// <RevisionHistory>
 /// Author			            Date		          Description
 /// DLGenerator		12/26/2014 2:45:50 AM			Created function
 ///
 /// </RevisionHistory>
 ///
 /// </remarks>
 public DatabaseHelper(SupportedDatabases databaseToUse, string connectionString)
 {
     CacheConnection(GetFactory(GetFactoryProviderName(databaseToUse)), connectionString);
 }
Esempio n. 28
0
 public static UpgradeEngineBuilder SqlDatabase(this SupportedDatabases supported, Func <IDbConnection> connectionFactory)
 {
     return(SqlDatabase(supported, connectionFactory, null));
 }
Esempio n. 29
0
 /// <summary>
 /// Creates an upgrader for Firebird databases.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">Firebird database connection string.</param>
 /// <returns>
 /// A builder for a database upgrader designed for Firebird databases.
 /// </returns>
 public static UpgradeEngineBuilder FirebirdDatabase(this SupportedDatabases supported, string connectionString)
 {
     return(FirebirdDatabase(new FirebirdConnectionManager(connectionString)));
 }
Esempio n. 30
0
 public static UpgradeEngineBuilder SqlDatabase(this SupportedDatabases supported, Func <IDbConnection> connectionFactory, string schema)
 {
     return(SqlDatabase(new LegacySqlConnectionManager(connectionFactory), schema));
 }
 /// <summary>
 /// Creates an upgrader for Azure SQL Data Warehouse database.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">The connection string.</param>
 /// <returns>
 /// A builder for a database upgrader designed for Azure SQL Data Warehouse database.
 /// </returns>
 public static UpgradeEngineBuilder AzureSqlDwDatabase(this SupportedDatabases supported, string connectionString)
 {
     return(AzureSqlDwDatabase(supported, connectionString, null));
 }
Esempio n. 32
0
 /// <summary>Creates an upgrader for Azure SQL Databases using Azure AD Integrated Security.</summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="schema">The SQL schema name to use. Defaults to 'dbo' if <see langword="null" />.</param>
 /// <returns>A builder for a database upgrader designed for Azure SQL Server databases.</returns>
 public static UpgradeEngineBuilder AzureSqlDatabaseWithIntegratedSecurity(this SupportedDatabases supported, string connectionString, string schema)
 {
     return(supported.SqlDatabase(new AzureSqlConnectionManager(connectionString), schema));
 }