1. 更新了节点入参的条件判断:入参类型为IFlowContext(流程上下文)时禁止创建参数来源连接。

2. [Script]脚本节点移除了“getFlowContext”内置方法,改为自动识别入参名称为“context""flowContext""flow_context",如果是,将自动使用 IFlowContext 类型参数(运行时自动给定)
3. NodeFlow项目中,FlowLibraryService添加了GetType(string)以及TryGetType(string,Type?)方法,用于流程环境搜索外部加载的程序集类型。
This commit is contained in:
fengjiayi
2025-08-04 20:13:03 +08:00
parent bf987f4ef0
commit e389dbb967
10 changed files with 103 additions and 37 deletions

View File

@@ -168,15 +168,57 @@ namespace Serein.Library
IsParams = info.IsParams;
}
/// <summary>
/// 禁止将 IFlowContext 类型显式入参设置为 true
/// </summary>
/// <param name="__isAllow"></param>
/// <param name="newValue"></param>
partial void BeforeTheIsExplicitData(ref bool __isAllow, bool newValue)
{
if(DataType == typeof(IFlowContext))
if(DataType == typeof(IFlowContext) && newValue == true)
{
__isAllow = false;
}
}
/// <summary>
/// 脚本节点的类型缓存。
/// </summary>
private Type? cacheType;
private bool cacheIsExplicit;
/// <summary>
/// 脚本节点的名称变更为流程上下文时,调整 DataType 和 IsExplicitData 的值。
/// </summary>
/// <param name="oldValue"></param>
/// <param name="newValue"></param>
partial void OnNameChanged(string oldValue, string newValue)
{
if (NodeModel is null)
return;
if (NodeModel.ControlType == NodeControlType.Script)
{
var isIgnore = StringComparison.OrdinalIgnoreCase;
if ("context".Equals(newValue, isIgnore) ||
"flowcontext".Equals(newValue, isIgnore) ||
"flow_context".Equals(newValue, isIgnore))
{
cacheType = DataType;
cacheIsExplicit = IsExplicitData;
DataType = typeof(IFlowContext);
IsExplicitData = false;
}
else
{
if (cacheType is not null)
{
DataType = cacheType;
IsExplicitData = cacheIsExplicit;
}
}
}
}
/// <summary>
/// 转为描述