Esempio n. 1
0
 public Database()
 {
     _dbFullName   = Path.Combine(Globals.DbDir, DbName);
     _dbExistsOnFs = File.Exists(Path.Combine(_dbFullName)) ?
                     DbExistsOnFileSystem.True :
                     DbExistsOnFileSystem.False;
 }
Esempio n. 2
0
        public void Create()
        {
            if (File.Exists(_dbFullName))
            {
                throw new InvalidOperationException(
                          $"Cannot create {_dbFullName} because it already exists.");
            }

            if (!Directory.Exists(Globals.DbDir))
            {
                Directory.CreateDirectory(Globals.DbDir);
            }

            using (var temp = File.Create(_dbFullName)){}
            _dbExistsOnFs = DbExistsOnFileSystem.True;
            Console.WriteLine($"Created datatabase: {_dbFullName}");
        }