Skip to content

Commit

Permalink
Moved the module container configuration out of the application loade…
Browse files Browse the repository at this point in the history
…r. (#59)
  • Loading branch information
mgernand authored Apr 26, 2024
1 parent 2f48f1d commit 6db8126
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 0 additions & 7 deletions src/Fluxera.Extensions.Hosting/ApplicationLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,8 @@ public ApplicationLoader(
this.PluginSources = pluginSources;
this.Modules = modules;

// Configure the module container.
services.AddSingleton<IModuleContainer>(this);
services.AddObjectAccessor<IModuleContainer>(this, ObjectAccessorLifetime.ConfigureServices);

// Configure the services of the modules.
modules.ConfigureServices(services);

// Configure the application loader.
services.AddSingleton<IApplicationLoader>(this);
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ public static IServiceCollection AddApplicationLoader<TStartupModule>(this IServ
// Build the application.
IModularApplicationBuilder applicationBuilder = new ModularApplicationBuilder(typeof(TStartupModule), services);
configurePlugins?.Invoke(new PluginConfigurationContext(services, applicationBuilder.PluginSources));
applicationBuilder.Build(applicationLoaderFactory);
IApplicationLoader applicationLoader = applicationBuilder.Build(applicationLoaderFactory);

// Add the module container.
services.AddSingleton<IModuleContainer>(applicationLoader);
services.AddObjectAccessor<IModuleContainer>(applicationLoader, ObjectAccessorLifetime.ConfigureServices);

// Add the application loader.
services.AddSingleton(applicationLoader);

return services;
}
Expand Down

0 comments on commit 6db8126

Please sign in to comment.