Ejemplo n.º 1
0
        public override void Drop()
        {
            var databaseLocation = SQLiteConnectionProvider.GetFullDBPath(Settings);

            log.LogDebug($"Удаление базы данных ({databaseLocation})");
            if (!File.Exists(databaseLocation))
            {
                return;
            }
            File.Delete(databaseLocation);
        }
Ejemplo n.º 2
0
        public override void CreateEmptyDB()
        {
            var databaseLocation = SQLiteConnectionProvider.GetFullDBPath(Settings);

            log.LogDebug($"Создание пустой базы данных ({databaseLocation})");
            var directoryPath = Path.GetDirectoryName(databaseLocation);

            if (!string.IsNullOrWhiteSpace(directoryPath))
            {
                Directory.CreateDirectory(directoryPath);
            }
            SQLiteConnection.CreateFile(databaseLocation);
            var createCommandText = GetResourceAsString(GetType(), GetAppropriateCreateScript(Settings));

            using (var sqliteConnection = SQLiteConnectionProvider.GetConnectionFromSettings(Settings))
            {
                sqliteConnection.Execute(createCommandText);
            }
        }
Ejemplo n.º 3
0
        public override bool DatabaseExists()
        {
            var fullDbPath = SQLiteConnectionProvider.GetFullDBPath(Settings);

            return(File.Exists(fullDbPath));
        }