Пример #1
0
        public SqlServerModuleHistoryRepository(HistoryRepositoryDependencies dependencies, ICurrentDbContext currentDbContext)
            : base(dependencies)
        {
            var dbContext = currentDbContext.Context as ModuleDbContext;

            modulePrefix = $"_{dbContext.ModuleMetaInfo.ModuleName}";
        }
Пример #2
0
        public static string BuildInsertScript(HistoryRow row, HistoryRepositoryDependencies dependencies, MigrationHistoryTable historyTable)
        {
            var sqlGenerationHelper = dependencies.SqlGenerationHelper;
            var stringTypeMapping   = dependencies.TypeMappingSource.GetMapping(typeof(string));

            return(new StringBuilder().Append("INSERT INTO ")
                   .Append(sqlGenerationHelper.DelimitIdentifier(historyTable.TableName, historyTable.TableSchema))
                   .Append(" (")
                   .Append(sqlGenerationHelper.DelimitIdentifier(historyTable.MigrationIdColumnName))
                   .Append(", ")
                   .Append(sqlGenerationHelper.DelimitIdentifier(historyTable.ProductVersionColumnName))
                   .Append(", ")
                   .Append(sqlGenerationHelper.DelimitIdentifier(historyTable.AppliedVersionColumnName))
                   .Append(", ")
                   .Append(sqlGenerationHelper.DelimitIdentifier(historyTable.AppliedDateColumnName))
                   .AppendLine(")")
                   .Append("VALUES (")
                   .Append(stringTypeMapping.GenerateSqlLiteral(row.MigrationId))
                   .Append(", ")
                   .Append(stringTypeMapping.GenerateSqlLiteral(row.ProductVersion))
                   .Append(", ")
                   .Append(stringTypeMapping.GenerateSqlLiteral(Constants.Version))
                   .Append(", ")
                   .Append(stringTypeMapping.GenerateSqlLiteral(DateTime.Now.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss'.'fffffffK")))
                   .Append(")")
                   .AppendLine(sqlGenerationHelper.StatementTerminator)
                   .ToString());
        }
Пример #3
0
        public CassandraHistoryRepository(HistoryRepositoryDependencies dependencies)
        {
            Dependencies = dependencies;
            var relationalOptions = RelationalOptionsExtension.Extract(dependencies.Options);

            TableName   = relationalOptions?.MigrationsHistoryTableName ?? DefaultTableName;
            TableSchema = relationalOptions?.MigrationsHistoryTableSchema;
            EnsureModel();
        }
Пример #4
0
        /// <summary>
        ///     This is internal functionality and not intended for public use.
        /// </summary>
        public SpannerHistoryRepository(HistoryRepositoryDependencies dependencies)
            : base(dependencies)
        {
            Dependencies = dependencies;

            var relationalOptions = RelationalOptionsExtension.Extract(dependencies.Options);

            TableName = relationalOptions?.MigrationsHistoryTableName ?? DefaultMigrationsHistoryTableName;
        }
Пример #5
0
    /// <summary>
    ///     Initializes a new instance of this class.
    /// </summary>
    /// <param name="dependencies">Parameter object containing dependencies for this service.</param>
    protected HistoryRepository(HistoryRepositoryDependencies dependencies)
    {
        Dependencies = dependencies;

        var relationalOptions = RelationalOptionsExtension.Extract(dependencies.Options);

        TableName   = relationalOptions.MigrationsHistoryTableName ?? DefaultTableName;
        TableSchema = relationalOptions.MigrationsHistoryTableSchema;
    }
        public CassandraHistoryRepository(RelationalConnectionDependencies relationalConnectionDependencies, HistoryRepositoryDependencies dependencies)
        {
            var cassandraOptionsExtension = CassandraOptionsExtension.Extract(relationalConnectionDependencies.ContextOptions);

            Dependencies = dependencies;
            var relationalOptions = RelationalOptionsExtension.Extract(dependencies.Options);

            TableName   = relationalOptions?.MigrationsHistoryTableName ?? DefaultTableName;
            TableSchema = cassandraOptionsExtension.DefaultKeyspace;
            EnsureModel();
        }
Пример #7
0
 public OqtaneHistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies)
 {
     _migrationHistoryTable = new MigrationHistoryTable
     {
         TableName                = TableName,
         TableSchema              = TableSchema,
         MigrationIdColumnName    = MigrationIdColumnName,
         ProductVersionColumnName = ProductVersionColumnName,
         AppliedVersionColumnName = _appliedVersionColumnName,
         AppliedDateColumnName    = _appliedDateColumnName
     };
 }
        /// <summary>
        /// 实例化
        /// </summary>
        /// <param name="dependencies">历史仓库依赖</param>
        /// <param name="logger">日志</param>
        public OracleHistoryRepository(
            [NotNull] HistoryRepositoryDependencies dependencies,
            IDiagnosticsLogger <DbLoggerCategory.Migrations> logger = null)
            : base(dependencies)
        {
            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Migrations> .Write(logger, LogLevel.Trace, OracleTraceTag.Entry, OracleTraceClassName.OracleHistoryRepository, OracleTraceFuncName.ctor);
            }

            m_oracleLogger = logger;

            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Migrations> .Write(m_oracleLogger, LogLevel.Trace, OracleTraceTag.Exit, OracleTraceClassName.OracleHistoryRepository, OracleTraceFuncName.ctor);
            }
        }
 public MapHiveDbContextHistoryRepository(HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }
Пример #10
0
 public PortAuthorityMigrationHistoryRepository(HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }
Пример #11
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public SqliteHistoryRepository(HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }
 public ShipyardMigrationHistoryRepository(HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }
 public VfpHistoryRepository([NotNull] HistoryRepositoryDependencies dependencies) : base(dependencies)
 {
 }
Пример #14
0
 public iSpindelHistoryRepository(HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }
 /// <summary>
 /// Initialize <see cref="SqlServerSeedRepository"/>
 /// </summary>
 /// <param name="dependencies">The repository dependencies</param>
 public SqlServerSeedRepository(HistoryRepositoryDependencies dependencies) : base(dependencies)
 {
 }
 public ClickHouseHistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies)
 {
 }
        private static IHistoryRepository CreateHistoryRepository()
        {
            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder.UseMySQL(MySQLTestStore.rootConnectionString + "database=test;");
            var connection = new MySQLServerConnection(optionsBuilder.Options, new Logger <MySQLServerConnection>(new LoggerFactory()));

            var typeMapper = new MySQLTypeMapper();

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddEntityFrameworkMySQL()
            .AddDbContext <MyTestContext>();

            var serviceProvider = serviceCollection.BuildServiceProvider();

            var context = serviceProvider.GetRequiredService <MyTestContext>();

            var creator    = context.GetService <IRelationalDatabaseCreator>();
            var cmdBuilder = context.GetService <IRawSqlCommandBuilder>();

            var options = new DbContextOptions <DbContext>(
                new Dictionary <Type, IDbContextOptionsExtension>
            {
                {
                    typeof(MySQLOptionsExtension),
                    new MySQLOptionsExtension()
                }
            });

            var modelDiffer = new MigrationsModelDiffer(
                new MySQLTypeMapper(),
                new MySQLMigrationsAnnotationProvider(
                    new MigrationsAnnotationProviderDependencies()));

            var logger = new DiagnosticsLogger <DbLoggerCategory.Database.Command>(
                new LoggerFactory(),
                new LoggingOptions(),
                new DiagnosticListener("Fake"));

            var commandBuilderFactory = new RelationalCommandBuilderFactory(
                logger,
                typeMapper);

            var sqlGeneratorHelper = new MySQLSqlGenerationHelper(new RelationalSqlGenerationHelperDependencies());

            var migrationsSqlGeneratorDependencies = new MigrationsSqlGeneratorDependencies(
                commandBuilderFactory,
                sqlGeneratorHelper,
                typeMapper);

            var migrationsSqlGeneratior = new MySQLMigrationsSqlGenerator(migrationsSqlGeneratorDependencies);

            HistoryRepositoryDependencies dependencies = new HistoryRepositoryDependencies(
                creator,
                cmdBuilder,
                connection,
                options,
                modelDiffer,
                migrationsSqlGeneratior,
                sqlGeneratorHelper);

            return(new MySQLHistoryRepository(dependencies));
        }
Пример #18
0
 public LowercaseHistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies)
 {
 }
Пример #19
0
 public ApplicationHistoryRepository(HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }
Пример #20
0
 protected MySQLHistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies)
 {
 }
 /// <summary>
 /// Initialize a relational seeder
 /// </summary>
 /// <param name="currentDbContext">The current db context</param>
 /// <param name="seedRepository">The seed repository</param>
 /// <param name="seedAssembly">The seed assembly</param>
 /// <param name="seedDependencies">The relational seed dependencies</param>
 public RelationalSeeder(ICurrentDbContext currentDbContext, ISeedRepository seedRepository, ISeedAssembly seedAssembly, ILoggerFactory loggerFactory, HistoryRepositoryDependencies seedDependencies) : base(currentDbContext, seedRepository, seedAssembly, loggerFactory, seedDependencies.Options)
 {
     _seedDependencies = seedDependencies;
 }
Пример #22
0
 public NpgsqlHistoryRepository(HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }
Пример #23
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public SqlServerHistoryRepository([NotNull] HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }
Пример #24
0
 /// <summary>
 /// Initialize <see cref="PostgresSeedRepository"/>
 /// </summary>
 /// <param name="dependencies">The repository dependencies</param>
 public PostgresSeedRepository(HistoryRepositoryDependencies dependencies) : base(dependencies)
 {
 }
Пример #25
0
 public FbHistoryRepository(HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }
Пример #26
0
 public FirebirdSqlHistoryRepository(
     [NotNull] HistoryRepositoryDependencies dependencies)
     : base(dependencies)
 {
 }