вот пример кода
Код: Выделить всё
services.AddApiVersioning(
options =>
{
options.ReportApiVersions = true;
options.DefaultApiVersion = new ApiVersion(0,0);
options.AssumeDefaultVersionWhenUnspecified = true;
} );
services.AddVersionedApiExplorer(
options =>
{
// note: the specified format code will format the version as "'v'major[.minor][-status]"
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
} );
Код: Выделить всё
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1")]
public class BreadcrumbsController : BaseController
{
...code removed...
}
Как заставить Версионный API Explorer обнаруживать контроллеры без добавления атрибута ApiController?
Подробнее здесь: https://stackoverflow.com/questions/557 ... -attribute
Мобильная версия