示例#1
0
        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
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }