3 changed files with 58 additions and 12 deletions
@ -0,0 +1,28 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Apewer.Web |
|||
{ |
|||
|
|||
internal class ApiMiddleware |
|||
{ |
|||
|
|||
internal Type Type; |
|||
internal Action<ApiContext, Action> Callback; |
|||
|
|||
public ApiMiddleware(Type type) |
|||
{ |
|||
if (!typeof(IApiMiddleware).IsAssignableFrom(type)) throw new NotImplementedException($"类型【{type.FullName}】未实现【{nameof(IApiMiddleware)}】。"); |
|||
Type = type; |
|||
} |
|||
|
|||
public ApiMiddleware(Action<ApiContext, Action> callback) |
|||
{ |
|||
if (callback == null) throw new ArgumentNullException(nameof(callback)); |
|||
Callback = callback; |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue