Browse Source

Use AllAssemblies instead of Type.Assembly

pull/17026/head
Halil İbrahim Kalkan 3 years ago
parent
commit
db1609dced
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  2. 20
      framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs
  3. 2
      framework/src/Volo.Abp.Core/Volo/Abp/Reflection/AssemblyFinder.cs
  4. 2
      framework/src/Volo.Abp.Http.Client.Web/Volo/Abp/Http/Client/Web/AbpHttpClientWebModule.cs

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs

@ -233,7 +233,7 @@ public class AbpAspNetCoreMvcModule : AbpModule
.GetRequiredService<IModuleContainer>() .GetRequiredService<IModuleContainer>()
.Modules .Modules
.Where(m => m.IsLoadedAsPlugIn) .Where(m => m.IsLoadedAsPlugIn)
.Select(m => m.Type.Assembly) .SelectMany(m => m.AllAssemblies)
.Distinct(); .Distinct();
AddToApplicationParts(partManager, moduleAssemblies); AddToApplicationParts(partManager, moduleAssemblies);

20
framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs

@ -188,11 +188,13 @@ public abstract class AbpApplicationBase : IAbpApplication
{ {
if (!abpModule.SkipAutoServiceRegistration) if (!abpModule.SkipAutoServiceRegistration)
{ {
var assembly = module.Type.Assembly; foreach (var assembly in module.AllAssemblies)
if (!assemblies.Contains(assembly))
{ {
Services.AddAssembly(assembly); if (!assemblies.Contains(assembly))
assemblies.Add(assembly); {
Services.AddAssembly(assembly);
assemblies.Add(assembly);
}
} }
} }
} }
@ -279,11 +281,13 @@ public abstract class AbpApplicationBase : IAbpApplication
{ {
if (!abpModule.SkipAutoServiceRegistration) if (!abpModule.SkipAutoServiceRegistration)
{ {
var assembly = module.Type.Assembly; foreach (var assembly in module.AllAssemblies)
if (!assemblies.Contains(assembly))
{ {
Services.AddAssembly(assembly); if (!assemblies.Contains(assembly))
assemblies.Add(assembly); {
Services.AddAssembly(assembly);
assemblies.Add(assembly);
}
} }
} }
} }

2
framework/src/Volo.Abp.Core/Volo/Abp/Reflection/AssemblyFinder.cs

@ -29,7 +29,7 @@ public class AssemblyFinder : IAssemblyFinder
foreach (var module in _moduleContainer.Modules) foreach (var module in _moduleContainer.Modules)
{ {
assemblies.Add(module.Type.Assembly); assemblies.AddRange(module.AllAssemblies);
} }
return assemblies.Distinct().ToImmutableList(); return assemblies.Distinct().ToImmutableList();

2
framework/src/Volo.Abp.Http.Client.Web/Volo/Abp/Http/Client/Web/AbpHttpClientWebModule.cs

@ -31,7 +31,7 @@ public class AbpHttpClientWebModule : AbpModule
.ServiceProvider .ServiceProvider
.GetRequiredService<IModuleContainer>() .GetRequiredService<IModuleContainer>()
.Modules .Modules
.Select(m => m.Type.Assembly) .SelectMany(m => m.AllAssemblies)
.Where(a => a.GetTypes().Any(AbpHttpClientProxyHelper.IsClientProxyService)) .Where(a => a.GetTypes().Any(AbpHttpClientProxyHelper.IsClientProxyService))
.Distinct()) .Distinct())
{ {

Loading…
Cancel
Save