Skip to content

Add synonym to AddMvc method. #1089

Open
@voroninp

Description

@voroninp

Background and Motivation

Extension method which operate on IServiceCollection type are usually chainable.
When I saw examples it was not immeidately obvious that AddMvc is not the same from Asp.Net Core:

public static IApiVersioningBuilder AddMvc(this IApiVersioningBuilder builder)

vs

public static IMvcBuilder AddMvc(this IServiceCollection services)

It took me a while to understand why versioning was not working for controllers.

Proposed API

My proposal is to add alternative method named WithMvcSupport() which, IMO, will cause less confusion and will be more descriptive. (Also WithApiExplorerSupport)

Usage Examples

services.AddApiVersioning(cfg => { ...}).WithMvcSupport().WithApiExplorerSupport();

Risks

If this proposal is accepted, the interface will epand, so is the need to support it. Maybe old methods can be deprecated with time.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions