/// <summary>
 /// Creates a new instance of <see cref="DefaultViewComponentDescriptorCollectionProvider"/>.
 /// </summary>
 /// <param name="descriptorProvider">The <see cref="IViewComponentDescriptorProvider"/>.</param>
 public DefaultViewComponentDescriptorCollectionProvider(IViewComponentDescriptorProvider descriptorProvider)
 {
     _descriptorProvider = descriptorProvider;
 }
        /// <summary>
        /// Registers the ASP.NET view component types using the supplied 
        /// <paramref name="viewComponentDescriptorProvider"/>.
        /// </summary>
        /// <param name="container">The container the controllers should be registered in.</param>
        /// <param name="viewComponentDescriptorProvider">The provider that contains the list of view
        /// components to register.</param>
        public static void RegisterMvcViewComponents(this Container container,
            IViewComponentDescriptorProvider viewComponentDescriptorProvider)
        {
            Requires.IsNotNull(container, nameof(container));
            Requires.IsNotNull(viewComponentDescriptorProvider, nameof(viewComponentDescriptorProvider));

            var componentTypes = viewComponentDescriptorProvider
                .GetViewComponents()
                .Select(description => description.TypeInfo.AsType());

            RegisterViewComponentTypes(container, componentTypes);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new instance of <see cref="DefaultViewComponentDescriptorCollectionProvider"/>.
 /// </summary>
 /// <param name="descriptorProvider">The <see cref="IViewComponentDescriptorProvider"/>.</param>
 public DefaultViewComponentDescriptorCollectionProvider(IViewComponentDescriptorProvider descriptorProvider)
 {
     _descriptorProvider = descriptorProvider;
 }