Replies: 1 comment 4 replies
-
Where is the attribute consumed? I would expect the attribute to only hold the input |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I created an MVC application using .Net core. Then I created a custom Attribute should read some settings from appsettings.json. Here a working solution:
It works, but I do not think it is the correct solution. I try to explain why.
In the Program.cs, beforse the host is builded, the startup class is instantiated:
If I inject the IConfiguration to the stratup, I can get the appsettings.json values.
I think that from now, I have the appsettings.json and conseguently the configuration in memory.
So it seems really strange to me that in my custom attribute I must read the setting from the file again! The question is: How can I read the in-memory configuration inside my custom attribute? Is my consideration correct?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions