예제 #1
0
        internal void RemoveCimInstance(CimInstance cimInstance, XOperationContextBase context, CmdletOperationBase cmdlet)
        {
            DebugHelper.WriteLogEx();
            string str = cimInstance.ToString();

            if (cmdlet.ShouldProcess(str, "Remove-CimInstance"))
            {
                CimRemoveCimInstanceContext cimRemoveCimInstanceContext = context as CimRemoveCimInstanceContext;
                CimSessionProxy             cimSessionProxy             = base.CreateCimSessionProxy(cimRemoveCimInstanceContext.Proxy);
                cimSessionProxy.DeleteInstanceAsync(cimRemoveCimInstanceContext.Namespace, cimInstance);
                return;
            }
            else
            {
                return;
            }
        }
        /// <summary>
        /// <para>
        /// Remove <see cref="CimInstance"/> from namespace specified in cmdlet
        /// </para>
        /// </summary>
        /// <param name="cimInstance"></param>
        internal void RemoveCimInstance(CimInstance cimInstance, XOperationContextBase context, CmdletOperationBase cmdlet)
        {
            DebugHelper.WriteLogEx();

            string target = cimInstance.ToString();

            if (!cmdlet.ShouldProcess(target, action))
            {
                return;
            }

            CimRemoveCimInstanceContext removeContext = context as CimRemoveCimInstanceContext;

            Debug.Assert(removeContext != null, "CimRemoveCimInstance::RemoveCimInstance should has CimRemoveCimInstanceContext != NULL.");

            CimSessionProxy proxy = CreateCimSessionProxy(removeContext.Proxy);

            proxy.DeleteInstanceAsync(removeContext.Namespace, cimInstance);
        }