using Dapper; using LoadStockDbFromTrans.DbConnections; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; namespace LoadStockDbFromTrans.DbInitializers { public class SqliteDbInitializer : ISqliteDbInitializer { private const string INIT_TABLE = @" CREATE TABLE [NewBackupRegings] ( [Id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , [BackedUp] text NOT NULL , [DbName] text NULL , [BackupDbName] text NULL , [BackupPath] text NULL )"; private readonly SqliteDbConnectionFactory _sqliteDbConnectionFactory; private readonly ILogger _log; public SqliteDbInitializer(SqliteDbConnectionFactory sqliteDbConnectionFactory, ILogger log) { _sqliteDbConnectionFactory = sqliteDbConnectionFactory; _log = log; } public void Initialize() { _log.LogInformation(INIT_TABLE); using (IDbConnection database = _sqliteDbConnectionFactory.Connect()) { database.Execute(INIT_TABLE); } } } }