Exemplo n.º 1
0
        public ControllerFactoryProvider(
            IControllerActivatorProvider activatorProvider,
            IControllerFactory controllerFactory,
#pragma warning disable PUB0001 // Pubternal type in public API
            IEnumerable <IControllerPropertyActivator> propertyActivators
#pragma warning restore PUB0001
            )
        {
            if (activatorProvider == null)
            {
                throw new ArgumentNullException(nameof(activatorProvider));
            }

            if (controllerFactory == null)
            {
                throw new ArgumentNullException(nameof(controllerFactory));
            }

            _activatorProvider = activatorProvider;

            // Compat: Delegate to the IControllerFactory if it's not the default implementation.
            if (controllerFactory.GetType() != typeof(DefaultControllerFactory))
            {
                _factoryCreateController  = controllerFactory.CreateController;
                _factoryReleaseController = controllerFactory.ReleaseController;
            }

            _propertyActivators = propertyActivators.ToArray();
        }
        public ControllerFactoryProvider(
            IControllerActivatorProvider activatorProvider,
            IControllerFactory controllerFactory,
            IEnumerable <IControllerPropertyActivator> propertyActivators)
        {
            if (activatorProvider == null)
            {
                throw new ArgumentNullException(nameof(activatorProvider));
            }

            if (controllerFactory == null)
            {
                throw new ArgumentNullException(nameof(controllerFactory));
            }

            _activatorProvider = activatorProvider;

            // Compat: Delegate to the IControllerFactory if it's not the default implementation.
            if (controllerFactory.GetType() != typeof(DefaultControllerFactory))
            {
                _factoryCreateController       = controllerFactory.CreateController;
                _factoryReleaseController      = controllerFactory.ReleaseController;
                _factoryReleaseControllerAsync = controllerFactory.ReleaseControllerAsync;
            }

            _propertyActivators = propertyActivators.ToArray();
        }