using Microsoft.AspNetCore.Mvc.ApplicationModels; using Serilog; namespace LFlow.Base.Utils { /// /// 控制器模型约定 /// public class ApiExplorerGroupPerVersionConvention : IControllerModelConvention { /// /// 配置 /// /// public void Apply(ControllerModel controller) { foreach (var action in controller.Actions) { action.ApiExplorer.GroupName = controller.ControllerName; action.ApiExplorer.IsVisible = true; Log.Logger.Information($"ApiExplorerGroup added -> {controller.ControllerName} / {action.ActionName}"); } } } }