From 900a5bd667b0580c49c65451c14247f3c7fdbf46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 6 Dec 2016 11:18:46 +0300 Subject: [PATCH] Improvement on modularity and DI. --- .../AbpApplicationBuilderExtensions.cs | 14 ++---- .../Abp/AspNetCore/AbpAspNetCoreModule.cs | 4 +- .../AbpServiceCollectionExtensions.cs | 4 +- .../Builder/AspNetConfigurationContext.cs | 23 ---------- .../AspNetCore/Builder/IConfigureAspNet.cs | 7 --- ...licationInitializationContextExtensions.cs | 27 +++++++++++ .../Modularity/AspNetCoreModuleInitializer.cs | 21 --------- src/Volo.Abp/Abp/AbpApplication.cs | 1 + .../Abp/AbpServiceCollectionExtensions.cs | 22 +-------- src/Volo.Abp/Abp/Modularity/AbpModule.cs | 4 +- .../ApplicationInitializationContext.cs | 14 ++++++ .../Modularity/DefaultModuleInitializer.cs | 17 ++++++- .../IOnApplicationInitialization.cs | 7 +++ .../Modularity/IOnApplicationInitialize.cs | 7 --- .../CommonServiceCollectionExtensions.cs | 45 +++++++++++++++++++ .../DependencyInjection/IObjectAccessor.cs | 7 +++ .../DependencyInjection/ObjectAccessor.cs | 17 +++++++ ...erviceCollectionRegistrationExtensions.cs} | 4 +- test/Apps/AspNetCoreDemo/AppModule.cs | 28 +++++------- test/Apps/AspNetCoreDemo/Startup.cs | 4 +- .../Modularity/IndependentEmptyModule.cs | 2 +- ...onalDependencyInjectionExtensions_Tests.cs | 28 ++++++++++++ 22 files changed, 189 insertions(+), 118 deletions(-) delete mode 100644 src/Volo.Abp.AspNetCore/Abp/AspNetCore/Builder/AspNetConfigurationContext.cs delete mode 100644 src/Volo.Abp.AspNetCore/Abp/AspNetCore/Builder/IConfigureAspNet.cs create mode 100644 src/Volo.Abp.AspNetCore/Abp/AspNetCore/Modularity/ApplicationInitializationContextExtensions.cs delete mode 100644 src/Volo.Abp.AspNetCore/Abp/AspNetCore/Modularity/AspNetCoreModuleInitializer.cs create mode 100644 src/Volo.Abp/Abp/Modularity/ApplicationInitializationContext.cs create mode 100644 src/Volo.Abp/Abp/Modularity/IOnApplicationInitialization.cs delete mode 100644 src/Volo.Abp/Abp/Modularity/IOnApplicationInitialize.cs create mode 100644 src/Volo.DependencyInjection/DependencyInjection/CommonServiceCollectionExtensions.cs create mode 100644 src/Volo.DependencyInjection/DependencyInjection/IObjectAccessor.cs create mode 100644 src/Volo.DependencyInjection/DependencyInjection/ObjectAccessor.cs rename src/Volo.DependencyInjection/DependencyInjection/{AbpConventionalDependencyInjectionExtensions.cs => ServiceCollectionRegistrationExtensions.cs} (97%) diff --git a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpApplicationBuilderExtensions.cs b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpApplicationBuilderExtensions.cs index d256406f69..448570f6cc 100644 --- a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpApplicationBuilderExtensions.cs +++ b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpApplicationBuilderExtensions.cs @@ -6,18 +6,10 @@ namespace Microsoft.AspNetCore.Builder { public static class AbpApplicationBuilderExtensions { - public static void InitializeAbpApplication(this IApplicationBuilder app) //TODO: Simply rename to InitializeApplication? + public static void InitializeApplication(this IApplicationBuilder app) { - var abpApplication = app.ApplicationServices.GetRequiredService(); - - app.ApplicationServices.GetRequiredService().App = app; - - abpApplication.Initialize(app.ApplicationServices); + app.ApplicationServices.GetRequiredService>().Object = app; + app.ApplicationServices.GetRequiredService().Initialize(app.ApplicationServices); } } - - public class ApplicationBuilderAccessor : ISingletonDependency - { - public IApplicationBuilder App { get; set; } - } } diff --git a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpAspNetCoreModule.cs b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpAspNetCoreModule.cs index b8fc9960aa..e59190e0b9 100644 --- a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpAspNetCoreModule.cs +++ b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpAspNetCoreModule.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Modularity; using Volo.DependencyInjection; @@ -8,6 +9,7 @@ namespace Volo.Abp.AspNetCore { public void ConfigureServices(IServiceCollection services) { + services.AddObjectAccessor(); services.AddAssemblyOf(); } } diff --git a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpServiceCollectionExtensions.cs b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpServiceCollectionExtensions.cs index a2e03dbad5..4606296b4c 100644 --- a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpServiceCollectionExtensions.cs +++ b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/AbpServiceCollectionExtensions.cs @@ -6,10 +6,10 @@ namespace Microsoft.Extensions.DependencyInjection //TODO: Decide to move ABP? public static class AbpServiceCollectionExtensions { - public static void AddAbpApplication(this IServiceCollection services) //TODO: Simply rename to AddApplication? + public static AbpApplication AddApplication(this IServiceCollection services) where TStartupModule : IAbpModule { - AbpApplication.Create(services); + return AbpApplication.Create(services); } } } \ No newline at end of file diff --git a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Builder/AspNetConfigurationContext.cs b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Builder/AspNetConfigurationContext.cs deleted file mode 100644 index 4890dc41de..0000000000 --- a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Builder/AspNetConfigurationContext.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace Volo.Abp.AspNetCore.Builder -{ - public class AspNetConfigurationContext - { - public IApplicationBuilder App { get; } - - public IHostingEnvironment Environment { get; } - - public ILoggerFactory LoggerFactory { get; } - - public AspNetConfigurationContext(IApplicationBuilder app) - { - App = app; - Environment = app.ApplicationServices.GetRequiredService(); - LoggerFactory = app.ApplicationServices.GetRequiredService(); - } - } -} \ No newline at end of file diff --git a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Builder/IConfigureAspNet.cs b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Builder/IConfigureAspNet.cs deleted file mode 100644 index 48de0f72bb..0000000000 --- a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Builder/IConfigureAspNet.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Volo.Abp.AspNetCore.Builder -{ - public interface IConfigureAspNet - { - void Configure(AspNetConfigurationContext context); - } -} diff --git a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Modularity/ApplicationInitializationContextExtensions.cs b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Modularity/ApplicationInitializationContextExtensions.cs new file mode 100644 index 0000000000..91fc0080f0 --- /dev/null +++ b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Modularity/ApplicationInitializationContextExtensions.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Volo.Abp.Modularity; +using Volo.DependencyInjection; + +namespace Volo.Abp.AspNetCore.Modularity +{ + public static class ApplicationInitializationContextExtensions + { + public static IApplicationBuilder GetApplicationBuilder(this ApplicationInitializationContext context) + { + return context.ServiceProvider.GetRequiredService>().Object; + } + + public static IHostingEnvironment GetEnvironment(this ApplicationInitializationContext context) + { + return context.ServiceProvider.GetRequiredService(); + } + + public static ILoggerFactory GetLoggerFactory(this ApplicationInitializationContext context) + { + return context.ServiceProvider.GetRequiredService(); + } + } +} diff --git a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Modularity/AspNetCoreModuleInitializer.cs b/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Modularity/AspNetCoreModuleInitializer.cs deleted file mode 100644 index d88799a72a..0000000000 --- a/src/Volo.Abp.AspNetCore/Abp/AspNetCore/Modularity/AspNetCoreModuleInitializer.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Volo.Abp.AspNetCore.Builder; -using Volo.Abp.Modularity; - -namespace Volo.Abp.AspNetCore.Modularity -{ - public class AspNetCoreModuleInitializer : IModuleInitializer - { - private readonly AspNetConfigurationContext _configurationContext; - - public AspNetCoreModuleInitializer(ApplicationBuilderAccessor appAccessor) - { - _configurationContext = new AspNetConfigurationContext(appAccessor.App); - } - - public void Initialize(IAbpModule module) - { - (module as IConfigureAspNet)?.Configure(_configurationContext); - } - } -} diff --git a/src/Volo.Abp/Abp/AbpApplication.cs b/src/Volo.Abp/Abp/AbpApplication.cs index cb33119d3a..5872415f40 100644 --- a/src/Volo.Abp/Abp/AbpApplication.cs +++ b/src/Volo.Abp/Abp/AbpApplication.cs @@ -1,6 +1,7 @@ using System; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Modularity; +using Volo.DependencyInjection; namespace Volo.Abp { diff --git a/src/Volo.Abp/Abp/AbpServiceCollectionExtensions.cs b/src/Volo.Abp/Abp/AbpServiceCollectionExtensions.cs index f3df14f649..bfce64a28c 100644 --- a/src/Volo.Abp/Abp/AbpServiceCollectionExtensions.cs +++ b/src/Volo.Abp/Abp/AbpServiceCollectionExtensions.cs @@ -1,6 +1,4 @@ -using System; -using System.Linq; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Volo.Abp.Modularity; @@ -8,24 +6,6 @@ namespace Volo.Abp { public static class AbpServiceCollectionExtensions { - public static T GetSingletonInstanceOrNull(this IServiceCollection services) - { - return (T)services - .FirstOrDefault(d => d.ServiceType == typeof(T)) - ?.ImplementationInstance; - } - - public static T GetSingletonInstance(this IServiceCollection services) - { - var service = services.GetSingletonInstanceOrNull(); - if (service == null) - { - throw new InvalidOperationException("Could not find singleton service: " + typeof(T).AssemblyQualifiedName); - } - - return service; - } - internal static void AddCoreAbpServices(this IServiceCollection services) { services.TryAddSingleton(new ModuleLoader()); diff --git a/src/Volo.Abp/Abp/Modularity/AbpModule.cs b/src/Volo.Abp/Abp/Modularity/AbpModule.cs index 6daa73f5e6..f196ae63f4 100644 --- a/src/Volo.Abp/Abp/Modularity/AbpModule.cs +++ b/src/Volo.Abp/Abp/Modularity/AbpModule.cs @@ -2,14 +2,14 @@ namespace Volo.Abp.Modularity { - public abstract class AbpModule : IAbpModule, IOnApplicationInitialize + public abstract class AbpModule : IAbpModule, IOnApplicationInitialization { public virtual void ConfigureServices(IServiceCollection services) { } - public virtual void OnApplicationInitialize() + public virtual void OnApplicationInitialization(ApplicationInitializationContext context) { } diff --git a/src/Volo.Abp/Abp/Modularity/ApplicationInitializationContext.cs b/src/Volo.Abp/Abp/Modularity/ApplicationInitializationContext.cs new file mode 100644 index 0000000000..6ddf6bd59a --- /dev/null +++ b/src/Volo.Abp/Abp/Modularity/ApplicationInitializationContext.cs @@ -0,0 +1,14 @@ +using System; + +namespace Volo.Abp.Modularity +{ + public class ApplicationInitializationContext + { + public IServiceProvider ServiceProvider { get; set; } + + public ApplicationInitializationContext(IServiceProvider serviceProvider) + { + ServiceProvider = serviceProvider; + } + } +} \ No newline at end of file diff --git a/src/Volo.Abp/Abp/Modularity/DefaultModuleInitializer.cs b/src/Volo.Abp/Abp/Modularity/DefaultModuleInitializer.cs index 201bffd4fc..865c38b6b3 100644 --- a/src/Volo.Abp/Abp/Modularity/DefaultModuleInitializer.cs +++ b/src/Volo.Abp/Abp/Modularity/DefaultModuleInitializer.cs @@ -1,10 +1,23 @@ -namespace Volo.Abp.Modularity +using System; + +namespace Volo.Abp.Modularity { public class DefaultModuleInitializer : IModuleInitializer { + private readonly IServiceProvider _serviceProvider; + + public DefaultModuleInitializer(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + } + public void Initialize(IAbpModule module) { - (module as IOnApplicationInitialize)?.OnApplicationInitialize(); + var context = new ApplicationInitializationContext( + _serviceProvider + ); + + (module as IOnApplicationInitialization)?.OnApplicationInitialization(context); } } } \ No newline at end of file diff --git a/src/Volo.Abp/Abp/Modularity/IOnApplicationInitialization.cs b/src/Volo.Abp/Abp/Modularity/IOnApplicationInitialization.cs new file mode 100644 index 0000000000..790a919e53 --- /dev/null +++ b/src/Volo.Abp/Abp/Modularity/IOnApplicationInitialization.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.Modularity +{ + public interface IOnApplicationInitialization + { + void OnApplicationInitialization(ApplicationInitializationContext context); + } +} \ No newline at end of file diff --git a/src/Volo.Abp/Abp/Modularity/IOnApplicationInitialize.cs b/src/Volo.Abp/Abp/Modularity/IOnApplicationInitialize.cs deleted file mode 100644 index bcee268f2e..0000000000 --- a/src/Volo.Abp/Abp/Modularity/IOnApplicationInitialize.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Volo.Abp.Modularity -{ - public interface IOnApplicationInitialize - { - void OnApplicationInitialize(); - } -} \ No newline at end of file diff --git a/src/Volo.DependencyInjection/DependencyInjection/CommonServiceCollectionExtensions.cs b/src/Volo.DependencyInjection/DependencyInjection/CommonServiceCollectionExtensions.cs new file mode 100644 index 0000000000..0aa6ab7182 --- /dev/null +++ b/src/Volo.DependencyInjection/DependencyInjection/CommonServiceCollectionExtensions.cs @@ -0,0 +1,45 @@ +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; + +namespace Volo.DependencyInjection +{ + public static class CommonServiceCollectionExtensions + { + public static T GetSingletonInstanceOrNull(this IServiceCollection services) + { + return (T)services + .FirstOrDefault(d => d.ServiceType == typeof(T)) + ?.ImplementationInstance; + } + + public static T GetSingletonInstance(this IServiceCollection services) + { + var service = services.GetSingletonInstanceOrNull(); + if (service == null) + { + throw new InvalidOperationException("Could not find singleton service: " + typeof(T).AssemblyQualifiedName); + } + + return service; + } + + public static ObjectAccessor AddObjectAccessor(this IServiceCollection services) + { + return services.AddObjectAccessor(new ObjectAccessor()); + } + + public static ObjectAccessor AddObjectAccessor(this IServiceCollection services, T obj) + { + return services.AddObjectAccessor(new ObjectAccessor(obj)); + } + + public static ObjectAccessor AddObjectAccessor(this IServiceCollection services, ObjectAccessor accessor) + { + services.AddSingleton(typeof(IObjectAccessor), accessor); + services.AddSingleton(typeof(ObjectAccessor), accessor); + + return accessor; + } + } +} \ No newline at end of file diff --git a/src/Volo.DependencyInjection/DependencyInjection/IObjectAccessor.cs b/src/Volo.DependencyInjection/DependencyInjection/IObjectAccessor.cs new file mode 100644 index 0000000000..ab9ba116dc --- /dev/null +++ b/src/Volo.DependencyInjection/DependencyInjection/IObjectAccessor.cs @@ -0,0 +1,7 @@ +namespace Volo.DependencyInjection +{ + public interface IObjectAccessor + { + T Object { get; } + } +} \ No newline at end of file diff --git a/src/Volo.DependencyInjection/DependencyInjection/ObjectAccessor.cs b/src/Volo.DependencyInjection/DependencyInjection/ObjectAccessor.cs new file mode 100644 index 0000000000..408db8304e --- /dev/null +++ b/src/Volo.DependencyInjection/DependencyInjection/ObjectAccessor.cs @@ -0,0 +1,17 @@ +namespace Volo.DependencyInjection +{ + public class ObjectAccessor : IObjectAccessor + { + public T Object { get; set; } + + public ObjectAccessor() + { + + } + + public ObjectAccessor(T obj) + { + Object = obj; + } + } +} \ No newline at end of file diff --git a/src/Volo.DependencyInjection/DependencyInjection/AbpConventionalDependencyInjectionExtensions.cs b/src/Volo.DependencyInjection/DependencyInjection/ServiceCollectionRegistrationExtensions.cs similarity index 97% rename from src/Volo.DependencyInjection/DependencyInjection/AbpConventionalDependencyInjectionExtensions.cs rename to src/Volo.DependencyInjection/DependencyInjection/ServiceCollectionRegistrationExtensions.cs index 3d7f764f8f..3f6278b528 100644 --- a/src/Volo.DependencyInjection/DependencyInjection/AbpConventionalDependencyInjectionExtensions.cs +++ b/src/Volo.DependencyInjection/DependencyInjection/ServiceCollectionRegistrationExtensions.cs @@ -8,7 +8,7 @@ using Volo.Internal; namespace Volo.DependencyInjection { - public static class AbpConventionalDependencyInjectionExtensions + public static class ServiceCollectionRegistrationExtensions { //TODO: Check if assembly/type is added before or add TryAdd versions of them? @@ -58,7 +58,7 @@ namespace Volo.DependencyInjection } } } - + private static List FindServiceTypes(Type type) { var customExposedServices = type.GetTypeInfo().GetCustomAttributes().OfType().SelectMany(p => p.GetExposedServiceTypes()).ToList(); diff --git a/test/Apps/AspNetCoreDemo/AppModule.cs b/test/Apps/AspNetCoreDemo/AppModule.cs index 9abe5f3c2a..957a56638f 100644 --- a/test/Apps/AspNetCoreDemo/AppModule.cs +++ b/test/Apps/AspNetCoreDemo/AppModule.cs @@ -1,32 +1,28 @@ -using Microsoft.AspNetCore.Builder; +using Volo.Abp.AspNetCore; +using Volo.Abp.Modularity; +using Volo.Abp.AspNetCore.Modularity; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Volo.Abp.AspNetCore; -using Volo.Abp.AspNetCore.Builder; -using Volo.Abp.Modularity; +using Microsoft.AspNetCore.Http; namespace AspNetCoreDemo { [DependsOn(typeof(AbpAspNetCoreModule))] - public class AppModule : IAbpModule, IConfigureAspNet + public class AppModule : AbpModule { - public void ConfigureServices(IServiceCollection services) + public override void OnApplicationInitialization(ApplicationInitializationContext context) { - - } + var app = context.GetApplicationBuilder(); - public void Configure(AspNetConfigurationContext context) - { - context.LoggerFactory.AddConsole(); + context.GetLoggerFactory().AddConsole(); - if (context.Environment.IsDevelopment()) + if (context.GetEnvironment().IsDevelopment()) { - context.App.UseDeveloperExceptionPage(); + app.UseDeveloperExceptionPage(); } - context.App.Run(async (ctx) => + app.Run(async (ctx) => { await ctx.Response.WriteAsync("Hello World 3!"); }); diff --git a/test/Apps/AspNetCoreDemo/Startup.cs b/test/Apps/AspNetCoreDemo/Startup.cs index a14dc1edcf..71ec9520d1 100644 --- a/test/Apps/AspNetCoreDemo/Startup.cs +++ b/test/Apps/AspNetCoreDemo/Startup.cs @@ -9,12 +9,12 @@ namespace AspNetCoreDemo { public void ConfigureServices(IServiceCollection services) { - services.AddAbpApplication(); + services.AddApplication(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { - app.InitializeAbpApplication(); + app.InitializeApplication(); } } } diff --git a/test/Volo.Abp.Tests/Modularity/IndependentEmptyModule.cs b/test/Volo.Abp.Tests/Modularity/IndependentEmptyModule.cs index e6365cde95..b5459bd14c 100644 --- a/test/Volo.Abp.Tests/Modularity/IndependentEmptyModule.cs +++ b/test/Volo.Abp.Tests/Modularity/IndependentEmptyModule.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.Tests.Modularity ConfigureServicesIsCalled = true; } - public override void OnApplicationInitialize() + public override void OnApplicationInitialization(ApplicationInitializationContext context) { OnApplicationInitializeIsCalled = true; } diff --git a/test/Volo.DependencyInjection.Tests/AbpConventionalDependencyInjectionExtensions_Tests.cs b/test/Volo.DependencyInjection.Tests/AbpConventionalDependencyInjectionExtensions_Tests.cs index 520492b2d3..a70cbb1914 100644 --- a/test/Volo.DependencyInjection.Tests/AbpConventionalDependencyInjectionExtensions_Tests.cs +++ b/test/Volo.DependencyInjection.Tests/AbpConventionalDependencyInjectionExtensions_Tests.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection; +using Shouldly; using Xunit; namespace Volo.DependencyInjection.Tests @@ -52,6 +53,28 @@ namespace Volo.DependencyInjection.Tests _services.ShouldNotContain(typeof(MyServiceWithExposeList)); } + [Fact] + public void AddObjectAccessor_Test() + { + //Arrange + + var obj = new MyEmptyClass(); + + //Act + + var accessor = _services.AddObjectAccessor(); + accessor.Object = obj; + + //Assert + + _services.GetSingletonInstance>().Object.ShouldBe(obj); + _services.GetSingletonInstance>().Object.ShouldBe(obj); + + var serviceProvider = _services.BuildServiceProvider(); + serviceProvider.GetRequiredService>().Object.ShouldBe(obj); + serviceProvider.GetRequiredService>().Object.ShouldBe(obj); + } + public class MyTransientClass : ITransientDependency { @@ -82,5 +105,10 @@ namespace Volo.DependencyInjection.Tests { } + + public class MyEmptyClass + { + + } } }