-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
无法在ICommand使用依赖注入服务 #732
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在net7中,我在ConfigureServices中注册了服务:
services.AddSingleton<IService, MyService>();
然后使用服务:
`public class MyCommand : ICommand
{
private readonly IService _service;
}`
但是IService 实例化失败了,显示无法找到。 但是我如果重新定义一个普通的类,在构造函数里面进行IService 注入是可以的,这是什么原因?
The text was updated successfully, but these errors were encountered: