mirror of https://github.com/abpframework/abp.git
5 changed files with 51 additions and 45 deletions
Binary file not shown.
@ -1,43 +0,0 @@ |
|||
using System; |
|||
using System.Reflection; |
|||
|
|||
namespace Microsoft.Extensions.DependencyInjection |
|||
{ |
|||
public static class ServiceCollectionRegistrationExtensions |
|||
{ |
|||
public static IServiceCollection AddAssemblyOf<T>(this IServiceCollection services) |
|||
{ |
|||
return services.AddAssembly(typeof(T).GetTypeInfo().Assembly); |
|||
} |
|||
|
|||
public static IServiceCollection AddAssembly(this IServiceCollection services, Assembly assembly) |
|||
{ |
|||
foreach (var registrar in services.GetConventionalRegistrars()) |
|||
{ |
|||
registrar.AddAssembly(services, assembly); |
|||
} |
|||
|
|||
return services; |
|||
} |
|||
|
|||
public static IServiceCollection AddTypes(this IServiceCollection services, params Type[] types) |
|||
{ |
|||
foreach (var registrar in services.GetConventionalRegistrars()) |
|||
{ |
|||
registrar.AddTypes(services, types); |
|||
} |
|||
|
|||
return services; |
|||
} |
|||
|
|||
public static IServiceCollection AddType(this IServiceCollection services, Type type) |
|||
{ |
|||
foreach (var registrar in services.GetConventionalRegistrars()) |
|||
{ |
|||
registrar.AddType(services, type); |
|||
} |
|||
|
|||
return services; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using System.Reflection; |
|||
|
|||
namespace System |
|||
{ |
|||
public static class TypeExtensions |
|||
{ |
|||
public static Assembly GetAssembly(this Type type) |
|||
{ |
|||
return type.GetTypeInfo().Assembly; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue