Updated abp api versioning package for new changes of api versioning library.

pull/206/head
Halil İbrahim Kalkan 7 years ago
parent f06f86e009
commit 1a39cb0b44

@ -41,30 +41,20 @@ namespace Microsoft.Extensions.DependencyInjection
{
foreach (var controllerType in setting.ControllerTypes)
{
var controllerBuilder = typeof(ApiVersionConventionBuilder)
.GetMethod(nameof(ApiVersionConventionBuilder.Controller),
BindingFlags.Instance | BindingFlags.Public)
.MakeGenericMethod(controllerType)
.Invoke(options.Conventions, null);
var controllerBuilder = options.Conventions.Controller(controllerType);
if (setting.ApiVersions.Any())
{
foreach (var apiVersion in setting.ApiVersions)
{
typeof(ControllerApiVersionConventionBuilder<>)
.MakeGenericType(controllerType)
.GetMethod("HasApiVersion")
.Invoke(controllerBuilder, new object[] {apiVersion});
controllerBuilder.HasApiVersion(apiVersion);
}
}
else
{
if (!controllerType.IsDefined(typeof(ApiVersionAttribute), true))
{
typeof(ControllerApiVersionConventionBuilder<>)
.MakeGenericType(controllerType)
.GetMethod("IsApiVersionNeutral")
.Invoke(controllerBuilder, null);
controllerBuilder.IsApiVersionNeutral();
}
}
}

Loading…
Cancel
Save