/// <summary> /// Initializes a new instance of the <see cref="ManyObjectsResolverBase{TResolver, TResolved}"/> class with an empty list of objects, /// and an optional lifetime scope. /// </summary> /// <param name="serviceProvider"></param> /// <param name="logger"></param> /// <param name="scope">The lifetime scope of instantiated objects, default is per Application.</param> /// <remarks>If <paramref name="scope"/> is per HttpRequest then there must be a current HttpContext.</remarks> /// <exception cref="InvalidOperationException"><paramref name="scope"/> is per HttpRequest but the current HttpContext is null.</exception> protected ManyObjectsResolverBase(IServiceProvider serviceProvider, ILogger logger, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } if (logger == null) { throw new ArgumentNullException("logger"); } CanResolveBeforeFrozen = false; if (scope == ObjectLifetimeScope.HttpRequest) { _httpContextGetter = () => new HttpContextWrapper(HttpContext.Current); } ServiceProvider = serviceProvider; Logger = logger; LifetimeScope = scope; if (scope == ObjectLifetimeScope.HttpRequest) { _httpContextKey = GetType().FullName; } _instanceTypes = new List <Type>(); InitializeAppInstances(); }
/// <summary> /// Initializes a new instance of the <see cref="ManyObjectsResolverBase{TResolver, TResolved}"/> class with an empty list of objects, /// and an optional lifetime scope. /// </summary> /// <param name="serviceProvider"></param> /// <param name="logger"></param> /// <param name="scope">The lifetime scope of instantiated objects, default is per Application.</param> /// <remarks>If <paramref name="scope"/> is per HttpRequest then there must be a current HttpContext.</remarks> /// <exception cref="InvalidOperationException"><paramref name="scope"/> is per HttpRequest but the current HttpContext is null.</exception> protected ManyObjectsResolverBase(IServiceProvider serviceProvider, ILogger logger, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } if (logger == null) { throw new ArgumentNullException("logger"); } CanResolveBeforeFrozen = false; if (scope == ObjectLifetimeScope.HttpRequest) { if (HttpContext.Current == null) { throw new InvalidOperationException("Use alternative constructor accepting a HttpContextBase object in order to set the lifetime scope to HttpRequest when HttpContext.Current is null"); } CurrentHttpContext = new HttpContextWrapper(HttpContext.Current); } ServiceProvider = serviceProvider; Logger = logger; LifetimeScope = scope; if (scope == ObjectLifetimeScope.HttpRequest) { _httpContextKey = GetType().FullName; } _instanceTypes = new List <Type>(); InitializeAppInstances(); }
/// <summary> /// Initializes a new instance of the <see cref="ManyObjectsResolverBase{TResolver, TResolved}"/> class with an empty list of objects. /// </summary> /// <param name="scope">The lifetime scope of instantiated objects, default is per Application</param> protected ManyObjectsResolverBase(ObjectLifetimeScope scope = ObjectLifetimeScope.Application) { CanResolveBeforeFrozen = false; if (scope == ObjectLifetimeScope.HttpRequest) { if (HttpContext.Current == null) { throw new InvalidOperationException("Use alternative constructor accepting a HttpContextBase object in order to set the lifetime scope to HttpRequest when HttpContext.Current is null"); } CurrentHttpContext = new HttpContextWrapper(HttpContext.Current); } LifetimeScope = scope; InstanceTypes = new List <Type>(); }
/// <summary> /// Initializes a new instance of the <see cref="ManyObjectsResolverBase{TResolver, TResolved}"/> class with an initial list of objects. /// </summary> /// <param name="value">The list of objects.</param> /// <param name="scope">If set to true will resolve singleton objects which will be created once for the lifetime of the application</param> protected ManyObjectsResolverBase(IEnumerable <Type> value, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(scope) { InstanceTypes = new List <Type>(value); }
/// <summary> /// Initializes a new instance of the <see cref="LazyManyObjectsResolverBase{TResolver, TResolved}"/> class with an initial list /// of functions producing types, and an optional lifetime scope. /// </summary> /// <param name="typeListProducerList">The list of functions producing types.</param> /// <param name="scope">The lifetime scope of instantiated objects, default is per Application.</param> /// <remarks>If <paramref name="scope"/> is per HttpRequest then there must be a current HttpContext.</remarks> /// <exception cref="InvalidOperationException"><paramref name="scope"/> is per HttpRequest but the current HttpContext is null.</exception> protected LazyManyObjectsResolverBase(Func <IEnumerable <Type> > typeListProducerList, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(scope) { _typeListProducerList.Add(typeListProducerList); }
/// <summary> /// Initializes a new instance of the <see cref="LazyManyObjectsResolverBase{TResolver, TResolved}"/> class with an empty list of objects, /// with creation of objects based on an HttpRequest lifetime scope. /// </summary> /// <param name="scope">The lifetime scope of instantiated objects, default is per Application.</param> /// <remarks>If <paramref name="scope"/> is per HttpRequest then there must be a current HttpContext.</remarks> /// <exception cref="InvalidOperationException"><paramref name="scope"/> is per HttpRequest but the current HttpContext is null.</exception> protected LazyManyObjectsResolverBase(ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : base(scope) { }
/// <summary> /// Initializes a new instance of the <see cref="LazyManyObjectsResolverBase{TResolver, TResolved}"/> class with an initial list /// <remarks>If <paramref name="scope"/> is per HttpRequest then there must be a current HttpContext.</remarks> /// <exception cref="InvalidOperationException"><paramref name="scope"/> is per HttpRequest but the current HttpContext is null.</exception> protected LazyManyObjectsResolverBase(IEnumerable <Lazy <Type> > lazyTypeList, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(scope) { AddTypes(lazyTypeList); }
public ManyResolver(IEnumerable <Type> value, ObjectLifetimeScope scope) : base(value, scope) { }
/// <summary> /// Constructor accepting a delegate to return a list of types /// </summary> /// <param name="typeListDelegate"></param> /// <param name="scope"></param> protected LazyManyObjectsResolverBase(Func <IEnumerable <Type> > typeListDelegate, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(scope) { _listOfTypeListDelegates.Add(typeListDelegate); }
/// <summary> /// Initializes a new instance of the <see cref="ManyObjectsResolverBase{TResolver, TResolved}"/> class with an initial list of object types, /// and an optional lifetime scope. /// </summary> /// <param name="value">The list of object types.</param> /// <param name="scope">The lifetime scope of instantiated objects, default is per Application.</param> /// <remarks>If <paramref name="scope"/> is per HttpRequest then there must be a current HttpContext.</remarks> /// <exception cref="InvalidOperationException"><paramref name="scope"/> is per HttpRequest but the current HttpContext is null.</exception> protected ManyObjectsResolverBase(IEnumerable <Type> value, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(scope) { _instanceTypes = value.ToList(); }
public ManyResolver(IServiceProvider serviceProvider, ILogger logger, IEnumerable <Type> value, ObjectLifetimeScope scope) : base(serviceProvider, logger, value, scope) { }
/// <summary> /// Initializes a new instance of the <see cref="ManyObjectsResolverBase{TResolver, TResolved}"/> class with an initial list of object types, /// and an optional lifetime scope. /// </summary> /// <param name="serviceProvider"></param> /// <param name="logger"></param> /// <param name="value">The list of object types.</param> /// <param name="scope">The lifetime scope of instantiated objects, default is per Application.</param> /// <remarks>If <paramref name="scope"/> is per HttpRequest then there must be a current HttpContext.</remarks> /// <exception cref="InvalidOperationException"><paramref name="scope"/> is per HttpRequest but the current HttpContext is null.</exception> protected ManyObjectsResolverBase(IServiceProvider serviceProvider, ILogger logger, IEnumerable <Type> value, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(serviceProvider, logger, scope) { _instanceTypes = value.ToList(); }
protected ManyObjectsResolverBase(IEnumerable <Type> value, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(new ActivatorServiceProvider(), LoggerResolver.Current.Logger, value, scope) { }
protected LazyManyObjectsResolverBase(Func <IEnumerable <Type> > typeListProducerList, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(new ActivatorServiceProvider(), LoggerResolver.Current.Logger, typeListProducerList, scope) { }
protected LazyManyObjectsResolverBase(IServiceProvider serviceProvider, ILogger logger, Func <IEnumerable <Type> > typeListProducerList, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(serviceProvider, logger, scope) { _typeListProducerList.Add(typeListProducerList); }
protected LazyManyObjectsResolverBase(IServiceProvider serviceProvider, ILogger logger, IEnumerable <Lazy <Type> > lazyTypeList, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(serviceProvider, logger, scope) { AddTypes(lazyTypeList); }
/// <summary> /// Initializes a new instance of the <see cref="ManyObjectsResolverBase{TResolver, TResolved}"/> class with an empty list of objects, /// and an optional lifetime scope. /// </summary> /// <param name="serviceProvider"></param> /// <param name="logger"></param> /// <param name="scope">The lifetime scope of instantiated objects, default is per Application.</param> /// <remarks>If <paramref name="scope"/> is per HttpRequest then there must be a current HttpContext.</remarks> /// <exception cref="InvalidOperationException"><paramref name="scope"/> is per HttpRequest but the current HttpContext is null.</exception> protected LazyManyObjectsResolverBase(IServiceProvider serviceProvider, ILogger logger, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : base(serviceProvider, logger, scope) { Initialize(); }
/// <summary> /// Initializes a new instance of the <see cref="ManyObjectsResolverBase{TResolver, TResolved}"/> class with an initial list of object types, /// and an optional lifetime scope. /// </summary> /// <param name="serviceProvider"></param> /// <param name="logger"></param> /// <param name="value">The list of object types.</param> /// <param name="scope">The lifetime scope of instantiated objects, default is per Application.</param> /// <remarks>If <paramref name="scope"/> is per HttpRequest then there must be a current HttpContext.</remarks> /// <exception cref="InvalidOperationException"><paramref name="scope"/> is per HttpRequest but the current HttpContext is null.</exception> protected LazyManyObjectsResolverBase(IServiceProvider serviceProvider, ILogger logger, IEnumerable <Type> value, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : base(serviceProvider, logger, value, scope) { }
internal GraphQLValueResolversResolver(IServiceProvider serviceProvider, ILogger logger, IEnumerable <Type> value, ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : base( serviceProvider, logger, value, scope) { }
protected ManyObjectsResolverBase(ObjectLifetimeScope scope = ObjectLifetimeScope.Application) : this(new ActivatorServiceProvider(), LoggerResolver.Current.Logger, scope) { }