void IDbMigrator.UpdateToModel(IModel model) { if (_LoggerFactory == null) { throw new Exception(); } if (_ConnectionString == null) { throw new Exception(); } var dbModelFactory = new SqliteDatabaseModelFactory( new DiagnosticsLogger <DbLoggerCategory.Scaffolding>( _LoggerFactory, new LoggingOptions(), SqlITEMigratorDiagnostic ), new SqliteTypeMappingSource( new TypeMappingSourceDependencies( new ValueConverterSelector(new ValueConverterSelectorDependencies()), Array.Empty <ITypeMappingSourcePlugin>() ), new RelationalTypeMappingSourceDependencies( Array.Empty <IRelationalTypeMappingSourcePlugin>() ) )); var dbModel = dbModelFactory.Create(_ConnectionString, new List <string>(), new List <string>()); }
public virtual DatabaseModel Create(string connectionString, IEnumerable <string> tables, IEnumerable <string> schemas) { var modelFactory = new SqliteDatabaseModelFactory(_logger); using (var connection = new System.Data.SQLite.SQLiteConnection(connectionString)) { return(modelFactory.Create(connection, tables, schemas)); } }
public SqliteDatabaseModelFactoryTest() { _testStore = SqliteTestStore.CreateScratch(); var serviceProvider = new SqliteDesignTimeServices() .ConfigureDesignTimeServices(new ServiceCollection().AddLogging()) .BuildServiceProvider(); var logger = new TestLogger(); serviceProvider.GetService <ILoggerFactory>().AddProvider(new TestLoggerProvider(logger)); _factory = serviceProvider .GetService <IDatabaseModelFactory>() as SqliteDatabaseModelFactory; }
public SqliteDatabaseModelFactoryTest() { _testStore = SqliteTestStore.CreateScratch(); var reporter = new TestOperationReporter(); var serviceCollection = new ServiceCollection().AddScaffolding(reporter) .AddSingleton <IOperationReporter>(reporter); new SqliteDesignTimeServices().ConfigureDesignTimeServices(serviceCollection); var serviceProvider = serviceCollection.BuildServiceProvider(); _factory = serviceProvider .GetService <IDatabaseModelFactory>() as SqliteDatabaseModelFactory; }
public SqliteDatabaseModelFactoryTest() { _testStore = SqliteTestStore.CreateScratch(); var serviceCollection = new ServiceCollection().AddLogging(); new SqliteDesignTimeServices().ConfigureDesignTimeServices(serviceCollection); serviceCollection .AddSingleton <ILoggingOptions, LoggingOptions>() .AddSingleton(typeof(IInterceptingLogger <>), typeof(InterceptingLogger <>)); var serviceProvider = serviceCollection.BuildServiceProvider(); var logger = new TestLogger(); serviceProvider.GetService <ILoggerFactory>().AddProvider(new TestLoggerProvider(logger)); _factory = serviceProvider .GetService <IDatabaseModelFactory>() as SqliteDatabaseModelFactory; }
public SqliteDatabaseModelFactoryTest() { _testStore = SqliteTestStore.CreateScratch(); _factory = new SqliteDatabaseModelFactory(); }