You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
691 B
28 lines
691 B
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;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|