Gor*_*vic 4 c# clr performance system.reflection .net-assembly
我正在开发一个组件,它执行使用ioc注册的任何接口的临时方法,执行时刻取决于不同的触发器.它必须能够保存要对数据库执行的操作,因此我将方法名称,类型和参数列表(序列化为BLOB)保存到数据库中,直到需要为止.
当触发发生时,我需要在类型的实例上执行方法.因为我正在使用依赖注入,我将接口名称保存到数据库中(格式"Namespace.IInterface, AssemblyName")
要Resolve<IInterface>()在ioc容器上运行方法,我需要它的实例Type:
Assembly assembly = System.Reflection.Assembly.Load(assemblyName);
Type service = assembly.GetType(typeName);
object instance = IOCContainer.Resolve(service);
Run Code Online (Sandbox Code Playgroud)
我的问题是:
Type.Load(typeName)但得到了null)