实现了拖拽式设置方法调用顺序、方法入参参数来源

This commit is contained in:
fengjiayi
2024-10-24 23:32:43 +08:00
parent 0666f0b2c1
commit 6f26d303e4
43 changed files with 2282 additions and 763 deletions

View File

@@ -1,9 +1,6 @@
using Serein.Library.Api;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
namespace Serein.Library
{
@@ -17,7 +14,7 @@ namespace Serein.Library
private readonly IFlowEnvironment env;
/// <summary>
/// 对应的节点
/// 所在的节点
/// </summary>
[PropertyInfo(IsProtection = true)]
private NodeModelBase _nodeModel;
@@ -29,7 +26,9 @@ namespace Serein.Library
private int _index;
/// <summary>
/// 是否为显式参数(固定值/表达式)
/// <para>是否为显式参数(固定值/表达式)</para>
/// <para>如果为 true 则使用UI输入的文本值作为入参数据过程中会尽可能转为类型需要的数据。</para>
/// <para>如果为 false ,则根据 ArgDataSourceType 调用相应节点的GetFlowData()方法,获取返回的数据作为入参数据。</para>
/// </summary>
[PropertyInfo(IsNotification = true)]
private bool _isExplicitData ;
@@ -41,7 +40,7 @@ namespace Serein.Library
private Func<object, object> _convertor ;
/// <summary>
/// 显式类型
/// 方法入参若无相关转换器特性标注则无需关注该变量。该变量用于需要用到枚举BinValue转换器时指示相应的入参变量需要转为的类型
/// </summary>
[PropertyInfo]
private Type _explicitType ;
@@ -56,7 +55,22 @@ namespace Serein.Library
private string _explicitTypeName ;
/// <summary>
/// 方法需要的类型
/// 入参数据来源。默认使用上一节点作为入参数据。
/// </summary>
[PropertyInfo(IsNotification = true)]
private ConnectionArgSourceType _argDataSourceType = ConnectionArgSourceType.GetPreviousNodeData;
/// <summary>
/// 当 ArgDataSourceType 不为 GetPreviousNodeData 时(从运行时上一节点获取数据)。
/// 则通过该集合对应的节点,获取其 FlowData 作为预处理的入参参数。
/// </summary>
[PropertyInfo(IsProtection = true)]
public NodeModelBase[] _argDataSourceNodeMoels;
/// <summary>
/// 方法入参需要的类型。
/// </summary>
[PropertyInfo]
private Type _dataType ;
@@ -74,7 +88,7 @@ namespace Serein.Library
private string _dataValue;
/// <summary>
/// 如果是引用类型,拷贝时不会发生改变
/// 只有当ExplicitTypeName 为 Select 时,才会需要该成员
/// </summary>
[PropertyInfo(IsNotification = true)]
private string[] _items ;
@@ -91,6 +105,7 @@ namespace Serein.Library
this.env = env;
this.NodeModel = nodeModel;
}
/// <summary>
/// 通过参数信息加载实体,用于加载项目文件、远程连接的场景
/// </summary>
@@ -109,12 +124,15 @@ namespace Serein.Library
/// <summary>
/// 用于创建元数据
/// </summary>
/// <param name="info">方法参数信息</param>
public ParameterDetails()
{
}
/// <summary>
/// 转为描述
/// </summary>
@@ -151,6 +169,7 @@ namespace Serein.Library
Name = this.Name,
DataValue = string.IsNullOrEmpty(DataValue) ? string.Empty : DataValue,
Items = this.Items?.Select(it => it).ToArray(),
};
return pd;
}