/
githubmirror
/
PowerShell
Обзор
Документация
Войти
/
githubmirror
/
PowerShell
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/InstanceMethodInvocationJob.cs
64 строки
2 KB
xtqqczze
Seal internal types in `Microsoft.PowerShell.Commands.Management` (#25849)
22 авг 2025, 08:01
Не верифицирован
22 авг 2025, 08:01
781c9a5
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using Microsoft.Management.Infrastructure; using Microsoft.Management.Infrastructure.Options; using Dbg = System.Management.Automation.Diagnostics; namespace Microsoft.PowerShell.Cmdletization.Cim { /// <summary> /// Job wrapping invocation of an extrinsic CIM method. /// </summary> internal sealed class InstanceMethodInvocationJob : ExtrinsicMethodInvocationJob { private readonly CimInstance _targetInstance; internal InstanceMethodInvocationJob(CimJobContext jobContext, bool passThru, CimInstance targetInstance, MethodInvocationInfo methodInvocationInfo) : base( jobContext, passThru, targetInstance.ToString(), methodInvocationInfo) { Dbg.Assert(targetInstance != null, "Caller should verify targetInstance != null"); _targetInstance = targetInstance; } internal override IObservable<CimMethodResultBase> GetCimOperation() { if (!this.ShouldProcess()) { return null; } CimMethodParametersCollection methodParameters = this.GetCimMethodParametersCollection(); CimOperationOptions operationOptions = this.CreateOperationOptions(); operationOptions.EnableMethodResultStreaming = true; IObservable<CimMethodResultBase> observable = this.JobContext.Session.InvokeMethodAsync( this.JobContext.Namespace, _targetInstance, this.MethodName, methodParameters, operationOptions); return observable; } internal override object PassThruObject { get { return _targetInstance; } } internal override CimCustomOptionsDictionary CalculateJobSpecificCustomOptions() { return CimCustomOptionsDictionary.MergeOptions( base.CalculateJobSpecificCustomOptions(), _targetInstance); } } }