api-versioning

VersionedRoute Attribute Implementation for MVC6

做~自己de王妃 提交于 2019-12-03 05:53:08
问题 I am trying to enable versioning on a REST API, where the version is specified in the header, as "api-version":2 . According to this tutorial I just need to create VersionConstraint : IHttpRouteConstraint and VersionedRoute: RouteFactoryAttribute The usage would be to apply the [VersionedRoute("api/controllerName", 2)] Attribute to Controllers, which are designed for specific versions (e.g. version 2 in this case). This is all good and well, but unfortunately, it's all in MVC5 and I'm using