protected override void OnFill(DataTable table) { this.Command.CommandType = CommandType.Text; DataTable filledTable = table; if (this.FixedValues.Count != 0) { filledTable = table.Clone(); filledTable.RowChanged += delegate(object sender, DataRowChangeEventArgs e) { if (e.Action == DataRowAction.Add) { foreach (string text in this.FixedValues.Keys) { e.Row[text] = this.FixedValues[text]; } table.Rows.Add(e.Row.ItemArray); filledTable.Rows.Remove(e.Row); } }; } using (MonadDataAdapter monadDataAdapter = new MonadDataAdapter(this.Command)) { if (table.Columns.Count != 0) { monadDataAdapter.MissingSchemaAction = MissingSchemaAction.Ignore; monadDataAdapter.EnforceDataSetSchema = true; } monadDataAdapter.Fill(filledTable); } }
private void FillTableWithDatabaseCopyEntries(DataTable table) { base.Command.CommandType = CommandType.Text; foreach (string commandText in this.GetCommandScripts()) { base.Command.CommandText = commandText; using (MonadDataAdapter monadDataAdapter = new MonadDataAdapter(base.Command)) { if (table.Columns.Count != 0) { monadDataAdapter.MissingSchemaAction = MissingSchemaAction.Ignore; monadDataAdapter.EnforceDataSetSchema = true; } monadDataAdapter.Fill(table); } } }
protected override void OnFill(DataTable resultsTable) { base.Command.CommandType = CommandType.StoredProcedure; bool flag = this.RequireMatchFilter(); bool flag2 = this.RequireMatchResolve(); DataTable dataTable = resultsTable; if (flag || flag2) { dataTable = resultsTable.Clone(); } using (MonadDataAdapter monadDataAdapter = new MonadDataAdapter(base.Command)) { if (dataTable.Columns.Count != 0) { monadDataAdapter.MissingSchemaAction = MissingSchemaAction.Ignore; monadDataAdapter.EnforceDataSetSchema = true; } monadDataAdapter.Fill(dataTable); } if (flag || flag2) { resultsTable.BeginLoadData(); foreach (object obj in dataTable.Rows) { DataRow dataRow = (DataRow)obj; bool flag3 = true; if (flag) { flag3 = this.MatchFilter(dataRow); } if (flag2 && flag3) { flag3 = this.MatchResolveProperty(dataRow); } if (flag3) { resultsTable.Rows.Add(dataRow.ItemArray); } } resultsTable.EndLoadData(); } }
private void Fill(RefreshRequestEventArgs e) { ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader>((long)this.GetHashCode(), "-->DataTableLoader.Fill: {0}", this); ResultsLoaderProfile profile = e.Argument as ResultsLoaderProfile; if (profile != null) { DataTable dataTable = e.Result as DataTable; dataTable.RowChanged += delegate(object sender, DataRowChangeEventArgs eventArgs) { if (eventArgs.Action == DataRowAction.Add) { this.FillPrimaryKeysBasedOnLambdaExpression(eventArgs.Row, profile); } }; DataTable dataTable2 = dataTable.Clone(); dataTable2.RowChanged += delegate(object sender, DataRowChangeEventArgs eventArgs) { if (eventArgs.Action == DataRowAction.Add) { this.FillPrimaryKeysBasedOnLambdaExpression(eventArgs.Row, profile); } }; if (!this.EnforeViewEntireForest && !profile.HasPermission()) { goto IL_26F; } using (DataAdapterExecutionContext dataAdapterExecutionContext = this.executionContextFactory.CreateExecutionContext()) { dataAdapterExecutionContext.Open(base.UIService, this.WorkUnits, this.EnforeViewEntireForest, profile); foreach (AbstractDataTableFiller filler in profile.TableFillers) { if (profile.IsRunnable(filler)) { if (e.CancellationPending) { break; } profile.BuildCommand(filler); if (profile.FillType == 1 || this.IsPreFillForResolving(filler)) { dataAdapterExecutionContext.Execute(filler, dataTable2, profile); this.MergeChanges(dataTable2, dataTable); dataTable2.Clear(); } else { dataAdapterExecutionContext.Execute(filler, dataTable, profile); } } } goto IL_26F; } } MonadCommand monadCommand = e.Argument as MonadCommand; if (monadCommand != null) { this.AttachCommandToMonitorWarnings(monadCommand); using (MonadConnection monadConnection = new MonadConnection(PSConnectionInfoSingleton.GetInstance().GetConnectionStringForScript(), new CommandInteractionHandler(), ADServerSettingsSingleton.GetInstance().CreateRunspaceServerSettingsObject(), PSConnectionInfoSingleton.GetInstance().GetMonadConnectionInfo(ExchangeRunspaceConfigurationSettings.SerializationLevel.Full))) { monadConnection.Open(); monadCommand.Connection = monadConnection; using (MonadDataAdapter monadDataAdapter = new MonadDataAdapter(monadCommand)) { DataTable dataTable3 = (DataTable)e.Result; if (dataTable3.Columns.Count != 0) { monadDataAdapter.MissingSchemaAction = MissingSchemaAction.Ignore; monadDataAdapter.EnforceDataSetSchema = true; } ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader, MonadCommand>((long)this.GetHashCode(), "-->DataTableLoader.Fill: calling dataAdapter.Fill: {0}. Command:{1}", this, monadCommand); monadDataAdapter.Fill(dataTable3); ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader, MonadCommand>((long)this.GetHashCode(), "<--DataTableLoader.Fill: calling dataAdaptr.Fill: {0}. Command:{1}", this, monadCommand); } } this.DetachCommandFromMonitorWarnings(monadCommand); } IL_26F: this.OnFillTable(e); ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader>((long)this.GetHashCode(), "<--DataTableLoader.Fill: {0}", this); }