mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-02 22:36:35 +08:00
表达式节点、条件表达式节点改用Serein.Script进行构造解析执行,避免了文本解析带来的性能损耗。
This commit is contained in:
@@ -50,15 +50,14 @@ namespace Serein.Library
|
||||
Flipflop,
|
||||
/// <summary>
|
||||
/// <para>动作节点,可以异步等待</para>
|
||||
/// <para>如果不显式的设置入参数据(例如文本、@Get取值表达式),就会默认使用该节点的运行时上一个节点的数据。</para>
|
||||
/// <para>假如上一节点是某个对象,但入参需要的是对象中某个属性/字段,则建议使用取值表达式、表达式节点获取所需要的数据。</para>
|
||||
/// <para>如果不显式的设置入参数据,就会默认使用该节点的运行时上一个节点的数据。</para>
|
||||
/// <para>假如上一节点是某个对象,但入参需要的是对象中某个属性/字段,则建议使用表达式节点获取所需要的数据。</para>
|
||||
/// <para>关于@Get取值表达式的使用方法:</para>
|
||||
/// <para>public class UserInfo </para>
|
||||
/// <para>{ </para>
|
||||
/// <para> public string Name; // 取值表达式:@Get .Name </para>
|
||||
/// <para> public string[] PhoneNums; // 获取第1项的取值表达式:@Get .PhoneNums[0] </para>
|
||||
/// <para> public string Name; // 取值表达式:@Get .Name </para>
|
||||
/// <para> public string[] PhoneNums; // 取值表达式:@Get .PhoneNums </para>
|
||||
/// <para> } </para>
|
||||
/// <para>取值表达式可以符合直觉的如此获取实例成员:@Get .Data.Array[2].Data......</para>
|
||||
/// <para>格式说明:@Get大小写不敏感,然后空一格,需要标记“.”,然后才是获取成员名称(成员名称大小写敏感)。</para>
|
||||
/// </summary>
|
||||
Action,
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Utils;
|
||||
using Serein.Library.Utils.SereinExpression;
|
||||
using Serein.Library.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Serein.Library
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Utils;
|
||||
using Serein.Library.Utils.SereinExpression;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
@@ -119,10 +116,6 @@ namespace Serein.Library
|
||||
public partial class ParameterDetails
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用于创建元数据
|
||||
@@ -276,17 +269,8 @@ namespace Serein.Library
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 表达式处理
|
||||
if (IsExplicitData && DataValue.StartsWith("@", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var lower = DataValue.ToLowerInvariant();
|
||||
if (lower.StartsWith("@get") || lower.StartsWith("@dtc") || lower.StartsWith("@data"))
|
||||
{
|
||||
inputParameter = SerinExpressionEvaluator.Evaluate(DataValue, inputParameter, out _);
|
||||
}
|
||||
}
|
||||
|
||||
// 6. 类型转换
|
||||
// 5. 类型转换
|
||||
if (!DataType.IsValueType && inputParameter is null)
|
||||
throw new Exception($"[arg{Index}] 参数不能为null");
|
||||
|
||||
@@ -303,7 +287,10 @@ namespace Serein.Library
|
||||
throw new Exception($"[arg{Index}] 类型不匹配:目标类型为 {DataType},实际类型为 {actualType}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
|
||||
|
||||
/* /// <summary>
|
||||
/// 转为方法入参数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
@@ -347,7 +334,7 @@ namespace Serein.Library
|
||||
|
||||
|
||||
|
||||
/*#region “枚举-类型”转换器
|
||||
*//*#region “枚举-类型”转换器
|
||||
if (ExplicitType is not null && ExplicitType.IsEnum && DataType != ExplicitType)
|
||||
{
|
||||
var resultEnum = Enum.Parse(ExplicitType, DataValue);
|
||||
@@ -359,7 +346,7 @@ namespace Serein.Library
|
||||
return value;
|
||||
}
|
||||
}
|
||||
#endregion*/
|
||||
#endregion*//*
|
||||
|
||||
// 需要获取预入参数据
|
||||
object inputParameter;
|
||||
@@ -473,7 +460,7 @@ namespace Serein.Library
|
||||
|
||||
throw new Exception($"[arg{Index}][{Name}][{DataType}]入参类型不符合,当前预入参类型为{inputParameterType}");
|
||||
}
|
||||
|
||||
*/
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{this.Index}] {(string.IsNullOrWhiteSpace(this.Description) ? string.Empty : $"({this.Description})")}{this.Name} : {this.DataType?.FullName}";
|
||||
|
||||
@@ -42,12 +42,15 @@
|
||||
<ItemGroup>
|
||||
<Compile Remove="Http\**" />
|
||||
<Compile Remove="Network\**" />
|
||||
<Compile Remove="Utils\SereinExpression\**" />
|
||||
<Compile Remove="Utils\SerinExpression\**" />
|
||||
<EmbeddedResource Remove="Http\**" />
|
||||
<EmbeddedResource Remove="Network\**" />
|
||||
<EmbeddedResource Remove="Utils\SereinExpression\**" />
|
||||
<EmbeddedResource Remove="Utils\SerinExpression\**" />
|
||||
<None Remove="Http\**" />
|
||||
<None Remove="Network\**" />
|
||||
<None Remove="Utils\SereinExpression\**" />
|
||||
<None Remove="Utils\SerinExpression\**" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace Serein.Library.Utils.SereinExpression
|
||||
/// <summary>
|
||||
/// 条件解析器(生成IL进行判断)
|
||||
/// 格式: data.[propertyName] [operator] [value]
|
||||
/// 返回值:boolea
|
||||
/// </summary>
|
||||
public class SereinConditionParser
|
||||
{
|
||||
@@ -113,11 +114,6 @@ namespace Serein.Library.Utils.SereinExpression
|
||||
}
|
||||
|
||||
|
||||
//bool ContainsArithmeticOperators(string expression)
|
||||
//{
|
||||
// return expression.Contains('+') || expression.Contains('-') || expression.Contains('*') || expression.Contains('/');
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user