Skip to content

Amazon.Lambda.Annotations How to use ILambdaContext in dependecy injection container? #1535

Answered by normj
Breno709 asked this question in Q&A
Discussion options

You must be logged in to vote

You are correct we are manually injected ILambdaContext for the method. We could add it to the DI container as well if we see the user is using DI. My worry though is this is DI resolution for services at the constructor for the type with the method would fail. There is no ILambdaContext at the point the constructor is called. It would only be good for services using the FromService attribute on parameters of the LambdaFunction. Is that what you would expect to happen? Given those constraints would you still use it?

@github-actions proposed-answer

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@ashishdhingra
Comment options

@zaus
Comment options

@cliff-wakefield-acurus
Comment options

Answer selected by ashishdhingra
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
attention Discussion needs attention
5 participants