public IDatastore LoadDataFromSource(DesignerItemBase sourceItem, IDatastore dataStore, ReportProgressMethod reportProgressMethod) { IModule sourceObject = objectResolver.GetModule(sourceItem.ID, sourceItem.ModuleDescription.ModuleType); IConnection connectionObject = objectResolver.GetConnection(sourceItem.ID); if (connectionObject == null) { if (runLog != null) { string label = String.IsNullOrEmpty(sourceItem.ItemLabel) ? "-- No Label --" : sourceItem.ItemLabel; throw new Exception("No connection was selected for the source '" + label + "'."); } dataStore = null; } ItemLog itemLog = ItemLog.CreateNew(sourceItem.ID, sourceItem.ItemLabel, sourceItem.ModuleDescription.ModuleType.Name, null); if (runLog != null) { var databaseInterface = SqliteWrapper.GetSqliteWrapper(runLog.RunLogPath, sourceItem.ID, sourceItem.ItemLabel); itemLog.DatabasePath = runLog.RunLogPath + "\\" + databaseInterface.GetDatabaseName(); parentItemLog.SubFlowLogs.Add(itemLog); } ((IDataSource)sourceObject).LoadData(connectionObject, dataStore, reportProgressMethod); itemLog.EndTime = DateTime.Now; return(dataStore); }
public IDatastore WriteToTarget(DesignerItemBase targetItem, IDatastore dataStore, ReportProgressMethod reportProgressMethod) { IModule targetModule = objectResolver.GetModule(targetItem.ID, targetItem.ModuleDescription.ModuleType); IConnection connectionObject = objectResolver.GetConnection(targetItem.ID); IDatabaseInterface databaseInterface = SqliteWrapper.GetSqliteWrapper(runLog.RunLogPath, targetItem.ID, targetItem.ItemLabel); ItemLog itemLog = ItemLog.CreateNew(targetItem.ID, targetItem.ItemLabel, targetItem.ModuleDescription.ModuleType.Name, runLog.RunLogPath + "\\" + databaseInterface.GetDatabaseName()); ((IDataTarget)targetModule).WriteData(connectionObject, databaseInterface, dataStore, reportProgressMethod); itemLog.EndTime = DateTime.Now; parentItemLog.SubFlowLogs.Add(itemLog); return(dataStore); }
void bgw_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { var itemWorker = e.Argument as ItemWorker; var designerItem = itemWorker.DesignerItem; ItemLog itemLog = ItemLog.CreateNew(designerItem.ID, designerItem.ItemLabel, designerItem.ModuleDescription.ModuleType.Name, DateTime.Now); ObjectResolver objectResolver = new ObjectResolver(this.package.Configurations.OfType <StepConfigurationBase>().ToList(), connectionConfigurations); try { if (designerItem.ModuleDescription.Attributes.ContainsSubConfiguration) { SerializedDiagram subDiagram = this.package.SubDiagrams.FirstOrDefault(t => t.ParentItemId == designerItem.ID); if (subDiagram != null) { IntegrationTool.SDK.Diagram.DiagramDeserializer deserializer = new SDK.Diagram.DiagramDeserializer(this.loadedModules, subDiagram.Diagram); var flowGraph = new FlowGraph(deserializer.DesignerItems, deserializer.Connections); SubFlowExecution subFlowExecution = new SubFlowExecution(itemWorker, itemLog, objectResolver, flowGraph); subFlowExecution.Execute(this.runLog); } } else { ItemExecution itemExecution = new ItemExecution(itemWorker, objectResolver, this.runLog); itemExecution.Execute(); } } catch (Exception ex) { itemLog.ExecutionError = ex.ToString(); } itemLog.EndTime = DateTime.Now; lock (this.runLog.ItemLogs) { this.runLog.ItemLogs.Add(itemLog); } e.Result = itemLog; }