Exemple #1
0
 private void EndExecute(AbstractDataTableFiller filler, ResultsLoaderProfile profile)
 {
     MonadAdapterFiller monadAdapterFiller = filler as MonadAdapterFiller;
     if (monadAdapterFiller != null)
     {
         this.DetachCommandFromMonitorWarnings(monadAdapterFiller.Command);
     }
 }
Exemple #2
0
 private void BeginExecute(AbstractDataTableFiller filler, ResultsLoaderProfile profile)
 {
     MonadAdapterFiller monadAdapterFiller = filler as MonadAdapterFiller;
     if (monadAdapterFiller != null)
     {
         this.AttachCommandToMonitorWarnings(monadAdapterFiller.Command);
         monadAdapterFiller.Command.PreservedObjectProperty = profile.WholeObjectProperty;
     }
 }
Exemple #3
0
 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);
     }
 }
Exemple #4
0
        public override object Clone()
        {
            MonadAdapterFiller monadAdapterFiller = new MonadAdapterFiller(this.commandText, this.commandBuilder)
            {
                ResolveCommandText  = this.resolveCommandText,
                IsResolving         = this.isResolving,
                Parameters          = this.parameters,
                AddtionalParameters = this.additionalParameters
            };

            foreach (string key in this.FixedValues.Keys)
            {
                monadAdapterFiller.FixedValues[key] = this.FixedValues[key];
            }
            return(monadAdapterFiller);
        }
 private void AddFillerCollection(ResultsLoaderProfile objectPickerProfile, IEnumerable <XElement> dataTableFillers)
 {
     foreach (XElement xelement in dataTableFillers)
     {
         if ("MonadAdapterFiller" == xelement.Name || xelement.Name == "DAGNetworkDataFiller" || xelement.Name == "SupervisionListFiller" || xelement.Name == "DatabaseStatusFiller" || xelement.Name == "SecurityIdentifierResolveFiller")
         {
             IExchangeScopeBuilder exchangeScopeBuilder = null;
             if (this.HasValue(xelement.Attribute("ScopeBuilder")))
             {
                 string name = (string)xelement.Attribute("ScopeBuilder");
                 exchangeScopeBuilder = (IExchangeScopeBuilder)ObjectSchemaLoader.GetTypeByString(name).GetConstructor(new Type[0]).Invoke(new object[0]);
             }
             IExchangeCommandFilterBuilder filterBuilder = null;
             if (this.HasValue(xelement.Attribute("FilterBuilder")))
             {
                 string name2 = (string)xelement.Attribute("FilterBuilder");
                 filterBuilder = (IExchangeCommandFilterBuilder)ObjectSchemaLoader.GetTypeByString(name2).GetConstructor(new Type[0]).Invoke(new object[0]);
             }
             string resolveCommandText = null;
             if (this.HasValue(xelement.Attribute("ResolveCommand")))
             {
                 resolveCommandText = (string)xelement.Attribute("ResolveCommand");
             }
             ExchangeCommandBuilder exchangeCommandBuilder = new ExchangeCommandBuilder(filterBuilder);
             if (exchangeScopeBuilder != null)
             {
                 exchangeCommandBuilder.ScopeBuilder = exchangeScopeBuilder;
             }
             if (this.HasValue(xelement.Attribute("SearchType")))
             {
                 exchangeCommandBuilder.SearchType = (ExchangeCommandBuilderSearch)Enum.Parse(typeof(ExchangeCommandBuilderSearch), (string)xelement.Attribute("SearchType"));
             }
             if (this.HasValue(xelement.Attribute("UseFilterToResolveNonId")))
             {
                 exchangeCommandBuilder.UseFilterToResolveNonId = bool.Parse((string)xelement.Attribute("UseFilterToResolveNonId"));
             }
             exchangeCommandBuilder.NamePropertyFilter = objectPickerProfile.NameProperty;
             if ("MonadAdapterFiller" == xelement.Name)
             {
                 MonadAdapterFiller monadAdapterFiller = new MonadAdapterFiller((string)xelement.Attribute("Command"), exchangeCommandBuilder)
                 {
                     ResolveCommandText = resolveCommandText
                 };
                 IEnumerable <XElement> enumerable = xelement.Elements("Column");
                 foreach (XElement xelement2 in enumerable)
                 {
                     string value  = xelement2.Attribute("Name").Value;
                     string value2 = xelement2.Attribute("Value").Value;
                     ICustomTextConverter customTextConverter = objectPickerProfile.DataTable.Columns[value].ExtendedProperties.ContainsKey("TextConverter") ? ((ICustomTextConverter)objectPickerProfile.DataTable.Columns[value].ExtendedProperties["TextConverter"]) : new TextConverter();
                     monadAdapterFiller.FixedValues[value] = customTextConverter.Parse(objectPickerProfile.DataTable.Columns[value].DataType, value2, null);
                 }
                 if (xelement.Element("Parameters") != null)
                 {
                     IEnumerable <XElement> enumerable2 = xelement.Element("Parameters").Elements("Parameter");
                     foreach (XElement xelement3 in enumerable2)
                     {
                         monadAdapterFiller.Parameters[xelement3.Attribute("Name").Value] = xelement3.Attribute("Value").Value;
                     }
                     IEnumerable <XElement> enumerable3 = xelement.Element("Parameters").Elements("AdditionalParameter");
                     foreach (XElement xelement4 in enumerable3)
                     {
                         monadAdapterFiller.AddtionalParameters.Add(xelement4.Attribute("Name").Value);
                     }
                 }
                 string runnableLambdaExpression = string.Empty;
                 if (this.HasValue(xelement.Attribute("RunnableLambdaExpression")))
                 {
                     runnableLambdaExpression = (string)xelement.Attribute("RunnableLambdaExpression");
                 }
                 objectPickerProfile.AddTableFiller(monadAdapterFiller, runnableLambdaExpression);
             }
             else if ("SupervisionListFiller" == xelement.Name)
             {
                 objectPickerProfile.AddTableFiller(new SupervisionListFiller((string)xelement.Attribute("Command")));
             }
             else if ("DatabaseStatusFiller" == xelement.Name)
             {
                 string runnableLambdaExpression2 = string.Empty;
                 if (this.HasValue(xelement.Attribute("RunnableLambdaExpression")))
                 {
                     runnableLambdaExpression2 = (string)xelement.Attribute("RunnableLambdaExpression");
                 }
                 objectPickerProfile.AddTableFiller(new DatabaseStatusFiller((string)xelement.Attribute("Command"), exchangeCommandBuilder)
                 {
                     ResolveCommandText = resolveCommandText
                 }, runnableLambdaExpression2);
             }
             else if ("DAGNetworkDataFiller" == xelement.Name)
             {
                 objectPickerProfile.AddTableFiller(new DAGNetworkDataFiller((string)xelement.Attribute("Command"), exchangeCommandBuilder)
                 {
                     ResolveCommandText = resolveCommandText
                 });
             }
             else
             {
                 string sidColumn  = (string)xelement.Attribute("SidColumn");
                 string userColumn = (string)xelement.Attribute("UserColumn");
                 objectPickerProfile.AddTableFiller(new SecurityIdentifierResolveFiller(sidColumn, userColumn));
             }
         }
         else if ("FixedDataFiller" == xelement.Name)
         {
             FixedDataFiller fixedDataFiller = new FixedDataFiller();
             fixedDataFiller.DataTable = objectPickerProfile.DataTable.Clone();
             IEnumerable <XElement> enumerable4 = xelement.Elements("Row");
             foreach (XElement xelement5 in enumerable4)
             {
                 DataRow dataRow = fixedDataFiller.DataTable.NewRow();
                 IEnumerable <XElement> enumerable5 = xelement5.Elements("Column");
                 foreach (XElement xelement6 in enumerable5)
                 {
                     string value3 = xelement6.Attribute("Name").Value;
                     string value4 = xelement6.Attribute("Value").Value;
                     ICustomTextConverter customTextConverter2 = fixedDataFiller.DataTable.Columns[value3].ExtendedProperties.ContainsKey("TextConverter") ? ((ICustomTextConverter)fixedDataFiller.DataTable.Columns[value3].ExtendedProperties["TextConverter"]) : new TextConverter();
                     dataRow[value3] = customTextConverter2.Parse(fixedDataFiller.DataTable.Columns[value3].DataType, value4, null);
                 }
                 fixedDataFiller.DataTable.Rows.Add(dataRow);
             }
             objectPickerProfile.AddTableFiller(fixedDataFiller);
         }
     }
 }