private IEnumerable <TSession> GetSessionsToActAgainst(MethodInvocationInfo methodInvocationInfo)
        {
            if (_sessionWasSpecified)
            {
                return(this.Session);
            }

            var associatedSessions = new HashSet <TSession>();

            foreach (TObjectInstance objectInstance in methodInvocationInfo.GetArgumentsOfType <TObjectInstance>())
            {
                TSession associatedSession = this.GetSessionOfOriginFromInstance(objectInstance);
                if (associatedSession != null)
                {
                    associatedSessions.Add(associatedSession);
                }
            }

            if (associatedSessions.Count == 1)
            {
                return(associatedSessions);
            }

            TSession sessionAssociatedWithPipelineObject = this.GetSessionAssociatedWithPipelineObject();

            if (sessionAssociatedWithPipelineObject != null)
            {
                return(new[] { sessionAssociatedWithPipelineObject });
            }

            return(new[] { this.GetImpliedSession() });
        }
Ejemplo n.º 2
0
 internal IEnumerable <CimInstance> GetCimInstancesFromArguments()
 {
     return(_methodInvocationInfo.GetArgumentsOfType <CimInstance>());
 }