11using Microsoft . Extensions . Configuration ;
22using Microsoft . Extensions . DependencyInjection ;
3+ using ModularPipelines ;
34using ModularPipelines . Examples ;
45using ModularPipelines . Examples . Modules ;
56using ModularPipelines . Extensions ;
6- using ModularPipelines . Host ;
77using ModularPipelines . Options ;
88
9- await PipelineHostBuilder . Create ( )
10- . ConfigureAppConfiguration ( ( context , builder ) =>
11- {
12- builder . AddJsonFile ( "appsettings.json" , optional : false )
13- . AddJsonFile ( $ "appsettings.{ context . HostingEnvironment . EnvironmentName } .json", optional : true )
14- . AddUserSecrets < Program > ( )
15- . AddCommandLine ( args )
16- . AddEnvironmentVariables ( ) ;
17- } )
18- . ConfigurePipelineOptions ( ( _ , options ) =>
19- {
20- options . ExecutionMode = ExecutionMode . StopOnFirstException ;
21- options . IgnoreCategories = new [ ] { "Ignore" } ;
22- } )
23- . ConfigureServices ( ( context , collection ) =>
24- {
25- collection . Configure < MyOptions > ( context . Configuration ) ;
9+ var builder = Pipeline . CreateBuilder ( args ) ;
2610
27- collection . AddModule < SuccessModule > ( )
28- . AddModule < LogSecretModule > ( )
29- . AddModule < DependentOnSuccessModule > ( )
30- . AddModule < DependentOn2 > ( )
31- . AddModule < DependentOn3 > ( )
32- . AddModule < DependentOn4 > ( )
33- . AddModule < SubmodulesModule > ( )
34- . AddModule < GitVersionModule > ( )
35- . AddModule < GitLastCommitModule > ( ) ;
36- } )
37- . ExecutePipelineAsync ( ) ;
11+ builder . Configuration
12+ . AddJsonFile ( "appsettings.json" , optional : false )
13+ . AddJsonFile ( $ "appsettings.{ builder . Environment . EnvironmentName } .json", optional : true )
14+ . AddUserSecrets < Program > ( )
15+ . AddEnvironmentVariables ( ) ;
16+
17+ builder . Options . ExecutionMode = ExecutionMode . StopOnFirstException ;
18+ builder . Options . IgnoreCategories = [ "Ignore" ] ;
19+
20+ builder . Services . Configure < MyOptions > ( builder . Configuration ) ;
21+
22+ builder . Services
23+ . AddModule < SuccessModule > ( )
24+ . AddModule < LogSecretModule > ( )
25+ . AddModule < DependentOnSuccessModule > ( )
26+ . AddModule < DependentOn2 > ( )
27+ . AddModule < DependentOn3 > ( )
28+ . AddModule < DependentOn4 > ( )
29+ . AddModule < SubmodulesModule > ( )
30+ . AddModule < GitVersionModule > ( )
31+ . AddModule < GitLastCommitModule > ( ) ;
32+
33+ await builder . Build ( ) . RunAsync ( ) ;
0 commit comments