public void ImportData(DataFile file, bool isReimport = false) { DataFile export = null; if (!isReimport && context.DatabaseExists(file.database)) { export = DefaultDataExport(file.database, true); } IDataLoader loader = DataLoaderFactory.CreateDataLoader(file.dataType, context); loader.Import(file); if (export == null) { return; } List <DataFile> dataFiles = new List <DataFile>() { export }; if (export.dataType == DataType.Archive) { dataFiles = ExtractZip(export); } for (int i = 0; i < dataFiles.Count; i++) { ImportData(dataFiles[i], true); //recursive reimport } }
public DataFile ExportData(DataType dataType, string database, bool dropDatabase = false) { IDataLoader loader = DataLoaderFactory.CreateDataLoader(dataType, context); DataFile export = loader.Export(database); if (dropDatabase) { context.DropDatabase(database); } return(export); }
public DataFile DefaultDataExport(string database, bool dropDatabase = false) { IDataLoader loader = DataLoaderFactory.CreateDefaultExporter(database, context); DataFile export = loader.Export(database); if (dropDatabase) { context.DropDatabase(database); } return(export); }