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)); } }
/// <summary> /// Creates a scope with a CimSession connecting to the local machine /// </summary> public SimCimScope(IInfrastructureObjectMapper mapper) : this(CimSession.Create(null), mapper) { }
/// <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; }