public static DatabaseCreator FromConnectionStringSettings(DatabaseDefinition databaseDefinition, NamedConnectionString connectionString, Context context)
        {
            var generator = SqlGeneratorFactory.CreateGenerator(connectionString.GetSqlEngineVersion(), context);
            var executer  = SqlExecuterFactory.CreateSqlExecuter(connectionString, generator);

            return(new DatabaseCreator(databaseDefinition, executer));
        }
        public static SqlStatementExecuter CreateSqlExecuter(NamedConnectionString connectionString, Context context)
        {
            var sqlEngineVersion = connectionString.GetSqlEngineVersion();

            var generator = SqlGeneratorFactory.CreateGenerator(sqlEngineVersion, context);

            return(CreateSqlExecuter(connectionString, generator));
        }
Exemplo n.º 3
0
        public static DatabaseMigrator FromConnectionStringSettings(NamedConnectionString connectionString, Context context)
        {
            var sqlEngineVersion = connectionString.GetSqlEngineVersion();

            var generator          = SqlGeneratorFactory.CreateGenerator(sqlEngineVersion, context);
            var migrationGenerator = SqlGeneratorFactory.CreateMigrationGenerator(sqlEngineVersion, context);
            var executer           = SqlExecuterFactory.CreateSqlExecuter(connectionString, generator);

            return(new DatabaseMigrator(executer, migrationGenerator));
        }
        public static IDataDefinitionReader CreateDataDefinitionReader(NamedConnectionString connectionString, Context context, SchemaNamesToRead schemaNames)
        {
            var sqlEngineVersion = connectionString.GetSqlEngineVersion();

            if (sqlEngineVersion is MsSqlVersion)
            {
                return(new MsSql2016DataDefinitionReader(connectionString, context, schemaNames));
            }

            if (sqlEngineVersion is OracleVersion)
            {
                return(new Oracle12cDataDefinitionReader(connectionString, context, schemaNames));
            }

            throw new NotImplementedException($"Not implemented {sqlEngineVersion}.");
        }
        public static SqlStatementExecuter CreateSqlExecuter(NamedConnectionString connectionString, ISqlGenerator sqlGenerator)
        {
            var sqlEngineVersion = connectionString.GetSqlEngineVersion();

            if (sqlEngineVersion == SqLiteVersion.SqLite3)
            {
                return(new SqLite3Executer(connectionString, sqlGenerator));
            }

            if (sqlEngineVersion == OracleVersion.Oracle12c)
            {
                return(new Oracle12cExecuter(connectionString, sqlGenerator));
            }

            if (sqlEngineVersion == MsSqlVersion.MsSql2016)
            {
                return(new MsSql2016Executer(connectionString, sqlGenerator));
            }

            throw new NotImplementedException($"Not implemented {sqlEngineVersion}.");
        }