mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-14 21:46:35 +08:00
IOC容器添加构造函数注入(DLL类中使用AutoRegisterAttribute特性标注的类,会在流程启动时自动注册),提高可读性。
This commit is contained in:
@@ -29,6 +29,12 @@ namespace Serein.Library.Web
|
||||
/// </summary>
|
||||
public class Router : IRouter
|
||||
{
|
||||
private readonly ISereinIOC SereinIOC; // 用于存储路由信息
|
||||
|
||||
public Router(ISereinIOC SereinIOC)
|
||||
{
|
||||
this.SereinIOC = SereinIOC;
|
||||
}
|
||||
/// <summary>
|
||||
/// 控制器实例对象的类型,每次调用都会重新实例化,[Url - ControllerType]
|
||||
/// </summary>
|
||||
@@ -39,8 +45,7 @@ namespace Serein.Library.Web
|
||||
/// </summary>
|
||||
private readonly ConcurrentDictionary<string, ConcurrentDictionary<string, MethodInfo>> _routes;
|
||||
|
||||
[AutoInjection]
|
||||
public ISereinIOC SereinIOC { get; set; } // 用于存储路由信息
|
||||
|
||||
// private readonly ILoggerService loggerService; // 用于存储路由信息
|
||||
|
||||
//private Type PostRequest;
|
||||
|
||||
@@ -13,13 +13,18 @@ namespace Serein.Library.Web
|
||||
/// <summary>
|
||||
/// HTTP接口监听类
|
||||
/// </summary>
|
||||
[AutoRegister]
|
||||
public class WebServer
|
||||
{
|
||||
[AutoInjection]
|
||||
public IRouter Router { get; set; } // 路由器
|
||||
private readonly IRouter Router;// 路由器
|
||||
public WebServer(IRouter router)
|
||||
{
|
||||
this.Router = router;
|
||||
}
|
||||
|
||||
[AutoInjection]
|
||||
public NodeRunCts nodeRunCts { get; set; }
|
||||
|
||||
//[AutoInjection]
|
||||
//public NodeRunCts nodeRunCts { get; set; }
|
||||
|
||||
private HttpListener listener; // HTTP 监听器
|
||||
private RequestLimiter requestLimiter; //接口防刷
|
||||
|
||||
Reference in New Issue
Block a user