Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActivatorUtilities.CreateInstance无效 #254

Open
niyeshiw opened this issue Mar 9, 2021 · 1 comment
Open

ActivatorUtilities.CreateInstance无效 #254

niyeshiw opened this issue Mar 9, 2021 · 1 comment
Assignees
Labels

Comments

@niyeshiw
Copy link

niyeshiw commented Mar 9, 2021

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

@liuhaoyang
Copy link
Member

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

@liuhaoyang liuhaoyang self-assigned this Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants