Skip to content

Annotations Framework - does this have access to an IHostEnvironment ? #1517

Answered by ashishdhingra
PureKrome asked this question in Q&A
Discussion options

You must be logged in to vote

@PureKrome Good morning. Based on my understanding, the Lambda Annotations framework uses C# source generators to create the translation layer at compile time.

It uses FieldAndConstructor TT template to emit constructor for the generated type, where it includes a statement to invoke the Startup type's (class decorated with LambdaStartupAttribute) ConfigureServices(IServiceCollection) method.

My assumption is that during deployment, you could set the environment variable ASPNETCORE_ENVIRONMENT to appropriate value and should be able to read it in your code.
CC @normj

Thanks,
Ashish

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by PureKrome
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
2 participants