-
I can use [LambdaFunction(MemorySize = 512, Timeout = 55)]
[HttpApi(LambdaHttpMethod.Get, "/add/{x}/{y}")]
public int Add(int x, int y, ILambdaContext context)
{
context.Logger.LogInformation($"{x} plus {y} is {x + y}");
return x + y;
} but I would like to inject it in others services through DI container, since I'm using depency injection. But I didn't realize how to achieve this goal. I can't find a way to register |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
You are correct we are manually injected @github-actions proposed-answer |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
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 noILambdaContext
at the point the constructor is called. It would only be good for services using theFromService
attribute on parameters of theLambdaFunction
. Is that what you would expect to happen? Given those constraints would you still use it?@github-actions proposed-answer