Ejemplo n.º 1
0
        public void SaveToDisk(PartialDatabase database)
        {
            var fileName = Path.Combine(_databaseFolder, database.Name + _databaseExtension);
            var file     = _databaseFileMapper.Map(database);

            _dataFileManager.SaveDataFile(fileName, file);
        }
Ejemplo n.º 2
0
 private void Map(PartialDatabase database)
 {
     DatabaseName = database.Name;
     DatabaseId   = database.Id;
     database.Tables.ForEach(table => Tables.Add(table.GetSchema()));
     Location = (Location)_process.GetLocation();
 }
Ejemplo n.º 3
0
 public void AddDatabase(PartialDatabase database)
 {
     if (!HasDatabase(database.Name))
     {
         _databases.Add(database);
         SaveToDisk(database);
     }
 }
Ejemplo n.º 4
0
        public PartialDatabase GetFullDatabase(string databaseName)
        {
            PartialDatabase db = null;

            Databases.ForEach(database =>
            {
                if ((database is PartialDatabase) && (database.Name == databaseName))
                {
                    db = database as PartialDatabase;
                }
            });

            return(db);
        }
Ejemplo n.º 5
0
        public void CreateDatabaseFromContractInfo(ContractInfo info, Process process)
        {
            var dbName = info.DatabaseName;

            if (!HasDatabase(dbName))
            {
                var reference = new DatabaseReference();
                reference.DatabaseName = dbName;
                var location = new Location(null, info.Location.IpAddress, info.Location.PortNumber, string.Empty);
                reference.Location   = location;
                reference.DatabaseId = info.DatabaseId;

                var db = new PartialDatabase(dbName, process, reference);

                foreach (var table in info.Schema.Tables)
                {
                    db.AddTable(table);
                }

                _databases.Add(db);
                SaveToDisk(db);
            }
        }
Ejemplo n.º 6
0
 public void SaveToDisk(PartialDatabase database)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
 public DbSchema(PartialDatabase database, Process process) : this()
 {
     _process = process;
     Map(database);
 }