MvcServiceCollectionExtensions Class¶
Extension methods for setting up MVC services in an Microsoft.Extensions.DependencyInjection.IServiceCollection
.
- Namespace
Microsoft.Extensions.DependencyInjection
- Assemblies
- Microsoft.AspNetCore.Mvc
Syntax¶
public class MvcServiceCollectionExtensions
-
class
Microsoft.Extensions.DependencyInjection.
MvcServiceCollectionExtensions
Methods¶
-
AddMvc
(Microsoft.Extensions.DependencyInjection.IServiceCollection)¶ Adds MVC services to the specified
Microsoft.Extensions.DependencyInjection.IServiceCollection
.Arguments: services (Microsoft.Extensions.DependencyInjection.IServiceCollection) – The Microsoft.Extensions.DependencyInjection.IServiceCollection
to add services to.Return type: Microsoft.Extensions.DependencyInjection.IMvcBuilder Returns: An Microsoft.Extensions.DependencyInjection.IMvcBuilder
that can be used to further configure the MVC services.public static IMvcBuilder AddMvc(this IServiceCollection services)
-
AddMvc
(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action<Microsoft.AspNetCore.Mvc.MvcOptions>) Adds MVC services to the specified
Microsoft.Extensions.DependencyInjection.IServiceCollection
.Arguments: - services (Microsoft.Extensions.DependencyInjection.IServiceCollection) – The
Microsoft.Extensions.DependencyInjection.IServiceCollection
to add services to. - setupAction (System.Action<Microsoft.AspNetCore.Mvc.MvcOptions>) – An
System.Action`1
to configure the providedMicrosoft.AspNetCore.Mvc.MvcOptions
.
Return type: Returns: An
Microsoft.Extensions.DependencyInjection.IMvcBuilder
that can be used to further configure the MVC services.public static IMvcBuilder AddMvc(this IServiceCollection services, Action<MvcOptions> setupAction)
- services (Microsoft.Extensions.DependencyInjection.IServiceCollection) – The
-