Example #1
0
        /// <summary>
        /// Initializes a new instance of <see cref="CompositeViewEngine"/>.
        /// </summary>
        /// <param name="optionsAccessor">The options accessor for <see cref="MvcOptions"/>.</param>
        /// <param name="typeActivatorCache">As <see cref="ITypeActivatorCache"/> instance that creates
        /// an instance of type <see cref="IViewEngine"/>.</param>
        /// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
        /// service collection.</param>
        public CompositeViewEngine(
            IOptions <MvcOptions> optionsAccessor,
            ITypeActivatorCache typeActivatorCache,
            IServiceProvider serviceProvider)
        {
            var viewEngines = new List <IViewEngine>();

            foreach (var descriptor in optionsAccessor.Options.ViewEngines)
            {
                IViewEngine viewEngine;
                if (descriptor.ViewEngine != null)
                {
                    viewEngine = descriptor.ViewEngine;
                }
                else
                {
                    viewEngine = typeActivatorCache.CreateInstance <IViewEngine>(
                        serviceProvider,
                        descriptor.ViewEngineType);
                }

                viewEngines.Add(viewEngine);
            }

            ViewEngines = viewEngines;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultViewEngineProvider"/> class.
 /// </summary>
 /// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
 /// <param name="typeActivatorCache">As <see cref="ITypeActivatorCache"/> instance that creates
 /// an instance of type <see cref="IViewEngine"/>.</param>
 /// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
 /// service collection.</param>
 public DefaultViewEngineProvider(
     IOptions <MvcOptions> optionsAccessor,
     ITypeActivatorCache typeActivatorCache,
     IServiceProvider serviceProvider)
     : base(optionsAccessor.Options.ViewEngines, typeActivatorCache, serviceProvider)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultModelValidatorProviderProvider"/> class.
 /// </summary>
 /// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
 /// <param name="typeActivatorCache">As <see cref="ITypeActivatorCache"/> instance that creates an instance
 ///  of type <see cref="IModelValidatorProvider"/>.</param>
 /// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
 /// service collection.</param>
 public DefaultModelValidatorProviderProvider(
     IOptions <MvcOptions> optionsAccessor,
     ITypeActivatorCache typeActivatorCache,
     IServiceProvider serviceProvider)
     : base(optionsAccessor.Options.ModelValidatorProviders, typeActivatorCache, serviceProvider)
 {
 }
Example #4
0
 public DefaultViewComponentInvokerFactory(
     ITypeActivatorCache typeActivatorCache,
     IViewComponentActivator viewComponentActivator)
 {
     _typeActivatorCache     = typeActivatorCache;
     _viewComponentActivator = viewComponentActivator;
 }
Example #5
0
 public DefaultViewComponentInvoker(
     [NotNull] ITypeActivatorCache typeActivatorCache,
     [NotNull] IViewComponentActivator viewComponentActivator)
 {
     _typeActivatorCache     = typeActivatorCache;
     _viewComponentActivator = viewComponentActivator;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultValueProviderFactoryProvider"/> class.
 /// </summary>
 /// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
 /// <param name = "typeActivatorCache" > As <see cref="ITypeActivatorCache"/> instance that creates
 /// an instance of type <see cref="IValueProviderFactory"/>.</param>
 /// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
 /// service collection.</param>
 public DefaultValueProviderFactoryProvider(
     IOptions <MvcOptions> optionsAccessor,
     ITypeActivatorCache typeActivatorCache,
     IServiceProvider serviceProvider)
     : base(optionsAccessor.Options.ValueProviderFactories, typeActivatorCache, serviceProvider)
 {
 }
        /// <summary>
        /// Initializes a new instance of <see cref="DefaultViewComponentInvoker"/>.
        /// </summary>
        /// <param name="typeActivatorCache">Caches factories for instantiating view component instances.</param>
        /// <param name="viewComponentActivator">The <see cref="IViewComponentActivator"/>.</param>
        /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
        /// <param name="logger">The <see cref="ILogger"/>.</param>
        public DefaultViewComponentInvoker(
            ITypeActivatorCache typeActivatorCache,
            IViewComponentActivator viewComponentActivator,
            DiagnosticSource diagnosticSource,
            ILogger logger)
        {
            if (typeActivatorCache == null)
            {
                throw new ArgumentNullException(nameof(typeActivatorCache));
            }

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

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

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

            _typeActivatorCache     = typeActivatorCache;
            _viewComponentActivator = viewComponentActivator;
            _diagnosticSource       = diagnosticSource;
            _logger = logger;
        }
Example #8
0
        /// <summary>
        /// Initializes a new instance of <see cref="CompositeViewEngine"/>.
        /// </summary>
        /// <param name="optionsAccessor">The options accessor for <see cref="MvcOptions"/>.</param>
        /// <param name="typeActivatorCache">As <see cref="ITypeActivatorCache"/> instance that creates
        /// an instance of type <see cref="IViewEngine"/>.</param>
        /// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
        /// service collection.</param>
        public CompositeViewEngine(
            IOptions<MvcOptions> optionsAccessor,
            ITypeActivatorCache typeActivatorCache,
            IServiceProvider serviceProvider)
        {
            var viewEngines = new List<IViewEngine>();
            foreach (var descriptor in optionsAccessor.Options.ViewEngines)
            {
                IViewEngine viewEngine;
                if (descriptor.ViewEngine != null)
                {
                    viewEngine = descriptor.ViewEngine;
                }
                else
                {
                    viewEngine = typeActivatorCache.CreateInstance<IViewEngine>(
                        serviceProvider, 
                        descriptor.ViewEngineType);
                }

                viewEngines.Add(viewEngine);
            }

            ViewEngines = viewEngines;
        }
 public DefaultViewComponentInvoker(
     [NotNull] ITypeActivatorCache typeActivatorCache,
     [NotNull] IViewComponentActivator viewComponentActivator)
 {
     _typeActivatorCache = typeActivatorCache;
     _viewComponentActivator = viewComponentActivator;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultViewLocationExpanderProvider"/> class.
 /// </summary>
 /// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
 /// <param name="typeActivatorCache">A <see cref="ITypeActivatorCache"/> instance that creates a new instance
 /// of type <see cref="IViewLocationExpander"/>.</param>
 /// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
 /// service collection.</param>
 public DefaultViewLocationExpanderProvider(
     IOptions <RazorViewEngineOptions> optionsAccessor,
     ITypeActivatorCache typeActivatorCache,
     IServiceProvider serviceProvider)
     : base(optionsAccessor.Options.ViewLocationExpanders, typeActivatorCache, serviceProvider)
 {
 }
 public DefaultViewComponentInvokerFactory(
     ITypeActivatorCache typeActivatorCache,
     IViewComponentActivator viewComponentActivator)
 {
     _typeActivatorCache = typeActivatorCache;
     _viewComponentActivator = viewComponentActivator;
 }
        public _DefaultViewComponentInvoker(
            ITypeActivatorCache typeActivatorCache,
            IViewComponentActivator viewComponentActivator,
            DiagnosticSource diagnosticSource,
            ILogger logger)
        {
            if (typeActivatorCache == null)
            {
                throw new ArgumentNullException(nameof(typeActivatorCache));
            }

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

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

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

            _typeActivatorCache = typeActivatorCache;
            _viewComponentActivator = viewComponentActivator;
            _diagnosticSource = diagnosticSource;
            _logger = logger;
        }
Example #13
0
    /// <summary>
    /// Initializes a new instance of <see cref="DefaultViewComponentActivator"/> class.
    /// </summary>
    /// <param name="typeActivatorCache">
    /// The <see cref="ITypeActivatorCache"/> used to create new view component instances.
    /// </param>
    public DefaultViewComponentActivator(ITypeActivatorCache typeActivatorCache)
    {
        if (typeActivatorCache == null)
        {
            throw new ArgumentNullException(nameof(typeActivatorCache));
        }

        _typeActivatorCache = typeActivatorCache;
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="OptionDescriptorBasedProvider{TOption}"/> class.
 /// </summary>
 /// <param name="optionDescriptors">An enumerable of <see cref="OptionDescriptor{TOption}"/>.</param>
 /// <param name="typeActivatorCache">As <see cref="ITypeActivatorCache"/> instance that creates an
 /// instance of type <typeparamref name="TOption"/>.</param>
 /// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
 /// service collection.</param>
 public OptionDescriptorBasedProvider(
     [NotNull] IEnumerable <OptionDescriptor <TOption> > optionDescriptors,
     [NotNull] ITypeActivatorCache typeActivatorCache,
     [NotNull] IServiceProvider serviceProvider)
 {
     _optionDescriptors  = optionDescriptors;
     _typeActivatorCache = typeActivatorCache;
     _serviceProvider    = serviceProvider;
 }
 public DefaultViewComponentInvoker(
     [NotNull] IServiceProvider serviceProvider,
     [NotNull] ITypeActivatorCache typeActivatorCache,
     [NotNull] IViewComponentActivator viewComponentActivator)
 {
     _serviceProvider        = serviceProvider;
     _typeActivatorCache     = typeActivatorCache;
     _viewComponentActivator = viewComponentActivator;
 }
        /// <summary>
        /// Creates a new <see cref="DefaultControllerActivator"/>.
        /// </summary>
        /// <param name="typeActivatorCache">The <see cref="ITypeActivatorCache"/>.</param>
        public DefaultControllerActivator(ITypeActivatorCache typeActivatorCache)
        {
            if (typeActivatorCache == null)
            {
                throw new ArgumentNullException(nameof(typeActivatorCache));
            }

            _typeActivatorCache = typeActivatorCache;
        }
 public DefaultViewComponentInvokerFactory(
     IServiceProvider serviceProvider,
     ITypeActivatorCache typeActivatorCache,
     IViewComponentActivator viewComponentActivator)
 {
     _serviceProvider        = serviceProvider;
     _typeActivatorCache     = typeActivatorCache;
     _viewComponentActivator = viewComponentActivator;
 }
 public DefaultViewComponentInvokerFactory(
     IServiceProvider serviceProvider,
     ITypeActivatorCache typeActivatorCache,
     IViewComponentActivator viewComponentActivator)
 {
     _serviceProvider = serviceProvider;
     _typeActivatorCache = typeActivatorCache;
     _viewComponentActivator = viewComponentActivator;
 }
        /// <summary>
        /// Initializes a new instance of <see cref="DefaultViewComponentActivator"/> class.
        /// </summary>
        /// <param name="typeActivatorCache">
        /// The <see cref="ITypeActivatorCache"/> used to create new view component instances.
        /// </param>
        public DefaultViewComponentActivator(ITypeActivatorCache typeActivatorCache)
        {
            if (typeActivatorCache == null)
            {
                throw new ArgumentNullException(nameof(typeActivatorCache));
            }

            _typeActivatorCache = typeActivatorCache;
        }
 public DefaultViewComponentInvoker(
     [NotNull] IServiceProvider serviceProvider,
     [NotNull] ITypeActivatorCache typeActivatorCache,
     [NotNull] IViewComponentActivator viewComponentActivator)
 {
     _serviceProvider = serviceProvider;
     _typeActivatorCache = typeActivatorCache;
     _viewComponentActivator = viewComponentActivator;
 }
        /// <summary>
        /// Creates a new <see cref="DefaultControllerActivator"/>.
        /// </summary>
        /// <param name="typeActivatorCache">The <see cref="ITypeActivatorCache"/>.</param>
#pragma warning disable PUB0001 // Pubternal type in public API
        public DefaultControllerActivator(ITypeActivatorCache typeActivatorCache)
#pragma warning restore PUB0001
        {
            if (typeActivatorCache == null)
            {
                throw new ArgumentNullException(nameof(typeActivatorCache));
            }

            _typeActivatorCache = typeActivatorCache;
        }
Example #22
0
        public DefaultViewComponentInvokerFactory(
            ITypeActivatorCache typeActivatorCache,
            IViewComponentActivator viewComponentActivator,
            DiagnosticSource diagnosticSource,
            ILoggerFactory loggerFactory)
        {
            _typeActivatorCache     = typeActivatorCache;
            _viewComponentActivator = viewComponentActivator;
            _diagnosticSource       = diagnosticSource;

            _logger = loggerFactory.CreateLogger <DefaultViewComponentInvoker>();
        }
Example #23
0
        public ViewComponentInvokerFactory(
            ITypeActivatorCache typeActivatorCache,
            IViewComponentActivator viewComponentActivator,
            DiagnosticSource diagnosticSource,
            ILoggerFactory loggerFactory)
        {
            _typeActivatorCache = typeActivatorCache;
            _viewComponentActivator = viewComponentActivator;
            _diagnosticSource = diagnosticSource;

            _logger = loggerFactory.CreateLogger<DefaultViewComponentInvoker>();
        }
Example #24
0
        public DefaultViewComponentInvoker(
            ITypeActivatorCache typeActivatorCache,
            IViewComponentActivator viewComponentActivator)
        {
            if (typeActivatorCache == null)
            {
                throw new ArgumentNullException(nameof(typeActivatorCache));
            }

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

            _typeActivatorCache     = typeActivatorCache;
            _viewComponentActivator = viewComponentActivator;
        }
        /// <summary>
        /// Initialises a new instance of <see cref="DefaultWidgetInvoker"/>.
        /// </summary>
        /// <param name="typeActivatorCache">The type activator cache.</param>
        /// <param name="widgetActivator">The widget activator.</param>
        /// <param name="argumentBinder">The widget argument binder.</param>
        public DefaultWidgetInvoker(ITypeActivatorCache typeActivatorCache, IWidgetActivator widgetActivator, IWidgetArgumentBinder argumentBinder)
        {
            if (typeActivatorCache == null)
            {
                throw new ArgumentNullException(nameof(typeActivatorCache));
            }

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

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

            _typeActivatorCache = typeActivatorCache;
            _widgetActivator = widgetActivator;
            _argumentBinder = argumentBinder;
        }
        /// <summary>
        /// Initialises a new instance of <see cref="DefaultWidgetInvokerFactory"/>.
        /// </summary>
        /// <param name="typeActivatorCache">The type activator cache.</param>
        /// <param name="widgetActivator">The widget activator.</param>
        /// <param name="argumentBinder">The widget argument binder.</param>
        public DefaultWidgetInvokerFactory(ITypeActivatorCache typeActivatorCache, IWidgetActivator widgetActivator, IWidgetArgumentBinder argumentBinder)
        {
            if (typeActivatorCache == null)
            {
                throw new ArgumentNullException(nameof(typeActivatorCache));
            }

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

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

            _typeActivatorCache = typeActivatorCache;
            _widgetActivator    = widgetActivator;
            _argumentBinder     = argumentBinder;
        }
        public ActionInvoker(
            ITypeActivatorCache typeActivatorCache,
            ObjectMethodExecutorCache cache,
            IEnumerable <IControllerPropertyActivator> propertyActivators)
        {
            _typeActivatorCache = typeActivatorCache ?? throw new ArgumentNullException(nameof(typeActivatorCache));
            _propertyActivators = propertyActivators.ToArray();
            _cache = cache;


            var assemblies = DefaultAssemblyPartDiscoveryProvider.DiscoverAssemblyParts(Globals.ApplicationEntryPoint);

            _allControllers = new List <TypeInfo>();
            foreach (var assembly in assemblies)
            {
                var controllerTypes = assembly.DefinedTypes.Where(t => IsController(t)).ToList();

                if (controllerTypes != null && controllerTypes.Count > 0)
                {
                    _allControllers.AddRange(controllerTypes);
                }
            }
        }
 /// <inheritdoc />
 public DynamicontrollerActivator(ITypeActivatorCache typeActivatorCache)
     : base(typeActivatorCache)
 {
 }
 /// <summary>
 /// Creates a new <see cref="T:Microsoft.AspNet.Mvc.Controllers.DefaultControllerActivator"/>.
 /// </summary>
 /// <param name="typeActivatorCache">The <see cref="T:Microsoft.AspNet.Mvc.Infrastructure.ITypeActivatorCache"/>.</param>
 public UmbracoControllerActivator(ITypeActivatorCache typeActivatorCache)
     : base(typeActivatorCache)
 {
 }
Example #30
0
 public AnalyzerHttpControllerActivator(ITypeActivatorCache typeActivatorCache)
 {
     _typeActivatorCache = typeActivatorCache;
 }
 /// <summary>
 /// Initializes a new instance of the DefaultInputFormattersProvider class.
 /// </summary>
 /// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
 /// <param name="typeActivatorCache">As <see cref="ITypeActivatorCache"/> instance that creates an instance
 ///  of type <see cref="IInputFormatter"/>.</param>
 /// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
 /// service collection.</param>
 public DefaultInputFormattersProvider(IOptions <MvcOptions> optionsAccessor,
                                       ITypeActivatorCache typeActivatorCache,
                                       IServiceProvider serviceProvider)
     : base(optionsAccessor.Options.InputFormatters, typeActivatorCache, serviceProvider)
 {
 }
 public GenericControllerActivator(ITypeActivatorCache typeActivatorCache) : base(typeActivatorCache)
 {
 }
Example #33
0
 public PropertiesAutowiredControllerActivator(ITypeActivatorCache typeActivatorCache)
 {
     _typeActivatorCache = typeActivatorCache ?? throw new ArgumentNullException(nameof(typeActivatorCache));
 }
 public GenericControllerActivator(ITypeActivatorCache typeActivatorCache)
     : base(typeActivatorCache)
 {
 }
 public MvcControllerActivator(ITypeActivatorCache typeActivatorCache)
 {
     _typeActivatorCache = typeActivatorCache ?? throw new ArgumentNullException(nameof(typeActivatorCache));
 }
 /// <summary>
 /// Creates a new <see cref="DefaultControllerActivator"/>.
 /// </summary>
 /// <param name="typeActivatorCache">The <see cref="ITypeActivatorCache"/>.</param>
 public DefaultControllerActivator(ITypeActivatorCache typeActivatorCache)
 {
     _typeActivatorCache = typeActivatorCache;
 }
Example #37
0
 public DefaultCommandActivator(ITypeActivatorCache typeActivatorCache)
 {
     _typeActivatorCache = typeActivatorCache ?? throw new ArgumentNullException(nameof(typeActivatorCache));
 }
 public CustomControllerActivator(ITypeActivatorCache typeActivatorCache, IDependencyResolver resolver) : base(typeActivatorCache)
 {
     _resolver = resolver;
 }
 public SwitchControllerActivator(ITypeActivatorCache typeActivatorCache)
     : base(typeActivatorCache)
 {
 }
 public MefControllerActivator(MefServiceProvider mefServiceProvider, ITypeActivatorCache typeActivatorCache)
     : base(typeActivatorCache)
 {
     this.MefServiceProvider = mefServiceProvider;
 }
Example #41
0
 /// <summary>
 /// Creates a new <see cref="ParameterFactory"/> instance.
 /// </summary>
 /// <param name="serviceProvider">Service provider.</param>
 /// <param name="typeActivatorCache">Type Activator cache.</param>
 public ParameterFactory(IServiceProvider serviceProvider, ITypeActivatorCache typeActivatorCache)
 {
     this.serviceProvider    = serviceProvider;
     this.typeActivatorCache = typeActivatorCache;
 }
 public WidgetComponentActivator(ITypeActivatorCache typeActivatorCache)
 {
     _typeActivatorCache = typeActivatorCache;
 }
 /// <summary>
 /// Creates a new <see cref="DefaultControllerActivator"/>.
 /// </summary>
 /// <param name="typeActivatorCache">The <see cref="ITypeActivatorCache"/>.</param>
 public DefaultControllerActivator(ITypeActivatorCache typeActivatorCache)
 {
     _typeActivatorCache = typeActivatorCache;
 }