MvcServiceCollectionExtensions Class

Syntax

public class MvcServiceCollectionExtensions

GitHub

View on GitHub

class Microsoft.Framework.DependencyInjection.MvcServiceCollectionExtensions

Methods

AddMvc(IServiceCollection)
Arguments:
  • services (IServiceCollection) –
Return type:

IServiceCollection

public static IServiceCollection AddMvc(IServiceCollection services)
AddMvcLocalization(IServiceCollection)

Adds Mvc localization to the application.

Arguments:
  • services (IServiceCollection) – The @!:IServiceCollection-.
Return type:

IServiceCollection

Returns:

The @!:IServiceCollection-.

public static IServiceCollection AddMvcLocalization(IServiceCollection services)
AddMvcLocalization(IServiceCollection, Microsoft.AspNet.Mvc.Razor.LanguageViewLocationExpanderOption)

Adds Mvc localization to the application.

Arguments:
Return type:

IServiceCollection

Returns:

The @!:IServiceCollection-.

public static IServiceCollection AddMvcLocalization(IServiceCollection services, LanguageViewLocationExpanderOption option)
ConfigureAntiforgery(IServiceCollection, System.Action<Microsoft.AspNet.Mvc.AntiForgeryOptions>)

Configures a set of [Microsoft.AspNet.Mvc.AntiForgeryOptions]() for the application.

Arguments:
  • services (IServiceCollection) – The services available in the application.
  • setupAction (System.Action{Microsoft.AspNet.Mvc.AntiForgeryOptions}) – The [Microsoft.AspNet.Mvc.AntiForgeryOptions]() which need to be configured.
public static void ConfigureAntiforgery(IServiceCollection services, Action<AntiForgeryOptions> setupAction)
ConfigureMvcCaching(IServiceCollection, System.Action<Microsoft.AspNet.Mvc.MvcCacheOptions>)

Configures a set of [Microsoft.AspNet.Mvc.MvcFormatterMappingOptions]() for the application.

Arguments:
  • services (IServiceCollection) – The services available in the application.
  • setupAction (System.Action{Microsoft.AspNet.Mvc.MvcCacheOptions}) – The [Microsoft.AspNet.Mvc.MvcCacheOptions]() which need to be configured.
public static void ConfigureMvcCaching(IServiceCollection services, Action<MvcCacheOptions> setupAction)
ConfigureMvcFormatterMappings(IServiceCollection, System.Action<Microsoft.AspNet.Mvc.MvcFormatterMappingOptions>)

Configures a set of [Microsoft.AspNet.Mvc.MvcFormatterMappingOptions]() for the application.

Arguments:
  • services (IServiceCollection) – The services available in the application.
  • setupAction (System.Action{Microsoft.AspNet.Mvc.MvcFormatterMappingOptions}) – The [Microsoft.AspNet.Mvc.MvcFormatterMappingOptions]() which need to be configured.
public static void ConfigureMvcFormatterMappings(IServiceCollection services, Action<MvcFormatterMappingOptions> setupAction)
ConfigureMvcJson(IServiceCollection, System.Action<Microsoft.AspNet.Mvc.MvcJsonOptions>)

Configures a set of [Microsoft.AspNet.Mvc.MvcJsonOptions]() for the application.

Arguments:
  • services (IServiceCollection) – The services available in the application.
  • setupAction (System.Action{Microsoft.AspNet.Mvc.MvcJsonOptions}) – The [Microsoft.AspNet.Mvc.MvcJsonOptions]() which need to be configured.
public static void ConfigureMvcJson(IServiceCollection services, Action<MvcJsonOptions> setupAction)
ConfigureMvcViews(IServiceCollection, System.Action<Microsoft.AspNet.Mvc.MvcViewOptions>)

Configures a set of [Microsoft.AspNet.Mvc.MvcViewOptions]() for the application.

Arguments:
  • services (IServiceCollection) – The services available in the application.
  • setupAction (System.Action{Microsoft.AspNet.Mvc.MvcViewOptions}) – The [Microsoft.AspNet.Mvc.MvcViewOptions]() which need to be configured.
public static void ConfigureMvcViews(IServiceCollection services, Action<MvcViewOptions> setupAction)
WithControllersAsServices(IServiceCollection, System.Collections.Generic.IEnumerable<System.Reflection.Assembly>)

Registers controller types from the specified <paramref name=”assemblies” /> as services and as a source for controller discovery.

Arguments:
  • services (IServiceCollection) – The @!:IServiceCollection-.
  • controllerAssemblies (System.Collections.Generic.IEnumerable{System.Reflection.Assembly}) – Assemblies to scan.
Return type:

IServiceCollection

Returns:

The @!:IServiceCollection-.

public static IServiceCollection WithControllersAsServices(IServiceCollection services, IEnumerable<Assembly> controllerAssemblies)
WithControllersAsServices(IServiceCollection, System.Collections.Generic.IEnumerable<System.Type>)

Register the specified <paramref name=”controllerTypes” /> as services and as a source for controller discovery.

Arguments:
  • services (IServiceCollection) – The @!:IServiceCollection-.
  • controllerTypes (System.Collections.Generic.IEnumerable{System.Type}) – A sequence of controller [System.Type]()s to register in the <paramref name=”services” /> and used for controller discovery.
Return type:

IServiceCollection

Returns:

The @!:IServiceCollection-.

public static IServiceCollection WithControllersAsServices(IServiceCollection services, IEnumerable<Type> controllerTypes)