/// <summary> /// The get api version convention builder. /// </summary> /// <returns> /// The <see cref="ApiVersionConventionBuilder"/>. /// </returns> public static ApiVersionConventionBuilder GetApiVersionConventionBuilder() { var conv = new ApiVersionConventionBuilder(); conv.Controller<TestController>().HasApiVersion(ApiVersionSettings.CurrentMajorVersion, ApiVersionSettings.CurrentMinorVersion) .HasApiVersion(ApiVersionSettings.DefaultMajorVersion, ApiVersionSettings.DefaultMinorVersion) .HasDeprecatedApiVersion(ApiVersionSettings.DepreciatedMajorVersion, ApiVersionSettings.DepreciatedMinorVersion); return conv; }
public override bool ApplyTo(ControllerModel controllerModel) { var controllerIntroducedInVersion = controllerModel.GetIntroducedVersion(); var controllerRemovedAsOfVersion = controllerModel.GetRemovedVersion(); ValidateControllerVersions(controllerModel, controllerIntroducedInVersion, controllerRemovedAsOfVersion); if (UseApiConvention(controllerIntroducedInVersion, controllerRemovedAsOfVersion)) { return(_apiVersionConventionBuilder.ApplyTo(controllerModel)); } var controller = _apiVersionConventionBuilder.Controller(controllerModel.ControllerType); SetControllerApiVersions(controller, controllerIntroducedInVersion, controllerRemovedAsOfVersion); SetActionApiVersions(controllerModel, controllerIntroducedInVersion, controllerRemovedAsOfVersion, controller); _apiVersionConventionBuilder.ApplyTo(controllerModel); return(true); }