Skip to content
Documentation

MvcBuilderExtensions Class

Defines extension methods for adding version-related capabilities and endpoints to an MVC framework based HTTP API.

public static class MvcBuilderExtensions

Inheritance System.Object 🡒 MvcBuilderExtensions

MvcBuilderExtensions.AddVersionedServiceInformationEndpoints(this IMvcBuilder, string) Method

Section titled “MvcBuilderExtensions.AddVersionedServiceInformationEndpoints(this IMvcBuilder, string) Method”

Adds the VersionInformationController endpoints to the MVC application, providing a root endpoint that returns service version information.

public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddVersionedServiceInformationEndpoints(this Microsoft.Extensions.DependencyInjection.IMvcBuilder mvcBuilder, string? basePath=null);

mvcBuilder Microsoft.Extensions.DependencyInjection.IMvcBuilder

The Microsoft.Extensions.DependencyInjection.IMvcBuilder to register the version information endpoints with.

basePath System.String

An optional base path prefix for the version information endpoints. When null, the endpoints are registered at the application root.

Microsoft.Extensions.DependencyInjection.IMvcBuilder
The mvcBuilder for chaining.

MvcBuilderExtensions.SelectEndpointsByNamespaceAndMediaTypeVersion(this IMvcBuilder, HttpStatusCode) Method

Section titled “MvcBuilderExtensions.SelectEndpointsByNamespaceAndMediaTypeVersion(this IMvcBuilder, HttpStatusCode) Method”

Adds media type based API versioning to an MVC framework based HTTP API. Also registers an Microsoft.Extensions.Options.IPostConfigureOptions<> singleton that installs a DocInclusionPredicate so ApiVersionConstraintAttribute-annotated actions appear in the correct per-version OpenAPI document.

public static Microsoft.Extensions.DependencyInjection.IMvcBuilder SelectEndpointsByNamespaceAndMediaTypeVersion(this Microsoft.Extensions.DependencyInjection.IMvcBuilder mvcBuilder, System.Net.HttpStatusCode statusCodeOnUnmatchedVersion=System.Net.HttpStatusCode.NotFound);

mvcBuilder Microsoft.Extensions.DependencyInjection.IMvcBuilder

The Microsoft.Extensions.DependencyInjection.IMvcBuilder used to setup the application.

statusCodeOnUnmatchedVersion System.Net.HttpStatusCode

The HTTP status code that should be returned by the application if no matching endpoint can be found for a requested API version.

Microsoft.Extensions.DependencyInjection.IMvcBuilder
The mvcBuilder for chaining.

© 2026 Volue.Version v0.6.38017 November 2026