Example #1
0
        public FileImportResult Import(FileInspectionRequest request, TflConnection output)
        {
            var fileInformation = FileInformationFactory.Create(request, _logger);

            var cfg = BuildProcess(fileInformation, request, output, _logger);

            if (cfg.Connections.First(c => c.Name == "output").Provider == "internal")
            {
                // nothing to init, so just run in default mode
                return(new FileImportResult {
                    Information = fileInformation,
                    Rows = ProcessFactory.CreateSingle(cfg, _logger).Execute()
                });
            }

            // first run in init mode
            cfg.Mode = "init";
            var process = ProcessFactory.CreateSingle(cfg, _logger, new Options {
                Mode = "init"
            });

            process.ExecuteScaler();

            // now run in default mode
            cfg.Mode = "default";
            process  = ProcessFactory.CreateSingle(cfg, _logger, new Options()
            {
                Mode = "default"
            });
            return(new FileImportResult {
                Information = fileInformation,
                Rows = process.Execute(),
                RowCount = process.Entities[0].Inserts
            });
        }
Example #2
0
 public Fields Inspect(string file)
 {
     return(Inspect(FileInformationFactory.Create(file, _logger), new FileInspectionRequest(file)));
 }
Example #3
0
 public override Fields GetEntitySchema(Process process, Entity entity, bool isMaster = false)
 {
     return(new FieldInspector(process.Logger).Inspect(FileInformationFactory.Create(File, process.Logger), process.FileInspectionRequest));
 }