File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1111
1212var app = ConsoleApp . Create ( args ) ;
1313
14+ var a = app . Services ;
15+ var b = app . Configuration ;
16+ var c = app . Environment ;
17+ var d = app . Lifetime ;
18+ var e = app . Logger ;
19+
1420app . AddSubCommands < FooBarBaz > ( ) ;
1521
1622//app.AddAllCommandType();
Original file line number Diff line number Diff line change 1- using Microsoft . Extensions . DependencyInjection ;
1+ using Microsoft . Extensions . Configuration ;
2+ using Microsoft . Extensions . DependencyInjection ;
23using Microsoft . Extensions . Hosting ;
34using Microsoft . Extensions . Logging ;
45using System ;
@@ -18,6 +19,10 @@ public class ConsoleApp
1819
1920 public IHost Host { get ; }
2021 public ILogger < ConsoleApp > Logger { get ; }
22+ public IServiceProvider Services => Host . Services ;
23+ public IConfiguration Configuration => Host . Services . GetRequiredService < IConfiguration > ( ) ;
24+ public IHostEnvironment Environment => Host . Services . GetRequiredService < IHostEnvironment > ( ) ;
25+ public IHostApplicationLifetime Lifetime => Host . Services . GetRequiredService < IHostApplicationLifetime > ( ) ;
2126
2227 internal ConsoleApp ( IHost host )
2328 {
You can’t perform that action at this time.
0 commit comments