示例#1
0
        private static IHistoryRepository CreateHistoryRepository()
        {
            var annotationsProvider = new SqlCeAnnotationProvider();
            var sqlGenerator        = new SqlCeSqlGenerationHelper();
            var typeMapper          = new SqlCeTypeMapper();

            var commandBuilderFactory = new RelationalCommandBuilderFactory(
                new FakeSensitiveDataLogger <RelationalCommandBuilderFactory>(),
                new DiagnosticListener("Fake"),
                typeMapper);

            return(new SqlCeHistoryRepository(
                       Mock.Of <IRelationalDatabaseCreator>(),
                       Mock.Of <IRawSqlCommandBuilder>(),
                       Mock.Of <ISqlCeDatabaseConnection>(),
                       new DbContextOptions <DbContext>(
                           new Dictionary <Type, IDbContextOptionsExtension>
            {
                { typeof(SqlCeOptionsExtension), new SqlCeOptionsExtension() }
            }),
                       new MigrationsModelDiffer(
                           new SqlCeTypeMapper(),
                           annotationsProvider,
                           new SqlCeMigrationsAnnotationProvider()),
                       new SqlCeMigrationsSqlGenerator(
                           commandBuilderFactory,
                           new SqlCeSqlGenerationHelper(),
                           typeMapper,
                           annotationsProvider),
                       annotationsProvider,
                       sqlGenerator));
        }
 public SqlCeHistoryRepository(
     [NotNull] IDatabaseCreator databaseCreator,
     [NotNull] IRawSqlCommandBuilder sqlCommandBuilder,
     [NotNull] ISqlCeDatabaseConnection connection,
     [NotNull] IDbContextOptions options,
     [NotNull] IMigrationsModelDiffer modelDiffer,
     [NotNull] SqlCeMigrationsSqlGenerator migrationSqlGenerator,
     [NotNull] SqlCeAnnotationProvider annotations,
     [NotNull] ISqlGenerationHelper sqlGenerationHelper)
     : base(
         databaseCreator,
         sqlCommandBuilder,
         connection,
         options,
         modelDiffer,
         migrationSqlGenerator,
         annotations,
         sqlGenerationHelper)
 {
 }
示例#3
0
        private static IHistoryRepository CreateHistoryRepository(string schema = null)
        {
            var annotationsProvider = new SqlCeAnnotationProvider();
            var sqlGenerator        = new SqlCeSqlGenerationHelper(new RelationalSqlGenerationHelperDependencies());
            var typeMapper          = new SqlCeTypeMapper(new RelationalTypeMapperDependencies());

            var commandBuilderFactory = new RelationalCommandBuilderFactory(
                new FakeDiagnosticsLogger <LoggerCategory.Database.Sql>(),
                new FakeDiagnosticsLogger <LoggerCategory.Database.DataReader>(),
                typeMapper);

            return(new SqlCeHistoryRepository(
                       new HistoryRepositoryDependencies(
                           Mock.Of <IRelationalDatabaseCreator>(),
                           Mock.Of <IRawSqlCommandBuilder>(),
                           Mock.Of <ISqlCeDatabaseConnection>(),
                           new DbContextOptions <DbContext>(
                               new Dictionary <Type, IDbContextOptionsExtension>
            {
                {
                    typeof(SqlCeOptionsExtension),
                    new SqlCeOptionsExtension().WithMigrationsHistoryTableSchema(schema)
                }
            }),
                           new MigrationsModelDiffer(
                               new SqlCeTypeMapper(new RelationalTypeMapperDependencies()),
                               annotationsProvider,
                               new SqlCeMigrationsAnnotationProvider(new MigrationsAnnotationProviderDependencies())),
                           new SqlCeMigrationsSqlGenerator(
                               new MigrationsSqlGeneratorDependencies(
                                   commandBuilderFactory,
                                   new SqlCeSqlGenerationHelper(new RelationalSqlGenerationHelperDependencies()),
                                   typeMapper,
                                   annotationsProvider),
                               new FakeDiagnosticsLogger <LoggerCategory.Database.Sql>()),
                           annotationsProvider,
                           sqlGenerator)));
        }