Skip to content

Commit

Permalink
Fix duplicate registration module
Browse files Browse the repository at this point in the history
Fix duplicate registration module
  • Loading branch information
fanliang11 authored Apr 26, 2024
1 parent 49a309d commit 65b2573
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,16 +654,19 @@ public static IServiceBuilder RegisterModules(this IServiceBuilder builder, para
{
GetAbstractModules(moduleAssembly).ForEach(p =>
{
services.RegisterModule(p);
if (packages.ContainsKey(p.TypeName))
{
var useModules = packages[p.TypeName];
if (useModules.AsSpan().IndexOf(p.ModuleName) >= 0)
p.Enable = true;
else
p.Enable = false;
}
_modules.Add(p);
if (!_modules.Any(m => p.ModuleName == m.ModuleName))
{
services.RegisterModule(p);
if (packages.ContainsKey(p.TypeName))
{
var useModules = packages[p.TypeName];
if (useModules.AsSpan().IndexOf(p.ModuleName) >= 0)
p.Enable = true;
else
p.Enable = false;
}
_modules.Add(p);
}
});
}
builder.Services.Register(provider => new ModuleProvider(
Expand Down

0 comments on commit 65b2573

Please sign in to comment.