You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the [https://github.com/spectreconsole/spectre.console/tree/main/examples/Cli/Injection](dependency injection) sample, I am registering various services.
However, the Foobar service's constructor requires an IOptions<FoobarOptions>.
I would therefore need to configure through the IServiceCollection the options, however I cannot since the command settings are not yet availabe.
What is the proper way to go about this? If there could be a way to parse command settings ahead of time, before running the CommandApp that would be great.
To me this sounds like a common scenario, however I cannot figure out a way to do it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I am in a bit of a catch-22 here.
Based on the [https://github.com/spectreconsole/spectre.console/tree/main/examples/Cli/Injection](dependency injection) sample, I am registering various services.
eg:
The
FooCommand
constructor requires an instance ofIFoobar
.However, the
Foobar
service's constructor requires anIOptions<FoobarOptions>
.I would therefore need to configure through the
IServiceCollection
the options, however I cannot since the command settings are not yet availabe.What is the proper way to go about this? If there could be a way to parse command settings ahead of time, before running the
CommandApp
that would be great.To me this sounds like a common scenario, however I cannot figure out a way to do it.
Any help would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions