IMvcBuilder 接口

定义

用于配置 MVC 服务的接口。

public interface IMvcBuilder
type IMvcBuilder = interface
Public Interface IMvcBuilder

属性

PartManager

获取 ApplicationPartManager 配置 的位置 ApplicationPart

Services

获取 IServiceCollection 配置 MVC 服务的 。

扩展方法

AddApplicationPart(IMvcBuilder, Assembly)

将 添加到 ApplicationPart 上的 PartManager的列表中ApplicationParts

AddControllersAsServices(IMvcBuilder)

将发现的控制器注册为 中的 IServiceCollection服务。

AddFormatterMappings(IMvcBuilder, Action<FormatterMappings>)

FormatterMappings为指定的 builder配置 。

AddJsonOptions(IMvcBuilder, Action<JsonOptions>)

JsonOptions为指定的 builder配置 。 使用 中的 JsonSerializerDefaults.Web默认值。

AddMvcOptions(IMvcBuilder, Action<MvcOptions>)

注册操作以配置 MvcOptions

ConfigureApiBehaviorOptions(IMvcBuilder, Action<ApiBehaviorOptions>)

配置 ApiBehaviorOptions

ConfigureApplicationPartManager(IMvcBuilder, Action<ApplicationPartManager>)

ApplicationPartManager使用给定 Action<T>PartManager 配置 的 。

SetCompatibilityVersion(IMvcBuilder, CompatibilityVersion)
已过时.

CompatibilityVersion为应用程序设置 ASP.NET Core MVC 的 。

AddDataAnnotationsLocalization(IMvcBuilder)

向应用程序添加 MVC 数据注释本地化。

AddDataAnnotationsLocalization(IMvcBuilder, Action<MvcDataAnnotationsLocalizationOptions>)

向应用程序添加 MVC 数据注释本地化。

AddJsonOptions(IMvcBuilder, Action<MvcJsonOptions>)

用于配置 MVC 服务的接口。

AddMvcLocalization(IMvcBuilder)

将 MVC 视图和数据注释本地化服务添加到应用程序。

AddMvcLocalization(IMvcBuilder, LanguageViewLocationExpanderFormat)

将 MVC 视图和数据注释本地化服务添加到应用程序。

AddMvcLocalization(IMvcBuilder, LanguageViewLocationExpanderFormat, Action<MvcDataAnnotationsLocalizationOptions>)

将 MVC 视图和数据注释本地化服务添加到应用程序。

AddMvcLocalization(IMvcBuilder, Action<MvcDataAnnotationsLocalizationOptions>)

将 MVC 视图和数据注释本地化服务添加到应用程序。

AddMvcLocalization(IMvcBuilder, Action<LocalizationOptions>)

将 MVC 视图和数据注释本地化服务添加到应用程序。

AddMvcLocalization(IMvcBuilder, Action<LocalizationOptions>, LanguageViewLocationExpanderFormat)

将 MVC 视图和数据注释本地化服务添加到应用程序。

AddMvcLocalization(IMvcBuilder, Action<LocalizationOptions>, LanguageViewLocationExpanderFormat, Action<MvcDataAnnotationsLocalizationOptions>)

将 MVC 视图和数据注释本地化服务添加到应用程序。

AddMvcLocalization(IMvcBuilder, Action<LocalizationOptions>, Action<MvcDataAnnotationsLocalizationOptions>)

将 MVC 视图和数据注释本地化服务添加到应用程序。

AddViewLocalization(IMvcBuilder)

将 MVC 视图本地化服务添加到应用程序。

AddViewLocalization(IMvcBuilder, LanguageViewLocationExpanderFormat)

将 MVC 视图本地化服务添加到应用程序。

AddViewLocalization(IMvcBuilder, LanguageViewLocationExpanderFormat, Action<LocalizationOptions>)

将 MVC 视图本地化服务添加到应用程序。

AddViewLocalization(IMvcBuilder, Action<LocalizationOptions>)

将 MVC 视图本地化服务添加到应用程序。

AddRazorOptions(IMvcBuilder, Action<RazorViewEngineOptions>)

为应用程序配置一组 RazorViewEngineOptions

AddTagHelpersAsServices(IMvcBuilder)

将标记帮助程序注册为服务,并将现有的 ITagHelperActivatorMicrosoft.AspNetCore.Mvc.Razor.ServiceBasedTagHelperActivator替换为 。

InitializeTagHelper<TTagHelper>(IMvcBuilder, Action<TTagHelper,ViewContext>)

为给定 TTagHelper添加初始化回调。

AddRazorPagesOptions(IMvcBuilder, Action<RazorPagesOptions>)

为应用程序配置一组 RazorPagesOptions

WithRazorPagesAtContentRoot(IMvcBuilder)

将 Razor Pages 配置为在内容根目录 (ContentRootPath) 根。

WithRazorPagesRoot(IMvcBuilder, String)

将 Razor Pages 配置为使用指定的 rootDirectory

AddCookieTempDataProvider(IMvcBuilder)

注册CookieTempDataProvider为 中的IServiceCollection默认值ITempDataProvider

AddCookieTempDataProvider(IMvcBuilder, Action<CookieTempDataProviderOptions>)

注册CookieTempDataProvider为 中的IServiceCollection默认值ITempDataProvider

AddSessionStateTempDataProvider(IMvcBuilder)

注册SessionStateTempDataProvider为 中的IServiceCollection默认值ITempDataProvider

AddViewComponentsAsServices(IMvcBuilder)

将发现的视图组件注册为 中的 IServiceCollection服务。

AddViewOptions(IMvcBuilder, Action<MvcViewOptions>)

为应用程序添加 的配置 MvcViewOptions

AddXmlDataContractSerializerFormatters(IMvcBuilder)

将 XML DataContractSerializer 格式化程序添加到 MVC。

AddXmlDataContractSerializerFormatters(IMvcBuilder, Action<MvcXmlOptions>)

将 XML DataContractSerializer 格式化程序添加到 MVC。

AddXmlOptions(IMvcBuilder, Action<MvcXmlOptions>)

为应用程序添加 的配置 MvcXmlOptions

AddXmlSerializerFormatters(IMvcBuilder)

将 XML 序列化程序格式化程序添加到 MVC。

AddXmlSerializerFormatters(IMvcBuilder, Action<MvcXmlOptions>)

将 XML 序列化程序格式化程序添加到 MVC。

AddNewtonsoftJson(IMvcBuilder)

配置 Newtonsoft.Json 特定功能,例如输入和输出格式化程序。

AddNewtonsoftJson(IMvcBuilder, Action<MvcNewtonsoftJsonOptions>)

配置 Newtonsoft.Json 特定功能,例如输入和输出格式化程序。

AddRazorRuntimeCompilation(IMvcBuilder)

IMvcBuilder配置为支持 Razor 视图和 Razor 页面的运行时编译。

AddRazorRuntimeCompilation(IMvcBuilder, Action<MvcRazorRuntimeCompilationOptions>)

IMvcBuilder配置为支持 Razor 视图和 Razor 页面的运行时编译。

AddCacheTagHelperLimits(IMvcBuilder, Action<CacheTagHelperOptions>)

在 的缓存 CacheTagHelper上配置内存大小限制。

AddWebApiConventions(IMvcBuilder)

用于配置 MVC 服务的接口。

适用于