From b7c2493a0ba210701a2ee46663369a722e1bec2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 2 May 2017 21:24:18 +0300 Subject: [PATCH] Refactored. --- src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll | Bin 16896 -> 16896 bytes ...ServiceCollectionApplicationExtensions.cs} | 2 +- ...ctionConventionalRegistrationExtensions.cs | 39 +++++++++++++++- ...ServiceCollectionRegistrationExtensions.cs | 43 ------------------ src/Volo.Abp/System/TypeExtensions.cs | 12 +++++ 5 files changed, 51 insertions(+), 45 deletions(-) rename src/Volo.Abp/Microsoft/Extensions/DependencyInjection/{ServiceCollectionAbpExtensions.cs => ServiceCollectionApplicationExtensions.cs} (95%) delete mode 100644 src/Volo.Abp/Microsoft/Extensions/DependencyInjection/ServiceCollectionRegistrationExtensions.cs create mode 100644 src/Volo.Abp/System/TypeExtensions.cs diff --git a/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll b/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll index 51f4fc4b061ae7fc86e6b320cd1ed3de87af8e5a..71f0a62b451082b58782b74b189fd480ae36c238 100644 GIT binary patch delta 886 zcmY+DU2IfE6vzK(w!8Pvsh1>c$ zJ%TDW&1l^9@*vd-y`Bg=1@i?w4irLV$wJZ#p4U$Zl211?w-dIQLCd69oIlO;{E z*eJ(3U1;UVX)|UcqW(+Nh!I|DMd=zpZIwiYtku4O2fAup5V!4GEe|iuh1F-=XC)}d z!`2`j;_ATAiW72*bUYDL&BE8l85vZ0>laqv8V&Y<$H3+Xu_nG7_?@Qtj$Oa>s=5P# zIm5ji+jQBXl!v^`&&ZfQwxBe7c!P{^MlPevJSzKCfs$ZNIBz$>!noFnLTvM=k*7KC z2qqubneBqhZjyMcDms|DL=8NTPwgEjOiPX+6> zH|2~Q~xR4KkARyEuqy;S=}$>*iZfI5v^;S(1uwWtkwPp D6(7xW delta 881 zcmY+DU1(HC6vzK(HoN!Uy?5{IW;bgS-I%bt+pUdJSw-V#;zy#jCJ@r~BNh5kLy#&M zeQbKu7*Gl5dQc2ejKm;8)acdPB6;gZNu*%kZ1DrsqM)@Qw6w*C&W-lL8TidP|1;+d zoSAVBl5>!b9V+S>pS+y!okbh+!#SE_qO`vu2Q1|;YCh&|l%~zxMc+`GNkl{YQvl)Z z7;!7bCtB5W2_&2M?`z-F*5L)3W&wZul-AOWh6*68v}AqD#&v4l%6-P4)XGPLGouIW z>r{?j{2mP8Vv)z4JQ|#vX_aM|@b?5$_{^83Vzl{AQyky>3o?!qzJmM+5A{Jkj&e55 zL`#3jF#|Y&te(P<(W&(L{`HiCC9{eTk(2GFVW0E$Ic zW!;x;W(wP_L46S%{@R?Ob<3-sRY) z$3~_6&nvuICiVVlrOC%@WSkv2hpzCD>`(( [NotNull] this IServiceCollection services) diff --git a/src/Volo.Abp/Microsoft/Extensions/DependencyInjection/ServiceCollectionConventionalRegistrationExtensions.cs b/src/Volo.Abp/Microsoft/Extensions/DependencyInjection/ServiceCollectionConventionalRegistrationExtensions.cs index d8066fa21e..5cf620e8c6 100644 --- a/src/Volo.Abp/Microsoft/Extensions/DependencyInjection/ServiceCollectionConventionalRegistrationExtensions.cs +++ b/src/Volo.Abp/Microsoft/Extensions/DependencyInjection/ServiceCollectionConventionalRegistrationExtensions.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Reflection; using Volo.DependencyInjection; namespace Microsoft.Extensions.DependencyInjection @@ -27,5 +29,40 @@ namespace Microsoft.Extensions.DependencyInjection return conventionalRegistrars; } + + public static IServiceCollection AddAssemblyOf(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; + } } } \ No newline at end of file diff --git a/src/Volo.Abp/Microsoft/Extensions/DependencyInjection/ServiceCollectionRegistrationExtensions.cs b/src/Volo.Abp/Microsoft/Extensions/DependencyInjection/ServiceCollectionRegistrationExtensions.cs deleted file mode 100644 index 1eb3661534..0000000000 --- a/src/Volo.Abp/Microsoft/Extensions/DependencyInjection/ServiceCollectionRegistrationExtensions.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Reflection; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static class ServiceCollectionRegistrationExtensions - { - public static IServiceCollection AddAssemblyOf(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; - } - } -} \ No newline at end of file diff --git a/src/Volo.Abp/System/TypeExtensions.cs b/src/Volo.Abp/System/TypeExtensions.cs new file mode 100644 index 0000000000..f24dfb562b --- /dev/null +++ b/src/Volo.Abp/System/TypeExtensions.cs @@ -0,0 +1,12 @@ +using System.Reflection; + +namespace System +{ + public static class TypeExtensions + { + public static Assembly GetAssembly(this Type type) + { + return type.GetTypeInfo().Assembly; + } + } +}