Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

CommandLineConfigurationProvider

$
0
0

I am using generic host for a console app (not a daemon style service, just a shortlived app) by .AddHostedService() (I guess I can use a transient or singleton, but I don't know how to instantiate it).

Construction Injection of  IOptions<MyConfigClass>, ILogger<MyServiceClass> etc. works fine for json provider.
however, I would (preferably) like to use CommandLine provider for setting one of the properties of the T object from args array, but don't understand how to do this.

Alternatively I would like to inject one string out of args directly, but don't know how to this either.

Someone hint me?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>