Class ControllersArcBuilderExtensions

Namespace
Cratis.Arc
Assembly
Cratis.Arc.dll

Provides extension methods on IArcBuilder for MVC controllers.

public static class ControllersArcBuilderExtensions
Inheritance
ControllersArcBuilderExtensions
Inherited Members

Methods

WithoutControllers(IArcBuilder)

Leaves MVC out of the application: Arc does not register MVC or discover controllers.

public static IArcBuilder WithoutControllers(this IArcBuilder builder)

Parameters

builder IArcBuilder

IArcBuilder to configure.

Returns

IArcBuilder

IArcBuilder for building continuation.

Examples

builder.AddCratisArc(configureBuilder: arc => arc.WithoutControllers());

Remarks

Model-bound commands and queries, including observable queries, keep working, because Arc maps their endpoints itself. Controller-based commands and queries are not available, and neither is anything else that needs MVC, such as MapControllers.

MVC is not supported with trimming or NativeAOT. This keeps MVC out of the application at runtime, but it is a runtime choice: the trimmer cannot remove MVC from a trimmed or NativeAOT publish because of it. To have MVC removed, set the CratisArcControllersSupport MSBuild property to false in the application's project file, which turns controllers off without calling this. By default controllers are on.

Without MVC the application registers the ASP.NET Core services it used to get from MVC itself, such as AddCors for UseCors and AddEndpointsApiExplorer for Swashbuckle. Arc registers authorization.