Browse Source

Resolved #408: Automatically register services by convention for a module

pull/441/head
Halil ibrahim Kalkan 8 years ago
parent
commit
33111945e3
  1. 67
      docs/Dependency-Injection.md
  2. 13
      docs/Getting-Started-AspNetCore-Application.md
  3. 12
      docs/Getting-Started-Console-Application.md
  4. 29
      docs/Module-Development-Basics.md
  5. 8
      framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo/Abp/AspNetCore/Authentication/OAuth/AbpAspNetCoreAuthenticationOAuthModule.cs
  6. 2
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyModule.cs
  7. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/AbpAspNetCoreMvcUiBootstrapModule.cs
  8. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpAspNetCoreMvcUiBundlingModule.cs
  9. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/AbpAspNetCoreMvcUiPackagesModule.cs
  10. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/AbpAspNetCoreMvcUIBasicThemeModule.cs
  11. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/AbpAspNetCoreMvcUiThemeSharedModule.cs
  12. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/AbpAspNetCoreMvcUiModule.cs
  13. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  14. 8
      framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreTestBaseModule.cs
  15. 1
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs
  16. 5
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingModule.cs
  17. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs
  18. 2
      framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs
  19. 5
      framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs
  20. 8
      framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/AbpBackgroundJobsHangfireModule.cs
  21. 2
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/AbpBackgroundJobsRabbitMqModule.cs
  22. 5
      framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/AbpBackgroundJobsModule.cs
  23. 4
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AbpBackgroundWorkersModule.cs
  24. 2
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs
  25. 2
      framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModule.cs
  26. 8
      framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs
  27. 2
      framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDataModule.cs
  28. 2
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/AbpDddApplicationModule.cs
  29. 8
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs
  30. 2
      framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
  31. 8
      framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/MySQL/AbpEntityFrameworkCoreMySQLModule.cs
  32. 8
      framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/SqlServer/AbpEntityFrameworkCoreSqlServerModule.cs
  33. 1
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreModule.cs
  34. 8
      framework/src/Volo.Abp.EventBus.Distributed.RabbitMQ/Volo/Abp/EventBus/Distributed/RabbitMq/AbpRabbitMqDistributedEventBusModule.cs
  35. 8
      framework/src/Volo.Abp.EventBus.Distributed/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusModule.cs
  36. 5
      framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs
  37. 8
      framework/src/Volo.Abp.Guids/Volo/Abp/Guids/AbpGuidsModule.cs
  38. 2
      framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireModule.cs
  39. 8
      framework/src/Volo.Abp.Http.Abstractions/Volo/Abp/Http/AbpHttpAbstractionsModule.cs
  40. 8
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/AbpHttpClientModule.cs
  41. 2
      framework/src/Volo.Abp.Http/Volo/Abp/Http/AbpHttpModule.cs
  42. 8
      framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs
  43. 2
      framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs
  44. 4
      framework/src/Volo.Abp.MemoryDb/Volo/Abp/MemoryDb/AbpMemoryDbModule.cs
  45. 4
      framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs
  46. 2
      framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/AbpMultiTenancyAbstractionsModule.cs
  47. 5
      framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/AbpObjectMappingModule.cs
  48. 5
      framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/AbpRabbitMqModule.cs
  49. 8
      framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs
  50. 5
      framework/src/Volo.Abp.Serialization/Volo/Abp/Serialization/AbpSerializationModule.cs
  51. 8
      framework/src/Volo.Abp.Settings/Volo/Abp/Settings/AbpSettingsModule.cs
  52. 8
      framework/src/Volo.Abp.Sms/Volo/Abp/Sms/AbpSmsModule.cs
  53. 2
      framework/src/Volo.Abp.Threading/Volo/Abp/Threading/AbpThreadingModule.cs
  54. 8
      framework/src/Volo.Abp.Timing/Volo/Abp/Timing/AbpTimingModule.cs
  55. 8
      framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/AbpUiNavigationModule.cs
  56. 2
      framework/src/Volo.Abp.UI/Volo/Abp/Ui/AbpUiModule.cs
  57. 5
      framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkModule.cs
  58. 5
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs
  59. 8
      framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/AbpVirtualFileSystemModule.cs
  60. 5
      framework/test/SimpleConsoleDemo/Program.cs
  61. 2
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
  62. 8
      framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/AbpAspNetCoreMvcUiBootstrapDemoTestModule.cs
  63. 6
      framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs
  64. 8
      framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/AbpAspNetCoreMvcUiTestModule.cs
  65. 2
      framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs
  66. 2
      framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AbpAuthorizationTestModule.cs
  67. 2
      framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AutofacTestModule.cs
  68. 8
      framework/test/Volo.Abp.Autofac.Tests/Volo/Abp/Autofac/AutofacTestModule.cs
  69. 8
      framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/AbpBackgroundJobsTestModule.cs
  70. 8
      framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/AbpCachingTestModule.cs
  71. 2
      framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs
  72. 2
      framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreTestModule.cs
  73. 6
      framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/EventBusTestModule.cs
  74. 2
      framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpTestModule.cs
  75. 2
      framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/AbpMemoryDbTestModule.cs
  76. 2
      framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/AbpMongoDbTestModule.cs
  77. 8
      framework/test/Volo.Abp.Serialization.Tests/Volo/Abp/Serialization/AbpSerializationTestModule.cs
  78. 8
      framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/TestAppTestModule.cs
  79. 2
      framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs

67
docs/Dependency-Injection.md

@ -18,11 +18,28 @@ public class BlogModule : AbpModule
### Conventional Registration
ABP introduces conventional service registration. To register all services of a module, you can simple call ``AddAssemblyOf`` extension method as shown below:
ABP introduces conventional service registration. You should do nothing to register services by convention. It's automatically done. If you want to disable it, you can set `SkipAutoServiceRegistration` to `true` by overriding the `PreConfigureServices` method.
````C#
public class BlogModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
SkipAutoServiceRegistration = true;
}
}
````
Once you skip auto registration, you should manually register your services. In that case, ``AddAssemblyOf`` extension method can help you to register all your services by convention. Example:
````c#
public class BlogModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
SkipAutoServiceRegistration = true;
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<BlogModule>();
@ -30,19 +47,19 @@ public class BlogModule : AbpModule
}
````
``AddAssemblyOf`` extension method takes a type (generally the type of the module class) and registers all services in the same assembly with given type by convention. The section below explains conventions and configurations.
The section below explains the conventions and configurations.
#### Inheritly Registered Types
#### Inherently Registered Types
Some specific types are registered to dependency injection by default. Examples:
* Module classes implement ``IAbpModule`` interface are registered as singleton.
* MVC controllers inherit ``Controller`` (or ``AbpController``) class are registered as transient.
* MVC page models inherit ``PageModel`` (or ``AbpPageModel``) class are registered as transient.
* MVC view components inherit ``ViewComponent`` (or ``AbpViewComponent``) class are registered as transient.
* Application services implement ``IApplicationService`` interface (or inherit ``ApplicationService`` class) are registered as transient.
* Repositories implement ``IRepository`` interface are registered as transient.
* Domain services implement ``IDomainService`` interface are registered as transient.
* Module classes are registered as singleton.
* MVC controllers (inherit ``Controller`` or ``AbpController``) are registered as transient.
* MVC page models (inherit ``PageModel`` or ``AbpPageModel``) are registered as transient.
* MVC view components (inherit ``ViewComponent`` or ``AbpViewComponent``) are registered as transient.
* Application services (implement ``IApplicationService`` interface or inherit ``ApplicationService`` class) are registered as transient.
* Repositories (implement ``IRepository`` interface) are registered as transient.
* Domain services (implement ``IDomainService`` interface) are registered as transient.
Example:
@ -129,16 +146,13 @@ public class TaxCalculator : ITaxCalculator, ITransientDependency
#### Manually Registering
In some cases, you may need to register a service to IServiceCollection manually, especially if you need to use custom factory methods or singleton instances. In that case, you can directly add services just as <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection" target="_blank">Microsoft documentation</a> describes. Example:
In some cases, you may need to register a service to the `IServiceCollection` manually, especially if you need to use custom factory methods or singleton instances. In that case, you can directly add services just as <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection" target="_blank">Microsoft documentation</a> describes. Example:
````C#
public class BlogModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
//Add services by convention
context.Services.AddAssemblyOf<BlogModule>();
//Register an instance as singleton
context.Services.AddSingleton<TaxCalculator>(new TaxCalculator(taxRatio: 0.18));
@ -148,25 +162,6 @@ public class BlogModule : AbpModule
}
````
Finally, you may want to add a single class or a few classes by ABP's conventions, but don't want to use ``AddAssemblyOf``. In that case, you can use ``AddType`` and ``AddTypes`` extension method which implements ABP's conventions for given type(s). Example:
````C#
public class BlogModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
//Add single type
context.Services.AddType(typeof(TaxCalculator));
//Add multiple types in once call
context.Services.AddTypes(typeof(TaxCalculator), typeof(MyOtherService));
//Add single type using generic shortcut
context.Services.AddType<TaxCalculator>();
}
}
````
### Injecting Dependencies
There are three common ways of using a service that is registered before.
@ -269,4 +264,8 @@ using (var scope = _serviceProvider.CreateScope())
}
````
Both services are released when the created scope is disposed (at the end of the using block).
Both services are released when the created scope is disposed (at the end of the using block).
### See Also
* [ASP.NET Core Dependency Injection Best Practices, Tips & Tricks](https://medium.com/volosoft/asp-net-core-dependency-injection-best-practices-tips-tricks-c6e9c67f9d96)

13
docs/Getting-Started-AspNetCore-Application.md

@ -1,6 +1,6 @@
## Getting Started ABP With AspNet Core MVC Web Application
This tutorial explains how to start ABP from scratch with minimal dependencies. You generally want to start with a ***startup template*** (TODO: link).
This tutorial explains how to start ABP from scratch with minimal dependencies. You generally want to start with a ***[startup template](https://abp.io/Templates)***.
### Create A New Project
@ -40,11 +40,6 @@ namespace BasicAspNetCoreApplication
[DependsOn(typeof(AbpAspNetCoreMvcModule))]
public class AppModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AppModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
@ -63,11 +58,9 @@ namespace BasicAspNetCoreApplication
``AppModule`` is a good name for the startup module for an application.
A module class can register services to Dependency Injection by overriding ``ConfigureServices`` method as shown here. ``AddAssemblyOf<...>`` is a special extension method of ABP that registers all services in an assembly by convention (see [dependency injection document](Dependency-Injection.md)). While this is optional, a module generally registers some services.
ABP packages define module classes and a module can depend on another module. In the code above, our ``AppModule`` depends on ``AbpAspNetCoreMvcModule`` (defined by Volo.Abp.AspNetCore.Mvc package). It's common to add a ``DependsOn`` attribute after installing a new ABP nuget package.
Instead of Startup class, we are registering dependencies and configuring AspNet Core pipeline in this module class.
Instead of Startup class, we are configuring ASP.NET Core pipeline in this module class.
### The Startup Class
@ -127,7 +120,7 @@ If you run the application, you will see a "Hello World!" message on the page.
Derived ``HomeController`` from ``AbpController`` instead of standard ``Controller`` class. This is not required, but ``AbpController`` class has useful base properties and methods to make your development easier.
### Using Autofac as Dependency Injection Framework
### Using Autofac as the Dependency Injection Framework
While AspNet Core's Dependency Injection (DI) system is fine for basic requirements, Autofac provides advanced features like Property Injection and Method Interception which are required by ABP to perform advanced application framework features.

12
docs/Getting-Started-Console-Application.md

@ -1,6 +1,6 @@
## Getting Started ABP With Console Application
This tutorial explains how to start ABP from scratch with minimal dependencies. You generally want to start with a ***startup template*** (TODO: link).
This tutorial explains how to start ABP from scratch with minimal dependencies. You generally want to start with a ***[startup template](https://abp.io/Templates)***.
### Create A New Project
@ -28,18 +28,13 @@ namespace AbpConsoleDemo
{
public class AppModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AppModule>();
}
}
}
````
``AppModule`` is a good name for the startup module for an application.
A module class can register services to Dependency Injection by overriding ``ConfigureServices`` method as shown here. ``AddAssemblyOf<...>`` is a special extension method of ABP that registers all services in an assembly by convention (TODO: link to DI document). While this is optional, a module generally registers some services.
### Initialize The Application
The next step is to bootstrap the application using the startup module created above:
@ -110,7 +105,8 @@ namespace AbpConsoleDemo
application.Initialize();
//Resolve a service and use it
var helloWorldService = application.ServiceProvider.GetService<HelloWorldService>();
var helloWorldService =
application.ServiceProvider.GetService<HelloWorldService>();
helloWorldService.SayHello();
Console.WriteLine("Press ENTER to stop application...");

29
docs/Module-Development-Basics.md

@ -32,19 +32,7 @@ public class BlogModule : AbpModule
}
````
You can register dependencies one by one as stated in Microsoft's <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection" target="_blank">documentation</a>. ABP has also a **conventional dependency registration system** which allows you to register all services in your assembly automatically. ``ConfigureServices`` methods of most modules contain such an expression to register all services in given module:
````C#
public class BlogModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<BlogModule>();
}
}
````
See [Dependency Injection](Dependency-Injection.md) documentation for more about the dependency injection system.
You can register dependencies one by one as stated in Microsoft's <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection" target="_blank">documentation</a>. Bu ABP has a **conventional dependency registration system** which automatically register all services in your assembly. See the [dependency Injection](Dependency-Injection.md) documentation for more about the dependency injection system.
You can also configure other services and modules in this method. Example:
@ -53,8 +41,6 @@ public class BlogModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<BlogModule>();
//Configure default connection string for the application
context.Services.Configure<DbConnectionOptions>(options =>
{
@ -124,19 +110,6 @@ You can also perform startup logic if your module requires
Lastly, you can override ``OnApplicationShutdown`` method if you want to execute a code while application is beign shutdown.
#### Alternative to Deriving from AbpModule Class
If you want to not derive your modules from ``AbpModule`` class for some reason, you can create a class and implement ``IAbpModule`` interface. This is the minimal interface required by ABP. If you want to handle other life cycle events as described above, you can implement additional interfaces:
* ``IPreConfigureServices``
* ``IPostConfigureServices``
* ``IOnPreApplicationInitialization``
* ``IOnApplicationInitialization``
* ``IOnPostApplicationInitialization``
* ``IOnApplicationShutdown``
However, deriving from ``AbpModule`` class is simpler since it implements all of these interfaces as virtual empty methods, so you can simple override which you need.
### Module Dependencies
In a modular application, it's typical a module depends on other modules. An Abp module must declare ``[DependsOn]`` attribute if it depends on another module, as shown below:

8
framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo/Abp/AspNetCore/Authentication/OAuth/AbpAspNetCoreAuthenticationOAuthModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
using Volo.Abp.Security;
namespace Volo.Abp.AspNetCore.Authentication.OAuth
@ -7,9 +6,6 @@ namespace Volo.Abp.AspNetCore.Authentication.OAuth
[DependsOn(typeof(AbpSecurityModule))]
public class AbpAspNetCoreAuthenticationOAuthModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAspNetCoreAuthenticationOAuthModule>();
}
}
}

2
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyModule.cs

@ -19,8 +19,6 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
options.TenantResolvers.Add(new HeaderTenantResolveContributer());
options.TenantResolvers.Add(new CookieTenantResolveContributer());
});
context.Services.AddAssemblyOf<AbpAspNetCoreMultiTenancyModule>();
}
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/AbpAspNetCoreMvcUiBootstrapModule.cs

@ -9,8 +9,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAspNetCoreMvcUiBootstrapModule>();
context.Services.Configure<VirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiBootstrapModule>("Volo.Abp.AspNetCore.Mvc.UI.Bootstrap");

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpAspNetCoreMvcUiBundlingModule.cs

@ -7,9 +7,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
[DependsOn(typeof(AbpAspNetCoreMvcUiBootstrapModule))]
public class AbpAspNetCoreMvcUiBundlingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAspNetCoreMvcUiBundlingModule>();
}
}
}

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/AbpAspNetCoreMvcUiPackagesModule.cs

@ -7,9 +7,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Packages
[DependsOn(typeof(AbpAspNetCoreMvcUiBundlingModule))]
public class AbpAspNetCoreMvcUiPackagesModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAspNetCoreMvcUiPackagesModule>();
}
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/AbpAspNetCoreMvcUIBasicThemeModule.cs

@ -56,8 +56,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic
bundle.AddBaseBundles(StandardBundles.Scripts.Global);
});
});
context.Services.AddAssemblyOf<AbpAspNetCoreMvcUiBasicThemeModule>();
}
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/AbpAspNetCoreMvcUiThemeSharedModule.cs

@ -31,8 +31,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared
.ScriptBundles
.Add(StandardBundles.Scripts.Global, bundle => bundle.AddContributors(typeof(SharedThemeGlobalScriptContributor)));
});
context.Services.AddAssemblyOf<AbpAspNetCoreMvcUiThemeSharedModule>();
}
}
}

8
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/AbpAspNetCoreMvcUiModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
using Volo.Abp.UI.Navigation;
namespace Volo.Abp.AspNetCore.Mvc.UI
@ -8,9 +7,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI
[DependsOn(typeof(AbpUiNavigationModule))]
public class AbpAspNetCoreMvcUiModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAspNetCoreMvcUiModule>();
}
}
}

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

@ -109,8 +109,6 @@ namespace Volo.Abp.AspNetCore.Mvc
{
mvcOptions.AddAbp(context.Services);
});
context.Services.AddAssemblyOf<AbpAspNetCoreMvcModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

8
framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreTestBaseModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.TestBase
@ -8,9 +7,6 @@ namespace Volo.Abp.AspNetCore.TestBase
[DependsOn(typeof(AbpAspNetCoreModule))]
public class AbpAspNetCoreTestBaseModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAspNetCoreTestBaseModule>();
}
}
}

1
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs

@ -39,7 +39,6 @@ namespace Volo.Abp.AspNetCore
AddAspNetServices(context.Services);
context.Services.AddObjectAccessor<IApplicationBuilder>();
context.Services.AddConfiguration();
context.Services.AddAssemblyOf<AbpAspNetCoreModule>();
}
private static void AddAspNetServices(IServiceCollection services)

5
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingModule.cs

@ -23,10 +23,5 @@ namespace Volo.Abp.Auditing
{
context.Services.OnRegistred(AuditingInterceptorRegistrar.RegisterIfNeeded);
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAuditingModule>();
}
}
}

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs

@ -29,8 +29,6 @@ namespace Volo.Abp.Authorization
options.ValueProviders.Add<UserPermissionValueProvider>();
options.ValueProviders.Add<RolePermissionValueProvider>();
});
context.Services.AddAssemblyOf<AbpAuthorizationModule>();
}
}
}

2
framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs

@ -19,8 +19,6 @@ namespace Volo.Abp.AutoMapper
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAutoMapperModule>();
var mapperAccessor = new MapperAccessor();
context.Services.AddSingleton<IMapperAccessor>(_ => mapperAccessor);
context.Services.AddSingleton<MapperAccessor>(_ => mapperAccessor);

5
framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs

@ -17,11 +17,6 @@ namespace Volo.Abp.BackgroundJobs
RegisterJobs(context.Services);
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpBackgroundJobsAbstractionsModule>();
}
private static void RegisterJobs(IServiceCollection services)
{
var jobTypes = new List<Type>();

8
framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/AbpBackgroundJobsHangfireModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Hangfire;
using Volo.Abp.Hangfire;
using Volo.Abp.Modularity;
namespace Volo.Abp.BackgroundJobs.Hangfire
@ -10,9 +9,6 @@ namespace Volo.Abp.BackgroundJobs.Hangfire
)]
public class AbpBackgroundJobsHangfireModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpBackgroundJobsHangfireModule>();
}
}
}

2
framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/AbpBackgroundJobsRabbitMqModule.cs

@ -15,8 +15,6 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddSingleton(typeof(IJobQueue<>), typeof(JobQueue<>));
context.Services.AddAssemblyOf<AbpBackgroundJobsRabbitMqModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

5
framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/AbpBackgroundJobsModule.cs

@ -15,11 +15,6 @@ namespace Volo.Abp.BackgroundJobs
)]
public class AbpBackgroundJobsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpBackgroundJobsModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var options = context.ServiceProvider.GetRequiredService<IOptions<BackgroundJobOptions>>().Value;

4
framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AbpBackgroundWorkersModule.cs

@ -10,10 +10,6 @@ namespace Volo.Abp.BackgroundWorkers
)]
public class AbpBackgroundWorkersModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpBackgroundWorkersModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{

2
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs

@ -16,8 +16,6 @@ namespace Volo.Abp.Caching
context.Services.AddMemoryCache();
context.Services.AddDistributedMemoryCache();
context.Services.AddAssemblyOf<AbpCachingModule>();
context.Services.AddSingleton(typeof(IDistributedCache<>), typeof(DistributedCache<>));
}
}

2
framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModule.cs

@ -13,6 +13,8 @@ namespace Volo.Abp.Modularity
IPreConfigureServices,
IPostConfigureServices
{
protected internal bool SkipAutoServiceRegistration { get; protected set; }
protected internal ServiceConfigurationContext ServiceConfigurationContext
{
get

8
framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs

@ -111,6 +111,14 @@ namespace Volo.Abp.Modularity
//ConfigureServices
foreach (var module in modules)
{
if (module.Instance is AbpModule abpModule)
{
if (!abpModule.SkipAutoServiceRegistration)
{
services.AddAssembly(module.Type.Assembly);
}
}
module.Instance.ConfigureServices(context);
}

2
framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDataModule.cs

@ -8,8 +8,6 @@ namespace Volo.Abp.Data
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddSingleton(typeof(IDataFilter<>), typeof(DataFilter<>));
context.Services.AddAssemblyOf<AbpDataModule>();
}
}
}

2
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/AbpDddApplicationModule.cs

@ -30,8 +30,6 @@ namespace Volo.Abp.Application
options.IgnoredInterfaces.AddIfNotContains(typeof(IUnitOfWorkEnabled)); //TODO: Move to it's own module if possible?
options.IgnoredInterfaces.AddIfNotContains(typeof(IAuthorizationEnabled)); //TODO: Move to it's own module if possible?
});
context.Services.AddAssemblyOf<AbpDddApplicationModule>();
}
}
}

8
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Auditing;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.EventBus;
using Volo.Abp.Guids;
@ -22,9 +21,6 @@ namespace Volo.Abp.Domain
typeof(AbpUnitOfWorkModule))]
public class AbpDddDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpDddDomainModule>();
}
}
}

2
framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs

@ -38,8 +38,6 @@ namespace Volo.Abp.Emailing
.SetVirtualFilePath("/Volo/Abp/Emailing/Templates/SimpleMessageTemplate.html")
);
});
context.Services.AddAssemblyOf<AbpEmailingModule>();
}
}
}

8
framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/MySQL/AbpEntityFrameworkCoreMySQLModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.EntityFrameworkCore.MySQL
{
@ -8,9 +7,6 @@ namespace Volo.Abp.EntityFrameworkCore.MySQL
)]
public class AbpEntityFrameworkCoreMySQLModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpEntityFrameworkCoreMySQLModule>();
}
}
}

8
framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/SqlServer/AbpEntityFrameworkCoreSqlServerModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.EntityFrameworkCore.SqlServer
{
@ -8,9 +7,6 @@ namespace Volo.Abp.EntityFrameworkCore.SqlServer
)]
public class AbpEntityFrameworkCoreSqlServerModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpEntityFrameworkCoreSqlServerModule>();
}
}
}

1
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreModule.cs

@ -25,7 +25,6 @@ namespace Volo.Abp.EntityFrameworkCore
});
context.Services.TryAddTransient(typeof(IDbContextProvider<>), typeof(UnitOfWorkDbContextProvider<>));
context.Services.AddAssemblyOf<AbpEntityFrameworkCoreModule>();
}
}
}

8
framework/src/Volo.Abp.EventBus.Distributed.RabbitMQ/Volo/Abp/EventBus/Distributed/RabbitMq/AbpRabbitMqDistributedEventBusModule.cs

@ -1,14 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.EventBus.Distributed.RabbitMq
{
[DependsOn(typeof(AbpDistributedEventBusModule))]
public class AbpRabbitMqDistributedEventBusModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpRabbitMqDistributedEventBusModule>();
}
}
}

8
framework/src/Volo.Abp.EventBus.Distributed/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusModule.cs

@ -1,14 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.EventBus.Distributed
{
[DependsOn(typeof(AbpEventBusModule))]
public class AbpDistributedEventBusModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpDistributedEventBusModule>();
}
}
}

5
framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs

@ -13,11 +13,6 @@ namespace Volo.Abp.EventBus
AddEventHandlers(context.Services);
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpEventBusModule>();
}
private static void AddEventHandlers(IServiceCollection services)
{
var handlers = new List<Type>();

8
framework/src/Volo.Abp.Guids/Volo/Abp/Guids/AbpGuidsModule.cs

@ -1,13 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.Guids
{
public class AbpGuidsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpGuidsModule>();
}
}
}

2
framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireModule.cs

@ -15,8 +15,6 @@ namespace Volo.Abp.Hangfire
{
context.Services.ExecutePreConfiguredActions(configuration);
});
context.Services.AddAssemblyOf<AbpHangfireModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

8
framework/src/Volo.Abp.Http.Abstractions/Volo/Abp/Http/AbpHttpAbstractionsModule.cs

@ -1,13 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.Http
{
public class AbpHttpAbstractionsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpHttpAbstractionsModule>();
}
}
}

8
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/AbpHttpClientModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Castle;
using Volo.Abp.Castle;
using Volo.Abp.Modularity;
namespace Volo.Abp.Http.Client
@ -8,9 +7,6 @@ namespace Volo.Abp.Http.Client
[DependsOn(typeof(AbpCastleCoreModule))]
public class AbpHttpClientModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpHttpClientModule>();
}
}
}

2
framework/src/Volo.Abp.Http/Volo/Abp/Http/AbpHttpModule.cs

@ -12,8 +12,6 @@ namespace Volo.Abp.Http
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpHttpModule>();
context.Services.Configure<AbpApiProxyScriptingOptions>(options =>
{
options.Generators[JQueryProxyScriptGenerator.Name] = typeof(JQueryProxyScriptGenerator);

8
framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
using Volo.Abp.Timing;
namespace Volo.Abp.Json
@ -7,9 +6,6 @@ namespace Volo.Abp.Json
[DependsOn(typeof(AbpTimingModule))]
public class AbpJsonModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpJsonModule>();
}
}
}

2
framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs

@ -32,8 +32,6 @@ namespace Volo.Abp.Localization
{
options.DefinitionProviders.Add<LocalizationSettingProvider>();
});
context.Services.AddAssemblyOf<AbpLocalizationModule>();
}
}
}

4
framework/src/Volo.Abp.MemoryDb/Volo/Abp/MemoryDb/AbpMemoryDbModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.Domain;
using Volo.Abp.Modularity;
using Volo.Abp.Uow.MemoryDb;
@ -15,7 +14,6 @@ namespace Volo.Abp.MemoryDb
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.TryAddTransient(typeof(IMemoryDatabaseProvider<>), typeof(UnitOfWorkMemoryDatabaseProvider<>));
context.Services.AddAssemblyOf<AbpMemoryDbModule>();
}
}
}

4
framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.Domain;
using Volo.Abp.Modularity;
using Volo.Abp.Uow.MongoDB;
@ -12,7 +11,6 @@ namespace Volo.Abp.MongoDB
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.TryAddTransient(typeof(IMongoDbContextProvider<>), typeof(UnitOfWorkMongoDbContextProvider<>));
context.Services.AddAssemblyOf<AbpMongoDbModule>();
}
}
}

2
framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/AbpMultiTenancyAbstractionsModule.cs

@ -15,8 +15,6 @@ namespace Volo.Abp.MultiTenancy
{
options.ValueProviders.Add<TenantSettingValueProvider>();
});
context.Services.AddAssemblyOf<AbpMultiTenancyAbstractionsModule>();
}
}
}

5
framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/AbpObjectMappingModule.cs

@ -19,10 +19,5 @@ namespace Volo.Abp.ObjectMapping
);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpObjectMappingModule>();
}
}
}

5
framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/AbpRabbitMqModule.cs

@ -9,11 +9,6 @@ namespace Volo.Abp.RabbitMQ
)]
public class AbpRabbitMqModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpRabbitMqModule>();
}
public override void OnApplicationShutdown(ApplicationShutdownContext context)
{
context.ServiceProvider

8
framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs

@ -1,13 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.Security
{
public class AbpSecurityModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpSecurityModule>();
}
}
}

5
framework/src/Volo.Abp.Serialization/Volo/Abp/Serialization/AbpSerializationModule.cs

@ -19,10 +19,5 @@ namespace Volo.Abp.Serialization
);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpSerializationModule>();
}
}
}

8
framework/src/Volo.Abp.Settings/Volo/Abp/Settings/AbpSettingsModule.cs

@ -1,13 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.Settings
{
public class AbpSettingsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpSettingsModule>();
}
}
}

8
framework/src/Volo.Abp.Sms/Volo/Abp/Sms/AbpSmsModule.cs

@ -1,13 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.Sms
{
public class AbpSmsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpSmsModule>();
}
}
}

2
framework/src/Volo.Abp.Threading/Volo/Abp/Threading/AbpThreadingModule.cs

@ -9,8 +9,6 @@ namespace Volo.Abp.Threading
{
context.Services.AddSingleton<ICancellationTokenProvider>(NullCancellationTokenProvider.Instance);
context.Services.AddSingleton(typeof(IAmbientScopeProvider<>), typeof(AmbientDataContextAmbientScopeProvider<>));
context.Services.AddAssemblyOf<AbpThreadingModule>();
}
}
}

8
framework/src/Volo.Abp.Timing/Volo/Abp/Timing/AbpTimingModule.cs

@ -1,13 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.Timing
{
public class AbpTimingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpTimingModule>();
}
}
}

8
framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/AbpUiNavigationModule.cs

@ -1,14 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.UI.Navigation
{
[DependsOn(typeof(AbpUiModule))]
public class AbpUiNavigationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpUiNavigationModule>();
}
}
}

2
framework/src/Volo.Abp.UI/Volo/Abp/Ui/AbpUiModule.cs

@ -22,8 +22,6 @@ namespace Volo.Abp.UI
{
options.Resources.Add<AbpUiResource>("en").AddVirtualJson("/Localization/Resources/AbpUi");
});
context.Services.AddAssemblyOf<AbpUiModule>();
}
}
}

5
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkModule.cs

@ -9,10 +9,5 @@ namespace Volo.Abp.Uow
{
context.Services.OnRegistred(UnitOfWorkInterceptorRegistrar.RegisterIfNeeded);
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpUnitOfWorkModule>();
}
}
}

5
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs

@ -9,10 +9,5 @@ namespace Volo.Abp.Validation
{
context.Services.OnRegistred(ValidationInterceptorRegistrar.RegisterIfNeeded);
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpValidationModule>();
}
}
}

8
framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/AbpVirtualFileSystemModule.cs

@ -1,13 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.VirtualFileSystem
{
public class AbpVirtualFileSystemModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpVirtualFileSystemModule>();
}
}
}

5
framework/test/SimpleConsoleDemo/Program.cs

@ -32,10 +32,7 @@ namespace SimpleConsoleDemo
public class MyConsoleModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<MyConsoleModule>();
}
}
public interface IMessageWriter

2
framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs

@ -72,8 +72,6 @@ namespace Volo.Abp.AspNetCore.Mvc
.Add<MvcTestResource>("en")
.AddVirtualJson("/Volo/Abp/AspNetCore/Mvc/Localization/Resource");
});
context.Services.AddAssemblyOf<AbpAspNetCoreMvcTestModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

8
framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/AbpAspNetCoreMvcUiBootstrapDemoTestModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.TestBase;
using Volo.Abp.AspNetCore.TestBase;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo
@ -10,9 +9,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo
)]
public class AbpAspNetCoreMvcUiBootstrapDemoTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAspNetCoreMvcUiBootstrapDemoTestModule>();
}
}
}

6
framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs

@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Modularity;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.Autofac;
@ -14,11 +13,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo
)]
public class AbpAspNetCoreMvcUiBootstrapDemoModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAspNetCoreMvcUiBootstrapDemoModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();

8
framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/AbpAspNetCoreMvcUiTestModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.TestBase;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
@ -13,9 +12,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI
)]
public class AbpAspNetCoreMvcUiTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAspNetCoreMvcUiTestModule>();
}
}
}

2
framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs

@ -47,8 +47,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning
options.ConfigureAbp(context.Services);
});
context.Services.AddAssemblyOf<AbpAspNetCoreMvcVersioningTestModule>();
context.Services.AddHttpClientProxies(typeof(AbpAspNetCoreMvcVersioningTestModule).Assembly);
context.Services.Configure<RemoteServiceOptions>(options =>

2
framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AbpAuthorizationTestModule.cs

@ -27,8 +27,6 @@ namespace Volo.Abp.Authorization
{
options.DefinitionProviders.TryAdd<AuthorizationTestPermissionDefinitionProvider>();
});
context.Services.AddAssemblyOf<AbpAuthorizationTestModule>();
}
}
}

2
framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AutofacTestModule.cs

@ -12,8 +12,6 @@ namespace Volo.Abp.AutoMapper
{
options.UseStaticMapper = false;
});
context.Services.AddAssemblyOf<AutoMapperTestModule>();
}
}
}

8
framework/test/Volo.Abp.Autofac.Tests/Volo/Abp/Autofac/AutofacTestModule.cs

@ -1,14 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.Autofac
{
[DependsOn(typeof(AbpAutofacModule))]
public class AutofacTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpAutofacModule>();
}
}
}

8
framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/AbpBackgroundJobsTestModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Autofac;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
namespace Volo.Abp.BackgroundJobs
@ -11,9 +10,6 @@ namespace Volo.Abp.BackgroundJobs
)]
public class AbpBackgroundJobsTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpBackgroundJobsTestModule>();
}
}
}

8
framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/AbpCachingTestModule.cs

@ -1,14 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.Caching
{
[DependsOn(typeof(AbpCachingModule))]
public class AbpCachingTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpCachingTestModule>();
}
}
}

2
framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs

@ -18,8 +18,6 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
{
options.AddDefaultRepositories<IThirdDbContext>();
});
context.Services.AddAssemblyOf<AbpEfCoreTestSecondContextModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

2
framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreTestModule.cs

@ -21,8 +21,6 @@ namespace Volo.Abp.EntityFrameworkCore
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpEntityFrameworkCoreTestModule>();
context.Services.AddAbpDbContext<TestAppDbContext>(options =>
{
options.AddDefaultRepositories(true);

6
framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/EventBusTestModule.cs

@ -1,4 +1,3 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
namespace Volo.Abp.EventBus
@ -6,9 +5,6 @@ namespace Volo.Abp.EventBus
[DependsOn(typeof(AbpEventBusModule))]
public class EventBusTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<EventBusTestModule>();
}
}
}

2
framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpTestModule.cs

@ -12,8 +12,6 @@ namespace Volo.Abp.Http
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpHttpTestModule>();
context.Services.AddHttpClientProxies(typeof(TestAppModule).Assembly);
context.Services.AddHttpClientProxy<IRegularTestController>();

2
framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/AbpMemoryDbTestModule.cs

@ -29,8 +29,6 @@ namespace Volo.Abp.MemoryDb
options.AddDefaultRepositories();
options.AddRepository<City, CityRepository>();
});
context.Services.AddAssemblyOf<AbpMemoryDbTestModule>();
}
}
}

2
framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/AbpMongoDbTestModule.cs

@ -30,8 +30,6 @@ namespace Volo.Abp.MongoDB
options.AddDefaultRepositories<ITestAppMongoDbContext>();
options.AddRepository<City, CityRepository>();
});
context.Services.AddAssemblyOf<AbpMongoDbTestModule>();
}
public override void OnApplicationShutdown(ApplicationShutdownContext context)

8
framework/test/Volo.Abp.Serialization.Tests/Volo/Abp/Serialization/AbpSerializationTestModule.cs

@ -1,14 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Volo.Abp.Serialization
{
[DependsOn(typeof(AbpSerializationModule))]
public class AbpSerializationTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<AbpSerializationTestModule>();
}
}
}

8
framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/TestAppTestModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.MemoryDb;
using Volo.Abp.MemoryDb;
using Volo.Abp.Modularity;
namespace Volo.Abp.TestApp
@ -7,9 +6,6 @@ namespace Volo.Abp.TestApp
[DependsOn(typeof(AbpMemoryDbTestModule))]
public class TestAppTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAssemblyOf<TestAppTestModule>();
}
}
}

2
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs

@ -19,8 +19,6 @@ namespace Volo.Abp.TestApp
public override void ConfigureServices(ServiceConfigurationContext context)
{
ConfigureAutoMapper(context.Services);
context.Services.AddAssemblyOf<TestAppModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

Loading…
Cancel
Save