Browse Source
Merge pull request #9299 from abpframework/maliming/ServiceBased
Use AddControllersAsServices&AddViewComponentsAsServices.
pull/9303/head
Halil İbrahim Kalkan
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
|
|
|
@ -157,10 +157,10 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
|
context.Services.TryAddSingleton<IActionContextAccessor, ActionContextAccessor>(); |
|
|
|
|
|
|
|
//Use DI to create controllers
|
|
|
|
context.Services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>()); |
|
|
|
mvcBuilder.AddControllersAsServices(); |
|
|
|
|
|
|
|
//Use DI to create view components
|
|
|
|
context.Services.Replace(ServiceDescriptor.Singleton<IViewComponentActivator, ServiceBasedViewComponentActivator>()); |
|
|
|
mvcBuilder.AddViewComponentsAsServices(); |
|
|
|
|
|
|
|
//Use DI to create razor page
|
|
|
|
context.Services.Replace(ServiceDescriptor.Singleton<IPageModelActivatorProvider, ServiceBasedPageModelActivatorProvider>()); |
|
|
|
|