Example #1
0
        public override IMigrationProcessor Create(string connectionString, IAnnouncer announcer, IMigrationProcessorOptions options)
        {
            var factory    = new SQLiteDbFactory();
            var connection = factory.CreateConnection(connectionString);

            return(new SQLiteProcessor(connection, new SQLiteGenerator(), announcer, options, factory));
        }
        public override IMigrationProcessor Create(string connectionString, IAnnouncer announcer, IMigrationProcessorOptions options)
        {
            var factory       = new SQLiteDbFactory(_serviceProvider);
            var connection    = factory.CreateConnection(connectionString);
            var quoterOptions = new OptionsWrapper <QuoterOptions>(new QuoterOptions());
            var quoter        = new SQLiteQuoter(quoterOptions);

            return(new SQLiteProcessor(connection, new SQLiteGenerator(quoter), announcer, options, factory, quoter));
        }
Example #3
0
 public SQLiteProcessor(
     [NotNull] SQLiteDbFactory factory,
     [NotNull] SQLiteGenerator generator,
     [NotNull] ILogger <SQLiteProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] IServiceProvider serviceProvider)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
     _serviceProvider = serviceProvider;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteProcessor"/> class.
 /// </summary>
 /// <param name="factory">The SQLite DB factory.</param>
 /// <param name="generator">The migration generator.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="options">The options.</param>
 /// <param name="connectionStringAccessor">The connection string accessor.</param>
 /// <param name="batchParserFactory">The batch parser factory.</param>
 public SQLiteProcessor(
     [NotNull] SQLiteDbFactory factory,
     [NotNull] SQLiteGenerator generator,
     [NotNull] ILogger <SQLiteProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] SQLiteBatchParserFactory batchParserFactory)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
     _batchParserFactory = batchParserFactory;
 }
Example #5
0
 public SQLiteProcessor(
     [NotNull] SQLiteDbFactory factory,
     [NotNull] SQLiteGenerator generator,
     [NotNull] ILogger <SQLiteProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] IServiceProvider serviceProvider)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
     _batchParserFactory = serviceProvider.GetService <SQLiteBatchParserFactory>()
                           ?? new SQLiteBatchParserFactory(serviceProvider);
 }
        public void SetUp()
        {
            // This connection used in the tests
            var factory = new SQLiteDbFactory();
            _connection = factory.CreateConnection("Data Source=:memory:;Version=3;New=True;");
            _connection.Open();
            _command = _connection.CreateCommand();

            // SUT
            _processor = new SQLiteProcessor(_connection, new SQLiteGenerator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), factory);

            column = new Mock<ColumnDefinition>();
            tableName = "NewTable";
            tableNameThanMustBeEscaped = "123NewTable";
            columnName = "ColumnName";
            column.SetupGet(c => c.Name).Returns(columnName);
            column.SetupGet(c => c.IsNullable).Returns(true);
            column.SetupGet(c => c.Type).Returns(DbType.Int32);
        }
 public override IMigrationProcessor Create(string connectionString, IAnnouncer announcer, IMigrationProcessorOptions options)
 {
     var factory = new SQLiteDbFactory();
     var connection = factory.CreateConnection(connectionString);
     return new SQLiteProcessor(connection, new SQLiteGenerator(), announcer, options, factory);
 }
        protected static void ExecuteWithSqlite(Action<IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions)
        {
            if (!serverOptions.IsEnabled)
                return;

            var announcer = new TextWriterAnnouncer(System.Console.Out);
            announcer.Heading("Testing Migration against SQLite");

            var factory = new SQLiteDbFactory();
            using (var connection = factory.CreateConnection(serverOptions.ConnectionString))
            {
                var processor = new SQLiteProcessor(connection, new SQLiteGenerator(), announcer, new ProcessorOptions(), factory);
                test(processor);
            }
        }