/// <summary>
 /// Registers controller types from the specified <paramref name="assemblies"/> as services and as a source
 /// for controller discovery.
 /// </summary>
 /// <param name="builder">The <see cref="IMvcCoreBuilder"/>.</param>
 /// <param name="controllerAssemblies">Assemblies to scan.</param>
 /// <returns>The <see cref="IMvcCoreBuilder"/>.</returns>
 public static IMvcCoreBuilder AddControllersAsServices(
     [NotNull] this IMvcCoreBuilder builder,
     [NotNull] IEnumerable <Assembly> controllerAssemblies)
 {
     ControllersAsServices.AddControllersAsServices(builder.Services, controllerAssemblies);
     return(builder);
 }
示例#2
0
 /// <summary>
 /// Register the specified <paramref name="controllerTypes"/> as services and as a source for controller
 /// discovery.
 /// </summary>
 /// <param name="builder">The <see cref="IMvcBuilder"/>.</param>
 /// <param name="controllerTypes">A sequence of controller <see cref="Type"/>s to register in the
 /// <paramref name="services"/> and used for controller discovery.</param>
 /// <returns>The <see cref="IMvcBuilder"/>.</returns>
 public static IMvcBuilder AddControllersAsServices(
     [NotNull] this IMvcBuilder builder,
     [NotNull] IEnumerable <Type> controllerTypes)
 {
     ControllersAsServices.AddControllersAsServices(builder.Services, controllerTypes);
     return(builder);
 }
        /// <summary>
        /// Registers controller types from the specified <paramref name="controllerAssemblies"/> as services and as a source
        /// for controller discovery.
        /// </summary>
        /// <param name="builder">The <see cref="IMvcCoreBuilder"/>.</param>
        /// <param name="controllerAssemblies">Assemblies to scan.</param>
        /// <returns>The <see cref="IMvcCoreBuilder"/>.</returns>
        public static IMvcCoreBuilder AddControllersAsServices(
            this IMvcCoreBuilder builder,
            IEnumerable <Assembly> controllerAssemblies)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            ControllersAsServices.AddControllersAsServices(builder.Services, controllerAssemblies);
            return(builder);
        }
示例#4
0
        /// <summary>
        /// Register the specified <paramref name="controllerTypes"/> as services and as a source for controller
        /// discovery.
        /// </summary>
        /// <param name="builder">The <see cref="IMvcBuilder"/>.</param>
        /// <param name="controllerTypes">A sequence of controller <see cref="Type"/>s to register in the
        /// <paramref name="services"/> and used for controller discovery.</param>
        /// <returns>The <see cref="IMvcBuilder"/>.</returns>
        public static IMvcBuilder AddControllersAsServices(
            this IMvcBuilder builder,
            IEnumerable <Type> controllerTypes)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

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

            ControllersAsServices.AddControllersAsServices(builder.Services, controllerTypes);
            return(builder);
        }