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
Autowiring properties in base classes not working in .net Core 2 #869
Comments
Did you add controllers as services? |
I have just tried that and it has made no difference. It is worth mentioning that I have tried this on other class that is not a controller, registered in the following way in the startup:
and the property on that is still null also |
Have you asked this on StackOverflow? If not, that may be a better option as noted in the issue template. There are only two project maintainers for all of Autofac and the integration libraries so time is pretty limited to go back and forth on troubleshooting individual issues. If you've asked there, please link back to the question here. If not, give it a shot and link the question in here. Either way, we'll need to see the app setup with ConfigureServices and all registrations. So far there's not enough info to figure out the issue. |
I've raised the question on StackOverflow. The ConfigureServices is below:
|
Awesome. We can follow up on the question, then, and folks coming in with similar questions or answers can see the complete thing there. If it turns out there's a bug, we can file something on the appropriate repo - this one for core Autofac, Autofac.Extensions.DependencyInjection for the adapter. Thanks! |
Everything is working as expected.
|
in aspnetcore 2.2.it is not work |
I have a .Net Core 2 app and an API controller class which inherits from an abstract base class:
On the base controller I have:
In my StartUp.cs I have:
However, the CommandProcessor property is always null. I have tried moving it to the derived class and tried registering the type directly as follows:
and the also the base class:
I have tried what is suggested here and here amongst other posts but nothing seems to work, which makes me think that it is an issue in .Net Core 2.
When I inject the ICommandProcessor into the controller constructer it is wired up fine.
Any ideas?
The text was updated successfully, but these errors were encountered: