改写了流程依赖管理,封装为一个工具类,将来计划实现动态增加卸载/更新类库的功能

This commit is contained in:
fengjiayi
2024-11-03 21:17:45 +08:00
parent a76091092d
commit e4972c62f2
17 changed files with 700 additions and 337 deletions

View File

@@ -2,6 +2,7 @@
using Serein.Library.Utils;
using System;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Serein.Library
@@ -21,6 +22,13 @@ namespace Serein.Library
[PropertyInfo(IsProtection = true)]
private NodeModelBase _nodeModel;
/// <summary>
/// 对应的程序集
/// </summary>
[PropertyInfo]
private string _assemblyName;
/// <summary>
/// 是否保护参数(目前仅视觉效果参数,不影响运行实现,后续将设置作用在运行逻辑中)
/// </summary>
@@ -188,6 +196,7 @@ namespace Serein.Library
{
throw new ArgumentException("无效的节点类型");
}
AssemblyName = Info.AssemblyName;
MethodName = Info.MethodName;
MethodAnotherName = Info.MethodAnotherName;
MethodDynamicType = nodeType;
@@ -204,6 +213,7 @@ namespace Serein.Library
{
return new MethodDetailsInfo
{
AssemblyName = this.AssemblyName,
MethodName = this.MethodName,
MethodAnotherName = this.MethodAnotherName,
NodeType = this.MethodDynamicType.ToString(),
@@ -222,6 +232,7 @@ namespace Serein.Library
// this => 是元数据
var md = new MethodDetails( nodeModel) // 创建新节点时拷贝实例
{
AssemblyName = this.AssemblyName,
ActingInstance = this.ActingInstance,
ActingInstanceType = this.ActingInstanceType,
MethodDynamicType = this.MethodDynamicType,
@@ -231,8 +242,9 @@ namespace Serein.Library
MethodLockName = this.MethodLockName,
IsProtectionParameter = this.IsProtectionParameter,
ParamsArgIndex = this.ParamsArgIndex,
ParameterDetailss = this.ParameterDetailss?.Select(p => p?.CloneOfModel(nodeModel)).ToArray(), // 拷贝属于节点方法的新入参描述
};
md.ParameterDetailss = this.ParameterDetailss?.Select(p => p?.CloneOfModel(nodeModel)).ToArray(); // 拷贝属于节点方法的新入参描述
return md;
}

View File

@@ -52,6 +52,7 @@ namespace Serein.Library
return new NodeInfo
{
Guid = Guid,
AssemblyName = MethodDetails.AssemblyName,
MethodName = MethodDetails?.MethodName,
Label = MethodDetails?.MethodAnotherName,
Type = this.GetType().ToString(),
@@ -316,7 +317,7 @@ namespace Serein.Library
{
throw new Exception($"节点{this.Guid}不存在方法信息请检查是否需要重写节点的ExecutingAsync");
}
if (!context.Env.TryGetDelegateDetails(md.MethodName, out var dd))
if (!context.Env.TryGetDelegateDetails(md.AssemblyName, md.MethodName, out var dd))
{
throw new Exception($"节点{this.Guid}不存在对应委托");
}

View File

@@ -61,7 +61,7 @@ namespace Serein.Library
/// 依赖的DLL
/// </summary>
public Library[] Librarys { get; set; }
public NodeLibraryInfo[] Librarys { get; set; }
/// <summary>
/// 起始节点GUID
@@ -132,38 +132,63 @@ namespace Serein.Library
/// <summary>
/// 项目依赖的程序集,项目文件相关
/// </summary>
public class Library
/// <summary>
public class NodeLibraryInfo
{
/// <summary>
/// 文件名
/// 文件名
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 文件路径
/// 路径
/// </summary>
public string FilePath { get; set; }
/// <summary>
/// 程序集名称
/// 所属的程序集名称
/// </summary>
public string AssemblyName { get; set; }
}
#region
/*public class LibraryInfo
{
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 文件路径
/// </summary>
public string FilePath { get; set; }
/// <summary>
/// 程序集名称
/// </summary>
public string AssemblyName { get; set; }
}*/
#endregion
/// <summary>
/// 节点信息,项目文件相关
/// </summary>
public class NodeInfo
{
/// <summary>
/// GUID
/// 节点的GUID
/// </summary>
public string Guid { get; set; }
/// <summary>
/// 名称
/// 节点方法所属的程序集名称
/// </summary>
public string AssemblyName { get;set; }
/// <summary>
/// 节点对应的名称
/// </summary>
public string MethodName { get; set; }