IOC容器添加构造函数注入(DLL类中使用AutoRegisterAttribute特性标注的类,会在流程启动时自动注册),提高可读性。

This commit is contained in:
fengjiayi
2024-09-30 02:45:49 +08:00
parent 7a310ff1df
commit ccf539b90f
23 changed files with 615 additions and 280 deletions

View File

@@ -200,8 +200,12 @@ namespace Serein.NodeFlow.Base
#endregion
MethodDetails md = MethodDetails;
var del = md.MethodDelegate.Clone();
md.ActingInstance ??= context.Env.IOC.GetOrRegisterInstantiate(MethodDetails.ActingInstanceType);
//var del = md.MethodDelegate.Clone();
if (!context.Env.TryGetDelegate(md.MethodName, out var del))
{
throw new Exception("不存在对应委托");
}
md.ActingInstance ??= context.Env.IOC.Get(MethodDetails.ActingInstanceType);
object instance = md.ActingInstance;
var haveParameter = md.ExplicitDatas.Length > 0;