Amazon.Lambda.Annotations: allow an alternate IServiceProvider implementation #1729
Labels
annotations
feature-request
A feature should be added or improved.
p2
This is a standard priority issue
queued
Describe the feature
Provide a way of using an inversion of control container other than the default Microsoft.Extensions.DependencyInjection.
Use Case
I would like to be able to use Autofac with Amazon.Lambda.Annotations.
Proposed Solution
A formal api around a Startup class would work, but it looks like a small tweak to the generated code may be sufficient to hook in an alternate IServiceProvider.
The serviceProvider is currently stored in a field defined like this:
private readonly ServiceProvider serviceProvider;
The field is using the concrete type ServiceProvider. If the field type were changed to IServiceProvider that would allow a different IServiceProvider to be used by implementing a BuildServiceProvider extension method in the Lambda project.
Other Information
No response
Acknowledgements
AWS .NET SDK and/or Package version used
Amazon.Lambda.Annotations 1.3.0
Targeted .NET Platform
.Net 8
Operating System and version
AmazonLinux
The text was updated successfully, but these errors were encountered: