public ImportOperation Import(Config config) { _config = config; using (var operationTypeService = new OperationTypeService(config.TargetConnectionString)) { var importType = operationTypeService.Get(config.ImportType); var currentOperation = importType.Operation; if (currentOperation == ImportOperation.Invalid) { throw new ArgumentException("unknown Import type"); } using (var iiService = new IngredientImportService(config.TargetConnectionString)) { if (config.ImportType == "Fourth_1.3" && iiService.ValidateStandardTemplate(config.FileName) == false) { throw new ArgumentException(string.Empty); } if (config.ImportType == "Fourth_1.6") { iiService.UpdateSaltTargetConfig(); } } // execute step before the import on the target DB if (!string.IsNullOrWhiteSpace(importType.PrerequisiteQuery)) { operationTypeService.Exec(importType.PrerequisiteQuery); } Insert(currentOperation, config); return(currentOperation); } }