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

Autofac with Azure Functions with IWebJobsBuilder for constructor DI #42

Closed
prabhug143 opened this issue Aug 27, 2019 · 3 comments
Closed
Labels

Comments

@prabhug143
Copy link

We are trying Dependency Injection with Autofac to our Azure Functions. We have a startup class [assembly: WebJobsStartup(typeof(Startup))] which calls the ConfigureServices. The out-of-the-box dependency injection with .net core works fine, but we are trying Dependency Injection with Autofac and we are unable to inject our service classes into Azure Function constructor.
When we try to Resolve the dependencies using "Resolve" keyword of IContainer from Autofac, I'm able to resolve the service. Any help in this regard would be highly appreciated.

@rawrspace
Copy link
Member

Are you using the Azure Functions Autofac NuGet package or are you trying to use Autofac with native DI? Can you share a sample project?

@prabhug143
Copy link
Author

Thank you for your reply. I'm using Autofac Nuget package.
Just to be more clear, I'm NOT using "AzureFunctions.Autofac", I'm only using "Autofac".
I do not have static function class and static function method, I have a function class with Constructor to which I'm trying to inject the services.

@rawrspace
Copy link
Member

This is the repo for AzureFunctions.Autofac. Since you have stated that you are not using this package the issue is not with this package. Please open an issue on the official Autofac repository or stack overflow for help.

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