Skip to content
Permalink
Browse files

Fix self entry assembly to service loads

  • Loading branch information...
farajfarook committed Aug 24, 2019
1 parent 8886254 commit d2fb5acca071d142b243b585cc2c96c9f26fc71b
Showing with 8 additions and 4 deletions.
  1. +1 −1 .travis.yml
  2. +7 −3 Enbiso.NLib.DependencyInjection/ServiceExtensions.cs
@@ -1,6 +1,6 @@
env:
global:
- PACKAGE_VERSION="1.2.3"
- PACKAGE_VERSION="1.2.4"
- PACKAGE_ICON="https://www.enbiso.com/logo.svg"
- PACKAGE_PROJECT="https://nlib.enbiso.com"
- PACKAGE_REPO="https://github.com/enbiso/Enbiso.NLib"
@@ -9,7 +9,9 @@ namespace Enbiso.NLib.DependencyInjection
public static class ServiceExtensions
{
public static IServiceCollection AddServices(this IServiceCollection services, params Type[] typeReferences)
=> services.AddServices(typeReferences.Select(t => t.Assembly).ToArray());
{
return services.AddServices(typeReferences.Select(t => t.Assembly).ToArray());
}

public static IServiceCollection AddServices(this IServiceCollection services, params Assembly[] assemblies)
{
@@ -19,8 +21,10 @@ public static IServiceCollection AddServices(this IServiceCollection services, p

public static IServiceCollection AddServices(this IServiceCollection services)
{
var assemblies = Assembly.GetEntryAssembly().GetReferencedAssemblies().Select(Assembly.Load).ToArray();
return services.AddServices(assemblies);
var entry = Assembly.GetEntryAssembly();
var assemblies = entry.GetReferencedAssemblies().Select(Assembly.Load).ToList();
assemblies.Add(entry);
return services.AddServices(assemblies.ToArray());
}

private static void AddServicesForAssembly(this IServiceCollection services, Assembly assembly)

0 comments on commit d2fb5ac

Please sign in to comment.
You can’t perform that action at this time.