@@ -13,27 +13,21 @@ public static class AppDefinitionExtensions
1313 /// <remarks>
1414 /// When executing on development environment there are more diagnostic information available on console.
1515 /// </remarks>
16- /// <param name="source"></param>
1716 /// <param name="builder"></param>
1817 /// <param name="entryPointsAssembly"></param>
19- public static void AddDefinitions ( this IServiceCollection source , WebApplicationBuilder builder , params Type [ ] entryPointsAssembly )
18+ public static void AddDefinitions ( this WebApplicationBuilder builder , params Type [ ] entryPointsAssembly )
2019 {
21- var logger = source . BuildServiceProvider ( ) . GetRequiredService < ILogger < AppDefinition > > ( ) ;
20+ var logger = builder . Services . BuildServiceProvider ( ) . GetRequiredService < ILogger < AppDefinition > > ( ) ;
2221 var definitions = new List < IAppDefinition > ( ) ;
23- var appDefinitionInfo = source . BuildServiceProvider ( ) . GetService < AppDefinitionCollection > ( ) ;
22+ var appDefinitionInfo = builder . Services . BuildServiceProvider ( ) . GetService < AppDefinitionCollection > ( ) ;
2423 var info = appDefinitionInfo ?? new AppDefinitionCollection ( ) ;
2524
2625 foreach ( var entryPoint in entryPointsAssembly )
2726 {
2827 info . AddEntryPoint ( entryPoint . Name ) ;
2928
30-
3129 var types = entryPoint . Assembly . ExportedTypes . Where ( x => ! x . IsAbstract && typeof ( IAppDefinition ) . IsAssignableFrom ( x ) ) ;
3230 var instances = types . Select ( Activator . CreateInstance ) . Cast < IAppDefinition > ( ) . ToList ( ) ;
33- //if (logger.IsEnabled(LogLevel.Debug))
34- //{
35- // logger.LogDebug("AppDefinitions Founded: {@AppDefinitionsCountTotal}.", instances.Count);
36- //}
3731
3832 foreach ( var definition in instances )
3933 {
@@ -46,7 +40,7 @@ public static void AddDefinitions(this IServiceCollection source, WebApplication
4640
4741 foreach ( var definition in definitions )
4842 {
49- definition . ConfigureServices ( source , builder ) ;
43+ definition . ConfigureServices ( builder ) ;
5044 }
5145 if ( logger . IsEnabled ( LogLevel . Debug ) )
5246 {
@@ -59,7 +53,7 @@ public static void AddDefinitions(this IServiceCollection source, WebApplication
5953 }
6054 }
6155
62- source . AddSingleton ( info ) ;
56+ builder . Services . AddSingleton ( info ) ;
6357 }
6458
6559 /// <summary>
0 commit comments