mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-11 12:10:47 +08:00
重写了触发器底层逻辑
This commit is contained in:
@@ -38,6 +38,11 @@ namespace Serein.Library.Core.NodeFlow
|
||||
{
|
||||
// 获取 Task<> 的泛型参数类型
|
||||
var innerType = type.GetGenericArguments()[0];
|
||||
if (innerType.IsGenericType && type.GetGenericTypeDefinition() == typeof(IFlipflopContext<>))
|
||||
{
|
||||
var flipflop = type.GetGenericArguments()[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
// 判断 innerType 是否继承 IFlipflopContext
|
||||
//if (typeof(IFlipflopContext).IsAssignableFrom(innerType))
|
||||
@@ -50,11 +55,11 @@ namespace Serein.Library.Core.NodeFlow
|
||||
//}
|
||||
|
||||
// 检查泛型参数是否为 Flipflop<>
|
||||
if (innerType == typeof(IFlipflopContext))
|
||||
//if (innerType == typeof(IFlipflopContext))
|
||||
//if (innerType.IsGenericType && innerType.GetGenericTypeDefinition() == typeof(FlipflopContext<>))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//{
|
||||
//return true;
|
||||
//}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -64,20 +69,21 @@ namespace Serein.Library.Core.NodeFlow
|
||||
/// <summary>
|
||||
/// 触发器上下文
|
||||
/// </summary>
|
||||
public class FlipflopContext : IFlipflopContext
|
||||
public class FlipflopContext<TResult> : IFlipflopContext<TResult>
|
||||
{
|
||||
public FlipflopStateType State { get; set; }
|
||||
|
||||
public TriggerData TriggerData { get; set; }
|
||||
public TriggerType Type { get; set; }
|
||||
public TResult Value { get; set; }
|
||||
|
||||
public FlipflopContext(FlipflopStateType ffState)
|
||||
{
|
||||
State = ffState;
|
||||
}
|
||||
public FlipflopContext(FlipflopStateType ffState, TriggerData data)
|
||||
public FlipflopContext(FlipflopStateType ffState, TResult value)
|
||||
{
|
||||
State = ffState;
|
||||
TriggerData = data;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user