public string GetRunnableLambdaExpression(AbstractDataTableFiller filler) { if (!this.runnableLambdaExpressions.ContainsKey(filler)) { return(string.Empty); } return(this.runnableLambdaExpressions[filler]); }
private void EndExecute(AbstractDataTableFiller filler, ResultsLoaderProfile profile) { MonadAdapterFiller monadAdapterFiller = filler as MonadAdapterFiller; if (monadAdapterFiller != null) { this.DetachCommandFromMonitorWarnings(monadAdapterFiller.Command); } }
private void BeginExecute(AbstractDataTableFiller filler, ResultsLoaderProfile profile) { MonadAdapterFiller monadAdapterFiller = filler as MonadAdapterFiller; if (monadAdapterFiller != null) { this.AttachCommandToMonitorWarnings(monadAdapterFiller.Command); monadAdapterFiller.Command.PreservedObjectProperty = profile.WholeObjectProperty; } }
internal void ResolveObjectIds(ADPropertyDefinition property, ICollection idCollection) { if (property == null) { throw new ArgumentOutOfRangeException("property", "property should not be null."); } if (idCollection == null) { throw new ArgumentOutOfRangeException("idCollection", "idCollection should not be null."); } if (idCollection.Count == 0) { throw new ArgumentOutOfRangeException("idCollection", "idCollection should not be empty."); } ISupportResolvingIds supportResolvingIds = this.loader as ISupportResolvingIds; if (supportResolvingIds != null) { supportResolvingIds.IdentitiesToResolve = new ArrayList(idCollection); supportResolvingIds.PropertyForResolving = property; } ResultsLoaderProfile profile = this.loader.RefreshArgument as ResultsLoaderProfile; if (profile != null) { profile.PipelineObjects = new ArrayList(idCollection).ToArray(); profile.IsResolving = true; profile.ResolveProperty = property.Name; profile.SearchText = string.Empty; profile.Scope = null; if (this.PrefillBeforeResolving) { if (this.CanApplyPrefill(profile)) { if (this.FastResolving) { profile.ClearFiller(); } AbstractDataTableFiller preFiller = this.CreatePreFiller(idCollection); profile.InsertTableFiller(0, preFiller); this.ResolveObjectIdsCompleted += delegate(object param0, RunWorkerCompletedEventArgs param1) { this.UpdateNonResolvedObjects(this.loader.Table); profile.RemoveTableFiller(preFiller); }; } else { this.PrefillBeforeResolving = false; } } } this.IsResolving = true; this.loader.Refresh(NullProgress.Value); }
public override void Execute(AbstractDataTableFiller filler, DataTable table, ResultsLoaderProfile profile) { MonadAdapterFiller monadAdapterFiller = filler as MonadAdapterFiller; if (monadAdapterFiller != null && !monadAdapterFiller.HasPermission() && (this.isResultPane || monadAdapterFiller.IsResolving)) { return; } Stopwatch stopwatch = new Stopwatch(); this.BeginExecute(filler, profile); MonadCommand monadCommand = null; if (monadAdapterFiller != null) { monadCommand = monadAdapterFiller.Command; } else if (filler is SupervisionListFiller) { monadCommand = ((SupervisionListFiller)filler).Command; } if (monadCommand != null) { monadCommand.Connection = this.connection; } try { if (monadAdapterFiller != null) { ExTraceGlobals.DataFlowTracer.TracePerformance<string, Guid, RunspaceState>((long)Thread.CurrentThread.ManagedThreadId, "MonadScriptExecutionContext.Execute: In runspace {1}[State:{2}], before executing command '{0}' .", monadAdapterFiller.Command.CommandText, monadAdapterFiller.Command.Connection.RunspaceProxy.InstanceId, monadAdapterFiller.Command.Connection.RunspaceProxy.State); stopwatch.Start(); } filler.Fill(table); } catch (MonadDataAdapterInvocationException ex) { if (!(ex.InnerException is ManagementObjectNotFoundException) && !(ex.InnerException is MapiObjectNotFoundException)) { throw; } } finally { if (monadAdapterFiller != null) { stopwatch.Stop(); ExTraceGlobals.DataFlowTracer.TracePerformance((long)Thread.CurrentThread.ManagedThreadId, "MonadScriptExecutionContext.Execute: In the runspace {1}[State:{2}], {3} Milliseconds are taken to finish the command {0}.", new object[] { monadAdapterFiller.Command.CommandText, monadAdapterFiller.Command.Connection.RunspaceProxy.InstanceId, monadAdapterFiller.Command.Connection.RunspaceProxy.State, stopwatch.ElapsedMilliseconds }); } this.EndExecute(filler, profile); } }
public bool IsRunnable(AbstractDataTableFiller filler) { bool flag = true; string runnableLambdaExpression = this.GetRunnableLambdaExpression(filler); if (!string.IsNullOrEmpty(runnableLambdaExpression)) { ColumnExpression expression = ExpressionCalculator.BuildColumnExpression(runnableLambdaExpression); flag = (bool)ExpressionCalculator.CalculateLambdaExpression(expression, typeof(bool), null, this.InputTable.Rows[0]); } if (flag && this.IsResolving) { flag = (this.PipelineObjects != null && this.PipelineObjects.Length > 0); } return(flag); }
public void BuildCommand(AbstractDataTableFiller filler) { if (filler is MonadAdapterFiller) { (filler as MonadAdapterFiller).IsResolving = this.IsResolving; } if (this.IsResolving && filler.CommandBuilder != null) { filler.CommandBuilder.ResolveProperty = this.ResolveProperty; } if ((this.ScopeSupportingLevel == ScopeSupportingLevel.NoScoping && !this.UseTreeViewForm) || this.IsResolving) { filler.BuildCommand(this.SearchText, this.PipelineObjects, this.InputTable.Rows[0]); return; } filler.BuildCommandWithScope(this.SearchText, this.PipelineObjects, this.InputTable.Rows[0], this.Scope); }
public void RemoveTableFiller(AbstractDataTableFiller filler) { this.tableFillers.Remove(filler); }
public void InsertTableFiller(int index, AbstractDataTableFiller filler) { this.tableFillers.Insert(index, filler); this.runnableLambdaExpressions[filler] = string.Empty; }
public void AddTableFiller(AbstractDataTableFiller filler) { this.AddTableFiller(filler, string.Empty); }
public bool HasPermission() { bool flag = false; if (this.FillType == null) { using (List <AbstractDataTableFiller> .Enumerator enumerator = this.tableFillers.GetEnumerator()) { while (enumerator.MoveNext()) { AbstractDataTableFiller abstractDataTableFiller = enumerator.Current; MonadAdapterFiller monadAdapterFiller = abstractDataTableFiller as MonadAdapterFiller; if (monadAdapterFiller == null || monadAdapterFiller.HasPermission()) { flag = true; break; } } goto IL_9B; } } flag = true; foreach (AbstractDataTableFiller abstractDataTableFiller2 in this.tableFillers) { MonadAdapterFiller monadAdapterFiller2 = abstractDataTableFiller2 as MonadAdapterFiller; if (monadAdapterFiller2 != null && !monadAdapterFiller2.HasPermission()) { flag = false; break; } } IL_9B: if (string.Equals(this.Name, "MailboxMigration", StringComparison.OrdinalIgnoreCase)) { flag = (EMCRunspaceConfigurationSingleton.GetInstance().IsCmdletAllowedInScope("Get-MoveRequest", new string[] { "Identity", "ResultSize" }) && EMCRunspaceConfigurationSingleton.GetInstance().IsCmdletAllowedInScope("Get-MoveRequestStatistics", new string[] { "Identity" })); } else if (string.Equals(this.Name, "Database", StringComparison.OrdinalIgnoreCase)) { flag = ((EMCRunspaceConfigurationSingleton.GetInstance().IsCmdletAllowedInScope("Get-MailboxDatabase", new string[] { "Identity" }) && EMCRunspaceConfigurationSingleton.GetInstance().IsCmdletAllowedInScope("Get-MailboxDatabaseCopyStatus", new string[] { "Identity", "Server" })) || EMCRunspaceConfigurationSingleton.GetInstance().IsCmdletAllowedInScope("Get-PublicFolderDatabase", new string[] { "Identity", "Status" })); } else if (flag && string.Equals(this.Name, "DisconnectedMailbox", StringComparison.OrdinalIgnoreCase)) { flag = EMCRunspaceConfigurationSingleton.GetInstance().IsCmdletAllowedInScope("Get-ExchangeServer", new string[] { "Identity" }); } return(flag); }
public void AddTableFiller(AbstractDataTableFiller filler, string runnableLambdaExpression) { this.tableFillers.Add(filler); this.runnableLambdaExpressions[filler] = runnableLambdaExpression; }
protected override void OnDoRefreshWork(RefreshRequestEventArgs e) { Stopwatch sw = Stopwatch.StartNew(); ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader>((long)this.GetHashCode(), "-->DataTableLoader.OnDoRefreshWork: {0}", this); this.expressionCalculator = null; DataTable dataTable = (e as DataTableLoader.IDataTableLoaderRefreshRequest).DataTable.Clone(); e.Result = dataTable; dataTable.RowChanging += delegate(object param0, DataRowChangeEventArgs param1) { if (e.CancellationPending) { e.Cancel = true; this.Cancel(e); e.Result = dataTable; } }; int rowCount = 0; int expectedRowCount = Math.Max(this.lastRowCount, this.BatchSize); ResultsLoaderProfile profile = e.Argument as ResultsLoaderProfile; if (profile != null) { foreach (AbstractDataTableFiller abstractDataTableFiller in profile.TableFillers) { abstractDataTableFiller.FillCompleted += delegate(object sender, FillCompletedEventArgs args) { AbstractDataTableFiller filler = sender as AbstractDataTableFiller; if (this.IsPreFillForResolving(filler) || profile.FillType == null) { expectedRowCount = Math.Max(expectedRowCount, rowCount + this.BatchSize + 1); bool flag = !this.IsPreFillForResolving(filler) && profile.FillType == 0; this.ReportDataTable(rowCount, expectedRowCount, args.DataTable, e, flag, sw.Elapsed); if (profile.IsResolving && profile.PipelineObjects != null && flag) { foreach (object obj in profile.PipelineObjects) { if (this.FindRowByIdentity(args.DataTable, obj) != null) { profile.ResolvedObjects.Add(obj); } } IEnumerable <object> source = from id in profile.PipelineObjects where !profile.ResolvedObjects.Contains(id) select id; profile.PipelineObjects = source.ToArray <object>(); profile.ResolvedObjects.Clear(); } } }; } } dataTable.RowChanged += delegate(object sender, DataRowChangeEventArgs rowChangedEvent) { if (rowChangedEvent.Action == DataRowAction.Add) { rowCount++; ExTraceGlobals.DataFlowTracer.Information <DataTableLoader, int, TimeSpan>((long)this.GetHashCode(), "DataTableLoader.OnDoRefreshWork: {0}, rowCount:{1}. ElapsedTime:{2}", this, rowCount, sw.Elapsed); ConvertTypeCalculator.Convert(rowChangedEvent.Row); if (dataTable.Rows.Count >= this.BatchSize && (profile == null || profile.FillType == null)) { expectedRowCount = Math.Max(expectedRowCount, rowCount + this.BatchSize + 1); this.ReportDataTable(rowCount, expectedRowCount, dataTable, e, true, sw.Elapsed); } } }; try { ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader, TimeSpan>((long)this.GetHashCode(), "-->DataTableLoader.OnDoRefreshWork: Fill: {0}. ElapsedTime:{1}", this, sw.Elapsed); this.Fill(e); } catch (MonadDataAdapterInvocationException ex) { if (!(ex.InnerException is ManagementObjectNotFoundException) && !(ex.InnerException is MapiObjectNotFoundException)) { throw; } } finally { ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader, TimeSpan>((long)this.GetHashCode(), "<--DataTableLoader.OnDoRefreshWork: Fill: {0}. ElapsedTime:{1}", this, sw.Elapsed); e.Result = dataTable; ExTraceGlobals.ProgramFlowTracer.TraceFunction((long)this.GetHashCode(), "-->DataTableLoader.OnDoRefreshWork: report last batch: {0}. dataTable.Rows.Count:{1}, this.BatchSize:{2}, rowCount:{3}, expectedRowCount:{4}", new object[] { this, dataTable.Rows.Count, this.BatchSize, rowCount, rowCount + 1 }); this.FillColumnsBasedOnLambdaExpression(dataTable, e.Argument as ResultsLoaderProfile); ColumnValueCalculator.CalculateAll(dataTable); if (!e.ReportedProgress) { ExTraceGlobals.ProgramFlowTracer.TracePerformance <DataTableLoader, string, string>(0L, "Time:{1}. {2} First batch data arrived in worker thread. {0}", this, ExDateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.fff"), (this != null) ? this.Table.TableName : string.Empty); } e.ReportProgress(rowCount, rowCount + 1, this.ProgressText, this.MoveRows(dataTable, null, false)); ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader>((long)this.GetHashCode(), "<--DataTableLoader.OnDoRefreshWork: report last batch: {0}", this); } base.OnDoRefreshWork(e); e.Result = dataTable; ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader, TimeSpan>((long)this.GetHashCode(), "<--DataTableLoader.OnDoRefreshWork: {0}. Total ElapsedTime:{1}", this, sw.Elapsed); }
private bool IsPreFillForResolving(AbstractDataTableFiller filler) { return(filler is PreFillADObjectIdFiller); }
public abstract void Execute(AbstractDataTableFiller filler, DataTable table, ResultsLoaderProfile profile);