Skip to content

Commit 0036e79

Browse files
committed
Add route parameters
1 parent 8f03ca7 commit 0036e79

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

FastWebApi/BaseWebApi.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Threading.Tasks;
1+
using System.Collections.Generic;
2+
using System.Threading.Tasks;
23
using Microsoft.Owin;
34

45
namespace TinyFox.FastWebApi
@@ -14,7 +15,7 @@ public abstract class BaseWebApi
1415
/// <summary>
1516
/// 请求(输入)对象
1617
/// </summary>
17-
protected IOwinRequest Request;
18+
protected IOwinRequest Request;
1819

1920
/// <summary>
2021
/// 应答(输出)对象
@@ -31,6 +32,23 @@ public abstract class BaseWebApi
3132
/// </summary>
3233
protected HttpSession Session;
3334

35+
/// <summary>
36+
/// 路由参数
37+
/// </summary>
38+
protected readonly IDictionary<string, string> RouteArgs = new Dictionary<string, string>();
39+
40+
41+
/// <summary>
42+
/// 添加路由参数
43+
/// </summary>
44+
/// <param name="key"></param>
45+
/// <param name="value"></param>
46+
internal void AddRouteArgs(string key, string value)
47+
{
48+
RouteArgs[key] = value;
49+
}
50+
51+
3452
/// <summary>
3553
/// 处理请求
3654
/// </summary>

FastWebApi/WebApiMiddleware.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public override Task Invoke(IOwinContext c)
5454
{
5555
var app = _router.RouteTo(c);
5656
if (app == null) return _next.Invoke(c);
57+
5758
return app.ProcessRequest(c);
5859
}
5960

0 commit comments

Comments
 (0)