Exemple #1
0
        /// <summary>
        /// </summary>
        /// <param name="container"></param>
        /// <param name="scopeOption"></param>
        public SimpleInjectorDependencyResolver(Container container,
                                                DependencyResolverScopeOption scopeOption)
            : this(container, beginScope : false)
        {
            if (scopeOption < DependencyResolverScopeOption.UseAmbientScope ||
                scopeOption > DependencyResolverScopeOption.RequiresNew)
            {
                throw new System.ComponentModel.InvalidEnumArgumentException(nameof(scopeOption), (int)scopeOption,
                                                                             typeof(DependencyResolverScopeOption));
            }

            _scopeOption = scopeOption;
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleInjectorWebApiDependencyResolver"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="scopeOption">The scoping option.</param>
        /// <exception cref="ArgumentNullException">Thrown when the <paramref name="container"/> parameter is
        /// a null reference (Nothing in VB).</exception>
        /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when the
        /// <paramref name="scopeOption"/> contains an invalid value.</exception>
        public SimpleInjectorWebApiDependencyResolver(Container container,
                                                      DependencyResolverScopeOption scopeOption)
            : this(container, beginScope : false)
        {
            Requires.IsNotNull(container, "container");

            if (scopeOption < DependencyResolverScopeOption.UseAmbientScope ||
                scopeOption > DependencyResolverScopeOption.RequiresNew)
            {
                throw new System.ComponentModel.InvalidEnumArgumentException("scopeOption", (int)scopeOption,
                                                                             typeof(DependencyResolverScopeOption));
            }

            this.scopeOption = scopeOption;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleInjectorWebApiDependencyResolver"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="scopeOption">The scoping option.</param>
        /// <exception cref="ArgumentNullException">Thrown when the <paramref name="container"/> parameter is
        /// a null reference (Nothing in VB).</exception>
        /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when the 
        /// <paramref name="scopeOption"/> contains an invalid value.</exception>
        public SimpleInjectorWebApiDependencyResolver(Container container,
            DependencyResolverScopeOption scopeOption)
            : this(container, beginScope: false)
        {
            Requires.IsNotNull(container, nameof(container));

            if (scopeOption < DependencyResolverScopeOption.UseAmbientScope ||
                scopeOption > DependencyResolverScopeOption.RequiresNew)
            {
                throw new System.ComponentModel.InvalidEnumArgumentException("scopeOption", (int)scopeOption,
                    typeof(DependencyResolverScopeOption));
            }

            this.scopeOption = scopeOption;
        }