command-line-api
command-line-api copied to clipboard
Extend IHostBuilder configuration based on command
It is currently not possible to configure the IHostBuilder depended on the executed command.
I could not find an elegant pattern to register some IHostedService based on the command.
IHost is managing the registered IHostedService's
Example:
my-cli get something //no background service required and registered
my-cli serve //IHostedService should be registered
+1 It would be very useful! at this moment it is really PITA. I'm needed to configure app dbcontext and other services based on CommandLine inputs, and I got really struggled with that