public static IEnumerable <T> CreateMany <T>(this IInfrastructureObjectMapper mapper, IInfrastructureObjectScope scope, IEnumerable <CimInstance> cimInstances) where T : class, IInfrastructureObject
        {
            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }
            if (cimInstances == null)
            {
                yield break;
            }

            foreach (var i in cimInstances)
            {
                yield return((T)mapper.Create(scope, i));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a scope with a CimSession connecting to the local machine
 /// </summary>
 public SimCimScope(IInfrastructureObjectMapper mapper) : this(CimSession.Create(null), mapper)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a scope from an existing session
 /// </summary>
 /// <param name="session"></param>
 /// <param name="ownsSession"></param>
 public SimCimScope(CimSession session, IInfrastructureObjectMapper mapper, bool ownsSession = true)
 {
     Mapper       = mapper;
     CimSession   = session;
     _ownsSession = ownsSession;
 }