更新了代码生成器的生成逻辑。

修复了Emit对于集合类型创建委托时,类型指定Bug。
This commit is contained in:
fengjiayi
2025-07-29 14:51:14 +08:00
parent 77160feaeb
commit b6ed0b69dc
6 changed files with 62 additions and 41 deletions

View File

@@ -154,13 +154,13 @@ namespace Serein.Library
{
if (emitType == EmitType.CollectionSetter)
{
emitType = EmitType.CollectionSetter;
this.emitType = EmitType.CollectionSetter;
collectionSetter = EmitHelper.CreateCollectionSetter(type);
}
else if (emitType == EmitType.CollectionGetter)
{
emitType = EmitType.CollectionGetter;
this.emitType = EmitType.CollectionGetter;
collectionGetter = EmitHelper.CreateCollectionGetter(type);
}
else

View File

@@ -1,6 +1,7 @@
using Serein.Library.Api;
using Serein.Library.Utils;
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Threading;
@@ -145,6 +146,8 @@ namespace Serein.Library
this.Name = pdInfo.ArgName;
}
/// <summary>
/// 通过参数信息加载实体,用于加载项目文件、远程连接的场景
/// </summary>
@@ -160,6 +163,15 @@ namespace Serein.Library
IsParams = info.IsParams;
}
partial void OnIsExplicitDataChanged(bool oldValue, bool newValue)
{
if(DataType == typeof(IFlowContext))
{
}
}
/// <summary>
/// 转为描述
/// </summary>
@@ -209,9 +221,9 @@ namespace Serein.Library
return data;
// 2. 特定快捷类型
if (typeof(IFlowEnvironment).IsAssignableFrom(DataType)) return NodeModel.Env;
if (typeof(IFlowContext).IsAssignableFrom(DataType)) return context;
if (typeof(IFlowNode).IsAssignableFrom(DataType)) return NodeModel;
//if (typeof(IFlowEnvironment).IsAssignableFrom(DataType)) return NodeModel.Env;
//if (typeof(IFlowNode).IsAssignableFrom(DataType)) return NodeModel;
// 3. 显式常量参数
if (IsExplicitData && !DataValue.StartsWith("@", StringComparison.OrdinalIgnoreCase))
@@ -224,7 +236,15 @@ namespace Serein.Library
if (ArgDataSourceType == ConnectionArgSourceType.GetPreviousNodeData)
{
var prevNodeGuid = context.GetPreviousNode(NodeModel.Guid);
inputParameter = prevNodeGuid != null ? context.GetFlowData(prevNodeGuid)?.Value : null;
if(prevNodeGuid is null)
{
inputParameter = null;
}
else
{
var prevNodeData = context.GetFlowData(prevNodeGuid);
inputParameter = prevNodeData.Value;
}
}
else
{