mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-06 08:06:33 +08:00
准备修改运行环境中类库的依赖结构
This commit is contained in:
@@ -138,15 +138,15 @@ namespace Serein.Library.Api
|
||||
|
||||
public class LoadDllEventArgs : FlowEventArgs
|
||||
{
|
||||
public LoadDllEventArgs(NodeLibrary nodeLibrary, List<MethodDetailsInfo> MethodDetailss)
|
||||
public LoadDllEventArgs(NodeLibraryInfo nodeLibraryInfo, List<MethodDetailsInfo> MethodDetailss)
|
||||
{
|
||||
this.NodeLibrary = nodeLibrary;
|
||||
this.NodeLibraryInfo = nodeLibraryInfo;
|
||||
this.MethodDetailss = MethodDetailss;
|
||||
}
|
||||
/// <summary>
|
||||
/// 已加载了的程序集
|
||||
/// </summary>
|
||||
public NodeLibrary NodeLibrary { get; protected set; }
|
||||
public NodeLibraryInfo NodeLibraryInfo { get; protected set; }
|
||||
/// <summary>
|
||||
/// dll文件中有效的流程方法描述
|
||||
/// </summary>
|
||||
@@ -676,8 +676,8 @@ namespace Serein.Library.Api
|
||||
/// <summary>
|
||||
/// 移除DLL
|
||||
/// </summary>
|
||||
/// <param name="assemblyFullName">程序集的名称</param>
|
||||
bool RemoteDll(string assemblyFullName);
|
||||
/// <param name="assemblyName">程序集的名称</param>
|
||||
bool RemoteDll(string assemblyName);
|
||||
|
||||
/// <summary>
|
||||
/// 清理加载的DLL(待更改)
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Serein.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// 节点DLL依赖类,如果一个项目中引入了多个DLL,需要放置在同一个文件夹中
|
||||
/// </summary>
|
||||
public class NodeLibrary
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件名
|
||||
/// </summary>
|
||||
public string FileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 路径
|
||||
/// </summary>
|
||||
public string FilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 依赖类的名称
|
||||
/// </summary>
|
||||
public string FullName{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对应的程序集
|
||||
/// </summary>
|
||||
public Assembly Assembly { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
108
Library/Entity/NodeLibraryInfo.cs
Normal file
108
Library/Entity/NodeLibraryInfo.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Serein.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// 节点DLL依赖类,如果一个项目中引入了多个DLL,需要放置在同一个文件夹中
|
||||
/// </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; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class FlowLibrary
|
||||
{
|
||||
public FlowLibrary(string assemblyName,
|
||||
Action actionOfUnloadAssmbly)
|
||||
{
|
||||
this.AssemblyName = assemblyName;
|
||||
this.actionOfUnloadAssmbly = actionOfUnloadAssmbly;
|
||||
}
|
||||
|
||||
public string AssemblyName { get; }
|
||||
|
||||
//public string AssemblyVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 加载程序集时创建的方法描述
|
||||
/// </summary>
|
||||
public ConcurrentDictionary<string, MethodDetails> MethodDetailss { get; } = new ConcurrentDictionary<string, MethodDetails>();
|
||||
|
||||
/// <summary>
|
||||
/// 管理通过Emit动态构建的委托
|
||||
/// </summary>
|
||||
public ConcurrentDictionary<string, DelegateDetails> DelegateDetailss { get; } = new ConcurrentDictionary<string, DelegateDetails>();
|
||||
|
||||
/// <summary>
|
||||
/// 记录不同的注册时机需要自动创建全局唯一实例的类型信息
|
||||
/// </summary>
|
||||
public ConcurrentDictionary<RegisterSequence, Type[]> RegisterTypes { get; } = new ConcurrentDictionary<RegisterSequence, Type[]>();
|
||||
|
||||
|
||||
private readonly Action actionOfUnloadAssmbly;
|
||||
|
||||
/// <summary>
|
||||
/// 卸载当前程序集以及附带的所有信息
|
||||
/// </summary>
|
||||
public void Upload()
|
||||
{
|
||||
actionOfUnloadAssmbly?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 通过方法名称获取对应的Emit委托(元数据),用于动态调用节点对应的方法
|
||||
/// </summary>
|
||||
/// <param name="methodName">方法名称</param>
|
||||
/// <param name="dd">Emit委托</param>
|
||||
/// <returns></returns>
|
||||
public bool GetDelegateDetails(string methodName, out DelegateDetails dd)
|
||||
{
|
||||
return DelegateDetailss.TryGetValue(methodName, out dd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过方法名称获取对应的方法描述(元数据),用于创建节点时,节点实例需要的方法描述
|
||||
/// </summary>
|
||||
/// <param name="methodName">方法名称</param>
|
||||
/// <param name="md">方法描述</param>
|
||||
/// <returns></returns>
|
||||
public bool GetMethodDetails(string methodName, out MethodDetails md)
|
||||
{
|
||||
return MethodDetailss.TryGetValue(methodName, out md);
|
||||
}
|
||||
|
||||
public NodeLibraryInfo ToInfo()
|
||||
{
|
||||
return new NodeLibraryInfo
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -129,7 +129,7 @@ namespace Serein.Library
|
||||
&& index < ParameterDetailss.Length) // 防止下标越界
|
||||
{
|
||||
ParameterDetailss[index] = null; // 释放对象引用
|
||||
var tmp = ArrayHelper.RemoteToArray(ParameterDetailss, index); // 新增;
|
||||
var tmp = ArrayHelper.RemoteToArray<ParameterDetails>(ParameterDetailss, index); // 新增;
|
||||
UpdateParamIndex(ref tmp);
|
||||
ParameterDetailss = tmp; // 新增
|
||||
return true;
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace Serein.Library
|
||||
public class MethodDetailsInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 属于哪个DLL文件
|
||||
/// 属于哪个程序集
|
||||
/// </summary>
|
||||
public string LibraryName { get; set; }
|
||||
public string AssemblyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 方法名称
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace Serein.Library
|
||||
public class LibraryMds
|
||||
{
|
||||
/// <summary>
|
||||
/// 程序集FullName
|
||||
/// 程序集名称
|
||||
/// </summary>
|
||||
public string LibraryName { get; set; }
|
||||
public string AssemblyName { get; set; }
|
||||
/// <summary>
|
||||
/// 相关的方法详情
|
||||
/// </summary>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>1.0.19</Version>
|
||||
<TargetFrameworks>net8.0;net462</TargetFrameworks>
|
||||
<!--<TargetFrameworks>net8.0</TargetFrameworks>-->
|
||||
<TargetFrameworks>net8.0;net462</TargetFrameworks>
|
||||
<BaseOutputPath>D:\Project\C#\DynamicControl\SereinFlow\.Output</BaseOutputPath>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Title>SereinFow</Title>
|
||||
@@ -37,8 +37,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<ProjectReference Include="..\Serein.Library.MyGenerator\Serein.Library.NodeGenerator.csproj" OutputItemType="Analyzer" />
|
||||
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.Reactive" Version="6.0.1" />
|
||||
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
|
||||
@@ -60,4 +58,8 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Serein.Library.MyGenerator\Serein.Library.NodeGenerator.csproj " OutputItemType="Analyzer" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user