21 lines
704 B
C#
Executable File
21 lines
704 B
C#
Executable File
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.Routing;
|
|
using Opsoft.NetCore.O3App.WebApi.Models;
|
|
|
|
namespace Opsoft.NetCore.O3App.WebApi.Extensions
|
|
{
|
|
public static class MvcOptionsExtensions
|
|
{
|
|
/// <summary>
|
|
/// 扩展方法
|
|
/// </summary>
|
|
/// <param name="opts"></param>
|
|
/// <param name="routeAttribute"></param>
|
|
public static void UseCentralRoutePrefix(this MvcOptions opts, IRouteTemplateProvider routeAttribute)
|
|
{
|
|
// 添加我们自定义 实现IApplicationModelConvention的RouteConvention
|
|
opts.Conventions.Insert(0, new RouteConvention(routeAttribute));
|
|
}
|
|
}
|
|
}
|