dotnetcore/AspectCore-Framework

ActivatorUtilities.CreateInstance无效

niyeshiw opened this issue · 1 comments

我有一个场景需要从DI容器里解析类,类的构造函数需要传入运行时的实例参数,所以需要用到ActivatorUtilities.CreateInstance
但是ActivatorUtilities.CreateInstance创建出来的类不是代理类,传入的ServiceProvider是AspectCore的ServiceProvider,应该是不支持以这种方式创建,有什么代替的类吗?
因为想享受IOC带来的生命周期,所以也不能使用IProxyGenerator完成此功能

暂时没有办法,我考虑添加一个类似 ActivatorUtilities.CreateProxyInstance 的 API 吧