Skip to content

Commit

Permalink
fix(app): new we don't know if host already built or not
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicGD committed Dec 6, 2023
1 parent f7b164a commit 0910679
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/Sitko.Core.App/SitkoCoreApplicationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,11 @@ public SitkoCoreApplicationBuilder AddModule<TModule, TModuleOptions>(
public bool HasModule<TModule>() where TModule : IApplicationModule =>
moduleRegistrations.Any(r => r.Type == typeof(TModule));

private bool CanAddModule() => moduleRegistrations.Count < 100500; // TODO: still needed?

private void RegisterModule<TModule, TModuleOptions>(
Action<IApplicationContext, TModuleOptions>? configureOptions = null,
string? optionsKey = null)
where TModule : IApplicationModule<TModuleOptions>, new() where TModuleOptions : BaseModuleOptions, new()
{
if (!CanAddModule())
{
throw new InvalidOperationException("App host is already built. Can't add modules after it");
}

var instance = new TModule();
if (!instance.AllowMultiple && HasModule<TModule>())
{
Expand Down

0 comments on commit 0910679

Please sign in to comment.