Browse Source

Merge pull request #5 from abpframework/dev

merge
pull/2019/head
Marcelo M. M 7 years ago
committed by GitHub
parent
commit
1139f57f11
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalizationModule.cs
  2. 3
      docs/en/AspNetCore/Client-Side-Package-Management.md
  3. 6
      docs/en/Caching.md
  4. 2
      docs/en/Getting-Started-Angular-Template.md
  5. 115
      docs/en/Getting-Started-AspNetCore-Application.md
  6. BIN
      docs/en/images/create-aspnet-core-application.png
  7. BIN
      docs/en/images/create-new-aspnet-core-application-v2.png
  8. BIN
      docs/en/images/select-empty-web-application-v2.png
  9. 85
      docs/zh-Hans/Caching.md
  10. 3
      docs/zh-Hans/docs-nav.json
  11. 2
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyModule.cs
  12. 4
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyOptions.cs
  13. 2
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/CookieTenantResolveContributor.cs
  14. 2
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/HeaderTenantResolveContributor.cs
  15. 2
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/QueryStringTenantResolveContributor.cs
  16. 2
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/RouteTenantResolveContributor.cs
  17. 4
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/TenantResolveContextExtensions.cs
  18. 4
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/MultiTenancy/MultiTenancyOptionsExtensions.cs
  19. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationConfigurationDto.cs
  20. 23
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentCultureDto.cs
  21. 19
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/DateTimeFormatDto.cs
  22. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/AbpAspNetCoreMvcUiBootstrapModule.cs
  23. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpBundleContributorOptions.cs
  24. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs
  25. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlingOptions.cs
  26. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs
  27. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs
  28. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs
  29. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs
  30. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/AbpAspNetCoreMvcUiMultiTenancyModule.cs
  31. 43
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/BootstrapDatepicker/BootstrapDatepickerScriptContributor.cs
  32. 13
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/BootstrapDatepicker/BootstrapDatepickerStyleContributor.cs
  33. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FontAwesome/FontAwesomeStyleContributor.cs
  34. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/AbpAspNetCoreMvcUIBasicThemeModule.cs
  35. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/Default.cshtml
  36. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
  37. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/AbpAspNetCoreMvcUiThemeSharedModule.cs
  38. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalScriptContributor.cs
  39. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalStyleContributor.cs
  40. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/AbpToolbarOptions.cs
  41. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs
  42. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpAspNetCoreMvcUiWidgetsModule.cs
  43. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs
  44. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpWidgetOptions.cs
  45. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/Components/WidgetScripts/WidgetScriptsViewComponent.cs
  46. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/Components/WidgetStyles/WidgetStylesViewComponent.cs
  47. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs
  48. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/AbpAspNetCoreMvcUiModule.cs
  49. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/AbpLayoutHookOptions.cs
  50. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/LayoutHookViewComponent.cs
  51. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/AbpThemingOptions.cs
  52. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/DefaultThemeSelector.cs
  53. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  54. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
  55. 36
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
  56. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
  57. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs
  58. 1
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs
  59. 8
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs
  60. 7
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs
  61. 1
      framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
  62. 33
      framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs
  63. 4
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Hosting/AbpHostingEnvironmentExtensions.cs
  64. 13
      framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs
  65. 6
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs
  66. 5
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs
  67. 4
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHttpStatusCodeOptions.cs
  68. 4
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs
  69. 4
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultHttpExceptionStatusCodeFinder.cs
  70. 6
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs
  71. 4
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AspNetCoreCorrelationIdProvider.cs
  72. 4
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/AbpAspNetCoreContentOptions.cs
  73. 4
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs
  74. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs
  75. 13
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs
  76. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/AbpPermissionOptions.cs
  77. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs
  78. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinitionManager.cs
  79. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionValueProviderManager.cs
  80. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs
  81. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs
  82. 4
      framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobOptions.cs
  83. 2
      framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs
  84. 4
      framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs
  85. 4
      framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs
  86. 4
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/AbpRabbitMqBackgroundJobOptions.cs
  87. 22
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs
  88. 4
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs
  89. 4
      framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/AbpBackgroundJobWorkerOptions.cs
  90. 2
      framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/AbpBackgroundJobsModule.cs
  91. 8
      framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs
  92. 2
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AbpBackgroundWorkerOptions.cs
  93. 4
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AbpBackgroundWorkersModule.cs
  94. 3
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs
  95. 17
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpDistributedCacheOptions.cs
  96. 179
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs
  97. 10
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheOptions.cs
  98. 33
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs
  99. 8
      framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
  100. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs

4
abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalizationModule.cs

@ -19,12 +19,12 @@ namespace AbpIoLocalization
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<VirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>
{ {
options.FileSets.AddEmbedded<AbpIoLocalizationModule>("AbpIoLocalization"); options.FileSets.AddEmbedded<AbpIoLocalizationModule>("AbpIoLocalization");
}); });
Configure<ExceptionLocalizationOptions>(options => Configure<AbpExceptionLocalizationOptions>(options =>
{ {
options.MapCodeNamespace("Volo.AbpIo.Commercial", typeof(AbpIoCommercialResource)); options.MapCodeNamespace("Volo.AbpIo.Commercial", typeof(AbpIoCommercialResource));
options.MapCodeNamespace("Volo.AbpIo.Domain", typeof(AbpIoBaseResource)); options.MapCodeNamespace("Volo.AbpIo.Domain", typeof(AbpIoBaseResource));

3
docs/en/AspNetCore/Client-Side-Package-Management.md

@ -93,7 +93,8 @@ An example mapping configuration is shown below:
````js ````js
mappings: { mappings: {
"@node_modules/bootstrap/dist/css/bootstrap.css": "@libs/bootstrap/css/", "@node_modules/bootstrap/dist/css/bootstrap.css": "@libs/bootstrap/css/",
"@node_modules/bootstrap/dist/js/bootstrap.bundle.js": "@libs/bootstrap/js/" "@node_modules/bootstrap/dist/js/bootstrap.bundle.js": "@libs/bootstrap/js/",
"@node_modules/bootstrap-datepicker/dist/locales/*.*": "@libs/bootstrap-datepicker/locales/"
} }
```` ````

6
docs/en/Caching.md

@ -2,7 +2,7 @@
ABP framework extends ASP.NET Core's distributed caching system. ABP framework extends ASP.NET Core's distributed caching system.
## IDistributedCache Interface ## `IDistributedCache` Interface
ASP.NET Core defines the `IDistributedCache` interface to get/set cache values. But it has some difficulties: ASP.NET Core defines the `IDistributedCache` interface to get/set cache values. But it has some difficulties:
@ -17,7 +17,7 @@ ASP.NET Core defines the `IDistributedCache` interface to get/set cache values.
See [ASP.NET Core's distributed caching document](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed) for more information. See [ASP.NET Core's distributed caching document](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed) for more information.
## IDistributedCache<TCacheItem> Interface ## `IDistributedCache<TCacheItem>` Interface
ABP framework defines the generic `IDistributedCache<TCacheItem>` interface in the [Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching/) package. `TCacheItem` is the type of the object stored in the cache. ABP framework defines the generic `IDistributedCache<TCacheItem>` interface in the [Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching/) package. `TCacheItem` is the type of the object stored in the cache.
@ -82,4 +82,4 @@ Other methods of the `IDistributedCache<BookCacheItem>` are same as ASP.NET Core
### DistributedCacheOptions ### DistributedCacheOptions
TODO TODO

2
docs/en/Getting-Started-Angular-Template.md

@ -75,7 +75,7 @@ Hit F5 (or Ctrl+F5) to run the application. It will have an output like shown be
#### Using EF Core Update-Database Command #### Using EF Core Update-Database Command
Ef Core has `Update-Database` command which creates database if necessary and applies pending migrations. Right click to the `.Web` project and select **Set as StartUp Project**: Ef Core has `Update-Database` command which creates database if necessary and applies pending migrations. Right click to the `.HttpApi.Host` project and select **Set as StartUp Project**:
![set-as-startup-project](images/set-as-startup-project.png) ![set-as-startup-project](images/set-as-startup-project.png)

115
docs/en/Getting-Started-AspNetCore-Application.md

@ -4,15 +4,17 @@ This tutorial explains how to start ABP from scratch with minimal dependencies.
## Create A New Project ## Create A New Project
1. Create a new empty AspNet Core Web Application from Visual Studio: 1. Create a new AspNet Core Web Application from Visual Studio 2019 (16.3.0+):
![](images/create-new-aspnet-core-application.png) ![](images/create-new-aspnet-core-application-v2.png)
2. Select Empty Template 2. Configure your new project:
![](images/select-empty-web-application.png) ![](images/select-empty-web-application-v2.png)
You could select another template, but I want to show it from a clear project. 3. Press to the create button:
![create-aspnet-core-application](D:\Github\abp\docs\en\images\create-aspnet-core-application.png)
## Install Volo.Abp.AspNetCore.Mvc Package ## Install Volo.Abp.AspNetCore.Mvc Package
@ -28,10 +30,8 @@ ABP is a modular framework and it requires a **startup (root) module** class der
````C# ````C#
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Modularity;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
@ -40,7 +40,8 @@ namespace BasicAspNetCoreApplication
[DependsOn(typeof(AbpAspNetCoreMvcModule))] [DependsOn(typeof(AbpAspNetCoreMvcModule))]
public class AppModule : AbpModule public class AppModule : AbpModule
{ {
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(
ApplicationInitializationContext context)
{ {
var app = context.GetApplicationBuilder(); var app = context.GetApplicationBuilder();
var env = context.GetEnvironment(); var env = context.GetEnvironment();
@ -49,8 +50,14 @@ namespace BasicAspNetCoreApplication
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
else
{
app.UseExceptionHandler("/Error");
}
app.UseMvcWithDefaultRoute(); app.UseStaticFiles();
app.UseRouting();
app.UseMvcWithDefaultRouteAndArea();
} }
} }
} }
@ -58,16 +65,15 @@ namespace BasicAspNetCoreApplication
``AppModule`` is a good name for the startup module for an application. ``AppModule`` is a good name for the startup module for an application.
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. ABP packages define module classes and a module can depend on another. In the code above, the ``AppModule`` depends on the ``AbpAspNetCoreMvcModule`` (defined by [Volo.Abp.AspNetCore.Mvc](https://www.nuget.org/packages/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 configuring ASP.NET Core pipeline in this module class. Instead of the Startup class, we are configuring ASP.NET Core pipeline in this module class.
## The Startup Class ## The Startup Class
Next step is to modify Startup class to integrate to ABP module system: Next step is to modify Startup class to integrate to ABP module system:
````C# ````C#
using System;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -75,11 +81,9 @@ namespace BasicAspNetCoreApplication
{ {
public class Startup public class Startup
{ {
public IServiceProvider ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddApplication<AppModule>(); services.AddApplication<AppModule>();
return services.BuildServiceProviderFromFactory();
} }
public void Configure(IApplicationBuilder app) public void Configure(IApplicationBuilder app)
@ -88,41 +92,19 @@ namespace BasicAspNetCoreApplication
} }
} }
} }
```` ````
Changed ``ConfigureServices`` method to return ``IServiceProvider`` instead of ``void``. This change allows us to replace AspNet Core's Dependency Injection with another framework (see Autofac integration section below). ``services.AddApplication<AppModule>()`` adds all services defined in all modules beginning from the ``AppModule``. ``services.AddApplication<AppModule>()`` adds all services defined in all modules starting from the ``AppModule``.
``app.InitializeApplication()`` call in ``Configure`` method initializes and starts the application. ``app.InitializeApplication()`` in ``Configure`` method initializes and starts the application.
## Hello World! ## Run the Application!
The application above does nothing. Let's create an MVC controller does something: That's all! Run the application, it will just work as expected.
````C#
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
namespace BasicAspNetCoreApplication.Controllers
{
public class HomeController : AbpController
{
public IActionResult Index()
{
return Content("Hello World!");
}
}
}
````
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 the 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. While AspNet Core's Dependency Injection (DI) system is fine for basic requirements, [Autofac](https://autofac.org/) provides advanced features like Property Injection and Method Interception which are required by ABP to perform advanced application framework features.
Replacing AspNet Core's DI system by Autofac and integrating to ABP is pretty easy. Replacing AspNet Core's DI system by Autofac and integrating to ABP is pretty easy.
@ -143,40 +125,29 @@ public class AppModule : AbpModule
} }
```` ````
3. Change ``services.AddApplication<AppModule>();`` line in the ``Startup`` class as shown below: 3. Update `Program.cs` to use Autofac:
````C#
services.AddApplication<AppModule>(options =>
{
options.UseAutofac(); //Integrate to Autofac
});
````
4. Update `Program.cs` to not use the `WebHost.CreateDefaultBuilder()` method since it uses the default DI container:
````csharp ````csharp
public class Program using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace BasicAspNetCoreApplication
{ {
public static void Main(string[] args) public class Program
{ {
/* public static void Main(string[] args)
https://github.com/aspnet/AspNetCore/issues/4206#issuecomment-445612167 {
CurrentDirectoryHelpers exists in: \framework\src\Volo.Abp.AspNetCore.Mvc\Microsoft\AspNetCore\InProcess\CurrentDirectoryHelpers.cs CreateHostBuilder(args).Build().Run();
Will remove CurrentDirectoryHelpers.cs when upgrade to ASP.NET Core 3.0. }
*/
CurrentDirectoryHelpers.SetCurrentDirectory();
BuildWebHostInternal(args).Run();
}
public static IWebHost BuildWebHostInternal(string[] args) => public static IHostBuilder CreateHostBuilder(string[] args) =>
new WebHostBuilder() Host.CreateDefaultBuilder(args)
.UseKestrel() .ConfigureWebHostDefaults(webBuilder =>
.UseContentRoot(Directory.GetCurrentDirectory()) {
.UseIIS() webBuilder.UseStartup<Startup>();
.UseIISIntegration() })
.UseStartup<Startup>() .UseAutofac(); //Add this line
.Build(); }
} }
```` ````

BIN
docs/en/images/create-aspnet-core-application.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
docs/en/images/create-new-aspnet-core-application-v2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

BIN
docs/en/images/select-empty-web-application-v2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

85
docs/zh-Hans/Caching.md

@ -0,0 +1,85 @@
# 缓存
ABP框架扩展了ASP.NET Core的分布式缓存系统.
## `IDistributedCache` 接口
ASP.NET Core 定义了 `IDistributedCache` 接口用于 get/set 缓存值 . 但是会有以下问题:
* 它适用于 **byte 数组** 而不是 .NET 对象. 因此你需要对缓存的对象进行**序列化/反序列化**.
* 它为所有的缓存项提供了 **单个 key 池** , 因此 ;
* 你需要注意键区分 **不同类型的对象**.
* 你需要注意**不同租户**(参见[多租户](Multi-Tenancy.md))的缓存项.
> `IDistributedCache` 定义在 `Microsoft.Extensions.Caching.Abstractions` 包中. 这使它不仅适用于ASP.NET Core应用程序, 也可用于**任何类型的程序**.
> `IDistributedCache` 接口的默认实现是 `MemoryDistributedCache` 它使用**内存**工作. 参见 [ASP.NET Core文档](https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed) 了解如何切换到 **Redis** 或其他缓存提供程序.
有关更多信息, 参见 [ASP.NET Core 分布式缓存文档](https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed).
## `IDistributedCache<TCacheItem>` 接口
ABP框架在[Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching/)包定义了通用的泛型 `IDistributedCache<TCacheItem>` 接口. `TCacheItem` 是存储在缓存中的对象类型.
`IDistributedCache<TCacheItem>` 接口了上述中的问题;
* 它在内部 **序列化/反序列化** 缓存对象. 默认使用 **JSON** 序列化, 但可以替换[依赖注入](Dependency-Injection.md)系统中 `IDistributedCacheSerializer` 服务的实现来覆盖默认的处理.
* 它根据缓存中对象类型自动向缓存key添加 **缓存名称** 前缀. 默认缓存名是缓存对象类的全名(如果你的类名以`CacheItem` 结尾, 那么`CacheItem` 会被忽略,不应用到缓存名称上). 你也可以在缓存类上使用 `CacheName` 设置换缓存的名称.
* 它自动将当前的**租户id**添加到缓存键中, 以区分不同租户的缓存项 (只有在你的应用程序是[多租户](Multi-Tenancy.md)的情况下生效). 在缓存类上应用 `IgnoreMultiTenancy` attribute, 可以在所有的租户间共享缓存.
* 允许为每个应用程序定义 **全局缓存键前缀** ,不同的应用程序可以在共享的分布式缓存中拥有自己的隔离池.
### 使用方式
缓存中存储项的示例类:
````csharp
public class BookCacheItem
{
public string Name { get; set; }
public float Price { get; set; }
}
````
你可以注入 `IDistributedCache<BookCacheItem>` 服务用于 get/set `BookCacheItem` 对象.
使用示例:
````csharp
public class BookService : ITransientDependency
{
private readonly IDistributedCache<BookCacheItem> _cache;
public BookService(IDistributedCache<BookCacheItem> cache)
{
_cache = cache;
}
public async Task<BookCacheItem> GetAsync(Guid bookId)
{
return await _cache.GetOrAddAsync(
bookId.ToString(), //Cache key
async () => await GetBookFromDatabaseAsync(bookId),
() => new DistributedCacheEntryOptions
{
AbsoluteExpiration = DateTimeOffset.Now.AddHours(1)
}
);
}
private Task<BookCacheItem> GetBookFromDatabaseAsync(Guid bookId)
{
//TODO: get from database
}
}
````
* 示例服务代码中的 `GetOrAddAsync()` 方法从缓存中获取图书项.
* 如果没有在缓存中找到图书,它会调用工厂方法 (本示例中是 `GetBookFromDatabaseAsync`)从原始数据源中获取图书项.
* `GetOrAddAsync` 有一个可选参数 `DistributedCacheEntryOptions` , 可用于设置缓存的生命周期.
`IDistributedCache<BookCacheItem>` 的其他方法与ASP.NET Core的`IDistributedCache` 接口相同, 你可以参考 [ASP.NET Core文档](https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed).
### DistributedCacheOptions
TODO

3
docs/zh-Hans/docs-nav.json

@ -77,7 +77,8 @@
"text": "授权" "text": "授权"
}, },
{ {
"text": "缓存" "text": "缓存",
"path": "Caching.md"
}, },
{ {
"text": "审计" "text": "审计"

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

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<TenantResolveOptions>(options => Configure<AbpTenantResolveOptions>(options =>
{ {
options.TenantResolvers.Add(new QueryStringTenantResolveContributor()); options.TenantResolvers.Add(new QueryStringTenantResolveContributor());
options.TenantResolvers.Add(new RouteTenantResolveContributor()); options.TenantResolvers.Add(new RouteTenantResolveContributor());

4
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancyOptions.cs → framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyOptions.cs

@ -2,14 +2,14 @@
namespace Volo.Abp.AspNetCore.MultiTenancy namespace Volo.Abp.AspNetCore.MultiTenancy
{ {
public class AspNetCoreMultiTenancyOptions public class AbpAspNetCoreMultiTenancyOptions
{ {
/// <summary> /// <summary>
/// Default: <see cref="TenantResolverConsts.DefaultTenantKey"/>. /// Default: <see cref="TenantResolverConsts.DefaultTenantKey"/>.
/// </summary> /// </summary>
public string TenantKey { get; set; } public string TenantKey { get; set; }
public AspNetCoreMultiTenancyOptions() public AbpAspNetCoreMultiTenancyOptions()
{ {
TenantKey = TenantResolverConsts.DefaultTenantKey; TenantKey = TenantResolverConsts.DefaultTenantKey;
} }

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

@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
protected override string GetTenantIdOrNameFromHttpContextOrNull(ITenantResolveContext context, HttpContext httpContext) protected override string GetTenantIdOrNameFromHttpContextOrNull(ITenantResolveContext context, HttpContext httpContext)
{ {
return httpContext.Request?.Cookies[context.GetAspNetCoreMultiTenancyOptions().TenantKey]; return httpContext.Request?.Cookies[context.GetAbpAspNetCoreMultiTenancyOptions().TenantKey];
} }
} }
} }

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

@ -20,7 +20,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
return null; return null;
} }
var tenantIdKey = context.GetAspNetCoreMultiTenancyOptions().TenantKey; var tenantIdKey = context.GetAbpAspNetCoreMultiTenancyOptions().TenantKey;
var tenantIdHeader = httpContext.Request.Headers[tenantIdKey]; var tenantIdHeader = httpContext.Request.Headers[tenantIdKey];
if (tenantIdHeader == string.Empty || tenantIdHeader.Count < 1) if (tenantIdHeader == string.Empty || tenantIdHeader.Count < 1)

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

@ -16,7 +16,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
return null; return null;
} }
return httpContext.Request.Query[context.GetAspNetCoreMultiTenancyOptions().TenantKey]; return httpContext.Request.Query[context.GetAbpAspNetCoreMultiTenancyOptions().TenantKey];
} }
} }
} }

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

@ -13,7 +13,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
protected override string GetTenantIdOrNameFromHttpContextOrNull(ITenantResolveContext context, HttpContext httpContext) protected override string GetTenantIdOrNameFromHttpContextOrNull(ITenantResolveContext context, HttpContext httpContext)
{ {
var tenantId = httpContext.GetRouteValue(context.GetAspNetCoreMultiTenancyOptions().TenantKey); var tenantId = httpContext.GetRouteValue(context.GetAbpAspNetCoreMultiTenancyOptions().TenantKey);
if (tenantId == null) if (tenantId == null)
{ {
return null; return null;

4
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/TenantResolveContextExtensions.cs

@ -6,9 +6,9 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
{ {
public static class TenantResolveContextExtensions public static class TenantResolveContextExtensions
{ {
public static AspNetCoreMultiTenancyOptions GetAspNetCoreMultiTenancyOptions(this ITenantResolveContext context) public static AbpAspNetCoreMultiTenancyOptions GetAbpAspNetCoreMultiTenancyOptions(this ITenantResolveContext context)
{ {
return context.ServiceProvider.GetRequiredService<IOptionsSnapshot<AspNetCoreMultiTenancyOptions>>().Value; return context.ServiceProvider.GetRequiredService<IOptionsSnapshot<AbpAspNetCoreMultiTenancyOptions>>().Value;
} }
} }
} }

4
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/MultiTenancy/MultiTenancyOptionsExtensions.cs

@ -3,9 +3,9 @@ using Volo.Abp.AspNetCore.MultiTenancy;
namespace Volo.Abp.MultiTenancy namespace Volo.Abp.MultiTenancy
{ {
public static class MultiTenancyOptionsExtensions public static class AbpMultiTenancyOptionsExtensions
{ {
public static void AddDomainTenantResolver(this TenantResolveOptions options, string domainFormat) public static void AddDomainTenantResolver(this AbpTenantResolveOptions options, string domainFormat)
{ {
options.TenantResolvers.InsertAfter( options.TenantResolvers.InsertAfter(
r => r is CurrentUserTenantResolveContributor, r => r is CurrentUserTenantResolveContributor,

2
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationConfigurationDto.cs

@ -12,6 +12,8 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
public List<LanguageInfo> Languages { get; set; } public List<LanguageInfo> Languages { get; set; }
public CurrentCultureDto CurrentCulture { get; set; }
public ApplicationLocalizationConfigurationDto() public ApplicationLocalizationConfigurationDto()
{ {
Values = new Dictionary<string, Dictionary<string, string>>(); Values = new Dictionary<string, Dictionary<string, string>>();

23
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentCultureDto.cs

@ -0,0 +1,23 @@
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
{
public class CurrentCultureDto
{
public string DisplayName { get; set; }
public string EnglishName { get; set; }
public string ThreeLetterIsoLanguageName { get; set; }
public string TwoLetterIsoLanguageName { get; set; }
public bool IsRightToLeft { get; set; }
public string CultureName { get; set; }
public string Name { get; set; }
public string NativeName { get; set; }
public DateTimeFormatDto DateTimeFormat { get; set; }
}
}

19
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/DateTimeFormatDto.cs

@ -0,0 +1,19 @@
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
{
public class DateTimeFormatDto
{
public string CalendarAlgorithmType { get; set; }
public string DateTimeFormatLong { get; set; }
public string ShortDatePattern { get; set; }
public string FullDateTimePattern { get; set; }
public string DateSeparator { get; set; }
public string ShortTimePattern { get; set; }
public string LongTimePattern { get; set; }
}
}

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

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

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleContributorOptions.cs → framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpBundleContributorOptions.cs

@ -4,11 +4,11 @@ using JetBrains.Annotations;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{ {
public class BundleContributorOptions public class AbpBundleContributorOptions
{ {
public ConcurrentDictionary<Type, BundleContributorCollection> AllExtensions { get; } public ConcurrentDictionary<Type, BundleContributorCollection> AllExtensions { get; }
public BundleContributorOptions() public AbpBundleContributorOptions()
{ {
AllExtensions = new ConcurrentDictionary<Type, BundleContributorCollection>(); AllExtensions = new ConcurrentDictionary<Type, BundleContributorCollection>();
} }

8
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs

@ -21,8 +21,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{ {
public ILogger<BundleManager> Logger { get; set; } public ILogger<BundleManager> Logger { get; set; }
protected readonly BundlingOptions Options; protected readonly AbpBundlingOptions Options;
protected readonly BundleContributorOptions ContributorOptions; protected readonly AbpBundleContributorOptions ContributorOptions;
protected readonly IWebContentFileProvider WebContentFileProvider; protected readonly IWebContentFileProvider WebContentFileProvider;
protected readonly IWebHostEnvironment HostingEnvironment; protected readonly IWebHostEnvironment HostingEnvironment;
protected readonly IScriptBundler ScriptBundler; protected readonly IScriptBundler ScriptBundler;
@ -33,8 +33,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
protected readonly IWebRequestResources RequestResources; protected readonly IWebRequestResources RequestResources;
public BundleManager( public BundleManager(
IOptions<BundlingOptions> options, IOptions<AbpBundlingOptions> options,
IOptions<BundleContributorOptions> contributorOptions, IOptions<AbpBundleContributorOptions> contributorOptions,
IScriptBundler scriptBundler, IScriptBundler scriptBundler,
IStyleBundler styleBundler, IStyleBundler styleBundler,
IWebHostEnvironment hostingEnvironment, IWebHostEnvironment hostingEnvironment,

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlingOptions.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{ {
public class BundlingOptions public class AbpBundlingOptions
{ {
public BundleConfigurationCollection StyleBundles { get; set; } public BundleConfigurationCollection StyleBundles { get; set; }
@ -18,7 +18,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
/// </summary> /// </summary>
public BundlingMode Mode { get; set; } = BundlingMode.Auto; public BundlingMode Mode { get; set; } = BundlingMode.Auto;
public BundlingOptions() public AbpBundlingOptions()
{ {
StyleBundles = new BundleConfigurationCollection(); StyleBundles = new BundleConfigurationCollection();
ScriptBundles = new BundleConfigurationCollection(); ScriptBundles = new BundleConfigurationCollection();

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs

@ -20,12 +20,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
protected IBundleManager BundleManager { get; } protected IBundleManager BundleManager { get; }
protected IWebContentFileProvider WebContentFileProvider { get; } protected IWebContentFileProvider WebContentFileProvider { get; }
protected IWebHostEnvironment HostingEnvironment { get; } protected IWebHostEnvironment HostingEnvironment { get; }
protected readonly BundlingOptions Options; protected readonly AbpBundlingOptions Options;
protected AbpTagHelperResourceService( protected AbpTagHelperResourceService(
IBundleManager bundleManager, IBundleManager bundleManager,
IWebContentFileProvider webContentFileProvider, IWebContentFileProvider webContentFileProvider,
IOptions<BundlingOptions> options, IOptions<AbpBundlingOptions> options,
IWebHostEnvironment hostingEnvironment) IWebHostEnvironment hostingEnvironment)
{ {
BundleManager = bundleManager; BundleManager = bundleManager;

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs

@ -14,7 +14,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
public AbpTagHelperScriptService( public AbpTagHelperScriptService(
IBundleManager bundleManager, IBundleManager bundleManager,
IWebContentFileProvider webContentFileProvider, IWebContentFileProvider webContentFileProvider,
IOptions<BundlingOptions> options, IOptions<AbpBundlingOptions> options,
IWebHostEnvironment hostingEnvironment IWebHostEnvironment hostingEnvironment
) : base( ) : base(
bundleManager, bundleManager,

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs

@ -14,7 +14,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
public AbpTagHelperStyleService( public AbpTagHelperStyleService(
IBundleManager bundleManager, IBundleManager bundleManager,
IWebContentFileProvider webContentFileProvider, IWebContentFileProvider webContentFileProvider,
IOptions<BundlingOptions> options, IOptions<AbpBundlingOptions> options,
IWebHostEnvironment hostingEnvironment IWebHostEnvironment hostingEnvironment
) : base( ) : base(
bundleManager, bundleManager,

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs

@ -17,11 +17,11 @@ namespace Pages.Abp.MultiTenancy
public TenantInfoModel Input { get; set; } public TenantInfoModel Input { get; set; }
protected ITenantStore TenantStore { get; } protected ITenantStore TenantStore { get; }
protected AspNetCoreMultiTenancyOptions Options { get; } protected AbpAspNetCoreMultiTenancyOptions Options { get; }
public TenantSwitchModalModel( public TenantSwitchModalModel(
ITenantStore tenantStore, ITenantStore tenantStore,
IOptions<AspNetCoreMultiTenancyOptions> options) IOptions<AbpAspNetCoreMultiTenancyOptions> options)
{ {
TenantStore = tenantStore; TenantStore = tenantStore;
Options = options.Value; Options = options.Value;

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/AbpAspNetCoreMvcUiMultiTenancyModule.cs

@ -35,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<VirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>
{ {
options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiMultiTenancyModule>(); options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiMultiTenancyModule>();
}); });
@ -47,7 +47,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy
.AddVirtualJson("/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization"); .AddVirtualJson("/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization");
}); });
Configure<BundlingOptions>(options => Configure<AbpBundlingOptions>(options =>
{ {
options.ScriptBundles options.ScriptBundles
.Get(StandardBundles.Scripts.Global) .Get(StandardBundles.Scripts.Global)

43
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/BootstrapDatepicker/BootstrapDatepickerScriptContributor.cs

@ -0,0 +1,43 @@
using System.Collections.Generic;
using System.Globalization;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQuery;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.Timeago
{
[DependsOn(typeof(JQueryScriptContributor))]
public class BootstrapDatepickerScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/libs/bootstrap-datepicker/bootstrap-datepicker.min.js");
}
public override void ConfigureDynamicResources(BundleConfigurationContext context)
{
var cultureName = CultureInfo.CurrentUICulture.DateTimeFormat.Calendar.AlgorithmType ==
CalendarAlgorithmType.LunarCalendar
? "en"
: CultureInfo.CurrentUICulture.Name;
if (TryAddCultureFile(context, cultureName))
{
return;
}
}
protected virtual bool TryAddCultureFile(BundleConfigurationContext context, string cultureName)
{
var filePath = $"/libs/bootstrap-datepicker/locales/bootstrap-datepicker.{cultureName}.min.js";
if (!context.FileProvider.GetFileInfo(filePath).Exists)
{
return false;
}
context.Files.AddIfNotContains(filePath);
return true;
}
}
}

13
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/BootstrapDatepicker/BootstrapDatepickerStyleContributor.cs

@ -0,0 +1,13 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.Select2
{
public class BootstrapDatepickerStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/libs/bootstrap-datepicker/bootstrap-datepicker.min.css");
}
}
}

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FontAwesome/FontAwesomeStyleContributor.cs

@ -7,7 +7,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.FontAwesome
{ {
public override void ConfigureBundle(BundleConfigurationContext context) public override void ConfigureBundle(BundleConfigurationContext context)
{ {
context.Files.AddIfNotContains("/libs/font-awesome/css/font-awesome.css"); context.Files.AddIfNotContains("/libs/@fortawesome/fontawesome-free/css/all.css");
context.Files.AddIfNotContains("/libs/@fortawesome/fontawesome-free/css/v4-shims.css");
} }
} }
} }

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

@ -28,7 +28,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<ThemingOptions>(options => Configure<AbpThemingOptions>(options =>
{ {
options.Themes.Add<BasicTheme>(); options.Themes.Add<BasicTheme>();
@ -38,17 +38,17 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic
} }
}); });
Configure<VirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>
{ {
options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiBasicThemeModule>("Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic"); options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiBasicThemeModule>("Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic");
}); });
Configure<ToolbarOptions>(options => Configure<AbpToolbarOptions>(options =>
{ {
options.Contributors.Add(new BasicThemeMainTopToolbarContributor()); options.Contributors.Add(new BasicThemeMainTopToolbarContributor());
}); });
Configure<BundlingOptions>(options => Configure<AbpBundlingOptions>(options =>
{ {
options options
.StyleBundles .StyleBundles

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/Default.cshtml

@ -8,7 +8,7 @@
<div class="dropdown-menu dropdown-menu-right border-0 shadow-sm" aria-labelledby="dropdownMenuLink"> <div class="dropdown-menu dropdown-menu-right border-0 shadow-sm" aria-labelledby="dropdownMenuLink">
@foreach (var language in Model.OtherLanguages) @foreach (var language in Model.OtherLanguages)
{ {
<a class="dropdown-item" href="/Abp/Languages/Switch?culture=@(language.CultureName)&uiCulture=@(language.UiCultureName)">@language.DisplayName</a> <a class="dropdown-item" href="/Abp/Languages/Switch?culture=@(language.CultureName)&uiCulture=@(language.UiCultureName)&returnUrl=@Context.Request.Path">@language.DisplayName</a>
} }
</div> </div>
</div> </div>

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml

@ -14,7 +14,7 @@
@using Volo.Abp.MultiTenancy @using Volo.Abp.MultiTenancy
@inject IAbpAntiForgeryManager AbpAntiForgeryManager @inject IAbpAntiForgeryManager AbpAntiForgeryManager
@inject IBrandingProvider BrandingProvider @inject IBrandingProvider BrandingProvider
@inject IOptions<MultiTenancyOptions> MultiTenancyOptions @inject IOptions<AbpMultiTenancyOptions> MultiTenancyOptions
@inject ICurrentTenant CurrentTenant @inject ICurrentTenant CurrentTenant
@inject IStringLocalizer<AbpUiMultiTenancyResource> MultiTenancyStringLocalizer @inject IStringLocalizer<AbpUiMultiTenancyResource> MultiTenancyStringLocalizer
@inject ITenantResolveResultAccessor TenantResolveResultAccessor @inject ITenantResolveResultAccessor TenantResolveResultAccessor

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

@ -26,12 +26,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<VirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>
{ {
options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiThemeSharedModule>("Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared"); options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiThemeSharedModule>("Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared");
}); });
Configure<BundlingOptions>(options => Configure<AbpBundlingOptions>(options =>
{ {
options options
.StyleBundles .StyleBundles

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalScriptContributor.cs

@ -27,7 +27,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling
typeof(ToastrScriptBundleContributor), typeof(ToastrScriptBundleContributor),
typeof(MalihuCustomScrollbarPluginScriptBundleContributor), typeof(MalihuCustomScrollbarPluginScriptBundleContributor),
typeof(LuxonScriptContributor), typeof(LuxonScriptContributor),
typeof(TimeagoScriptContributor) typeof(TimeagoScriptContributor),
typeof(BootstrapDatepickerScriptContributor)
)] )]
public class SharedThemeGlobalScriptContributor : BundleContributor public class SharedThemeGlobalScriptContributor : BundleContributor
{ {

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalStyleContributor.cs

@ -17,7 +17,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling
typeof(ToastrStyleBundleContributor), typeof(ToastrStyleBundleContributor),
typeof(Select2StyleContributor), typeof(Select2StyleContributor),
typeof(MalihuCustomScrollbarPluginStyleBundleContributor), typeof(MalihuCustomScrollbarPluginStyleBundleContributor),
typeof(DatatablesNetBs4StyleContributor) typeof(DatatablesNetBs4StyleContributor),
typeof(BootstrapDatepickerStyleContributor)
)] )]
public class SharedThemeGlobalStyleContributor : BundleContributor public class SharedThemeGlobalStyleContributor : BundleContributor
{ {

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarOptions.cs → framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/AbpToolbarOptions.cs

@ -3,12 +3,12 @@ using JetBrains.Annotations;
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars
{ {
public class ToolbarOptions public class AbpToolbarOptions
{ {
[NotNull] [NotNull]
public List<IToolbarContributor> Contributors { get; } public List<IToolbarContributor> Contributors { get; }
public ToolbarOptions() public AbpToolbarOptions()
{ {
Contributors = new List<IToolbarContributor>(); Contributors = new List<IToolbarContributor>();
} }

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs

@ -10,11 +10,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars
public class ToolbarManager : IToolbarManager, ITransientDependency public class ToolbarManager : IToolbarManager, ITransientDependency
{ {
protected IThemeManager ThemeManager { get; } protected IThemeManager ThemeManager { get; }
protected ToolbarOptions Options { get; } protected AbpToolbarOptions Options { get; }
protected IServiceProvider ServiceProvider { get; } protected IServiceProvider ServiceProvider { get; }
public ToolbarManager( public ToolbarManager(
IOptions<ToolbarOptions> options, IOptions<AbpToolbarOptions> options,
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IThemeManager themeManager) IThemeManager themeManager)
{ {

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpAspNetCoreMvcUiWidgetsModule.cs

@ -29,7 +29,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{ {
context.Services.AddTransient<DefaultViewComponentHelper>(); context.Services.AddTransient<DefaultViewComponentHelper>();
Configure<VirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>
{ {
options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiWidgetsModule>(); options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiWidgetsModule>();
}); });
@ -47,7 +47,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
} }
}); });
services.Configure<WidgetOptions>(options => services.Configure<AbpWidgetOptions>(options =>
{ {
foreach (var widgetType in widgetTypes) foreach (var widgetType in widgetTypes)
{ {

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs

@ -14,13 +14,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
[Dependency(ReplaceServices = true)] [Dependency(ReplaceServices = true)]
public class AbpViewComponentHelper : IViewComponentHelper, IViewContextAware, ITransientDependency public class AbpViewComponentHelper : IViewComponentHelper, IViewContextAware, ITransientDependency
{ {
protected WidgetOptions Options { get; } protected AbpWidgetOptions Options { get; }
protected IPageWidgetManager PageWidgetManager { get; } protected IPageWidgetManager PageWidgetManager { get; }
protected DefaultViewComponentHelper DefaultViewComponentHelper { get; } protected DefaultViewComponentHelper DefaultViewComponentHelper { get; }
public AbpViewComponentHelper( public AbpViewComponentHelper(
DefaultViewComponentHelper defaultViewComponentHelper, DefaultViewComponentHelper defaultViewComponentHelper,
IOptions<WidgetOptions> widgetOptions, IOptions<AbpWidgetOptions> widgetOptions,
IPageWidgetManager pageWidgetManager) IPageWidgetManager pageWidgetManager)
{ {
DefaultViewComponentHelper = defaultViewComponentHelper; DefaultViewComponentHelper = defaultViewComponentHelper;

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetOptions.cs → framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpWidgetOptions.cs

@ -1,10 +1,10 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{ {
public class WidgetOptions public class AbpWidgetOptions
{ {
public WidgetDefinitionCollection Widgets { get; } public WidgetDefinitionCollection Widgets { get; }
public WidgetOptions() public AbpWidgetOptions()
{ {
Widgets = new WidgetDefinitionCollection(); Widgets = new WidgetDefinitionCollection();
} }

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/Components/WidgetScripts/WidgetScriptsViewComponent.cs

@ -7,11 +7,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetScripts
public class WidgetScriptsViewComponent : AbpViewComponent public class WidgetScriptsViewComponent : AbpViewComponent
{ {
protected IPageWidgetManager PageWidgetManager { get; } protected IPageWidgetManager PageWidgetManager { get; }
protected WidgetOptions Options { get; } protected AbpWidgetOptions Options { get; }
public WidgetScriptsViewComponent( public WidgetScriptsViewComponent(
IPageWidgetManager pageWidgetManager, IPageWidgetManager pageWidgetManager,
IOptions<WidgetOptions> options) IOptions<AbpWidgetOptions> options)
{ {
PageWidgetManager = pageWidgetManager; PageWidgetManager = pageWidgetManager;
Options = options.Value; Options = options.Value;

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/Components/WidgetStyles/WidgetStylesViewComponent.cs

@ -6,11 +6,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetStyles
public class WidgetStylesViewComponent : AbpViewComponent public class WidgetStylesViewComponent : AbpViewComponent
{ {
protected IPageWidgetManager PageWidgetManager { get; } protected IPageWidgetManager PageWidgetManager { get; }
protected WidgetOptions Options { get; } protected AbpWidgetOptions Options { get; }
public WidgetStylesViewComponent( public WidgetStylesViewComponent(
IPageWidgetManager pageWidgetManager, IPageWidgetManager pageWidgetManager,
IOptions<WidgetOptions> options) IOptions<AbpWidgetOptions> options)
{ {
PageWidgetManager = pageWidgetManager; PageWidgetManager = pageWidgetManager;
Options = options.Value; Options = options.Value;

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs

@ -9,12 +9,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{ {
public class WidgetManager : IWidgetManager public class WidgetManager : IWidgetManager
{ {
protected WidgetOptions Options { get; } protected AbpWidgetOptions Options { get; }
protected IAuthorizationService AuthorizationService { get; } protected IAuthorizationService AuthorizationService { get; }
protected ICurrentUser CurrentUser { get; } protected ICurrentUser CurrentUser { get; }
public WidgetManager( public WidgetManager(
IOptions<WidgetOptions> widgetOptions, IOptions<AbpWidgetOptions> widgetOptions,
IAuthorizationService authorizationService, IAuthorizationService authorizationService,
ICurrentUser currentUser) ICurrentUser currentUser)
{ {

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

@ -19,7 +19,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<VirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>
{ {
options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiModule>(); options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiModule>();
}); });

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/LayoutHookOptions.cs → framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/AbpLayoutHookOptions.cs

@ -3,16 +3,16 @@ using System.Collections.Generic;
namespace Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook namespace Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook
{ {
public class LayoutHookOptions public class AbpLayoutHookOptions
{ {
public IDictionary<string, List<LayoutHookInfo>> Hooks { get; } public IDictionary<string, List<LayoutHookInfo>> Hooks { get; }
public LayoutHookOptions() public AbpLayoutHookOptions()
{ {
Hooks = new Dictionary<string, List<LayoutHookInfo>>(); Hooks = new Dictionary<string, List<LayoutHookInfo>>();
} }
public LayoutHookOptions Add(string name, Type componentType, string layout = null) public AbpLayoutHookOptions Add(string name, Type componentType, string layout = null)
{ {
Hooks Hooks
.GetOrAdd(name, () => new List<LayoutHookInfo>()) .GetOrAdd(name, () => new List<LayoutHookInfo>())

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/LayoutHookViewComponent.cs

@ -7,9 +7,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook
{ {
public class LayoutHookViewComponent : AbpViewComponent public class LayoutHookViewComponent : AbpViewComponent
{ {
protected LayoutHookOptions Options { get; } protected AbpLayoutHookOptions Options { get; }
public LayoutHookViewComponent(IOptions<LayoutHookOptions> options) public LayoutHookViewComponent(IOptions<AbpLayoutHookOptions> options)
{ {
Options = options.Value; Options = options.Value;
} }

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/ThemingOptions.cs → framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/AbpThemingOptions.cs

@ -1,12 +1,12 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Theming namespace Volo.Abp.AspNetCore.Mvc.UI.Theming
{ {
public class ThemingOptions public class AbpThemingOptions
{ {
public ThemeDictionary Themes { get; } public ThemeDictionary Themes { get; }
public string DefaultThemeName { get; set; } public string DefaultThemeName { get; set; }
public ThemingOptions() public AbpThemingOptions()
{ {
Themes = new ThemeDictionary(); Themes = new ThemeDictionary();
} }

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/DefaultThemeSelector.cs

@ -6,9 +6,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theming
{ {
public class DefaultThemeSelector : IThemeSelector, ITransientDependency public class DefaultThemeSelector : IThemeSelector, ITransientDependency
{ {
protected ThemingOptions Options { get; } protected AbpThemingOptions Options { get; }
public DefaultThemeSelector(IOptions<ThemingOptions> options) public DefaultThemeSelector(IOptions<AbpThemingOptions> options)
{ {
Options = options.Value; Options = options.Value;
} }
@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theming
{ {
if (!Options.Themes.Any()) if (!Options.Themes.Any())
{ {
throw new AbpException($"No theme registered! Use {nameof(ThemingOptions)} to register themes."); throw new AbpException($"No theme registered! Use {nameof(AbpThemingOptions)} to register themes.");
} }
if (Options.DefaultThemeName == null) if (Options.DefaultThemeName == null)

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

@ -57,7 +57,7 @@ namespace Volo.Abp.AspNetCore.Mvc
) )
); );
Configure<ApiDescriptionModelOptions>(options => Configure<AbpApiDescriptionModelOptions>(options =>
{ {
options.IgnoredInterfaces.AddIfNotContains(typeof(IAsyncActionFilter)); options.IgnoredInterfaces.AddIfNotContains(typeof(IAsyncActionFilter));
options.IgnoredInterfaces.AddIfNotContains(typeof(IFilterMetadata)); options.IgnoredInterfaces.AddIfNotContains(typeof(IFilterMetadata));

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs

@ -4,11 +4,11 @@ namespace Volo.Abp.AspNetCore.Mvc
{ {
public class AbpAspNetCoreMvcOptions public class AbpAspNetCoreMvcOptions
{ {
public ConventionalControllerOptions ConventionalControllers { get; } public AbpConventionalControllerOptions ConventionalControllers { get; }
public AbpAspNetCoreMvcOptions() public AbpAspNetCoreMvcOptions()
{ {
ConventionalControllers = new ConventionalControllerOptions(); ConventionalControllers = new AbpConventionalControllerOptions();
} }
} }
} }

36
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs

@ -4,6 +4,7 @@ using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Authorization; using Volo.Abp.Authorization;
@ -31,10 +32,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IAbpAuthorizationPolicyProvider abpAuthorizationPolicyProvider, IAbpAuthorizationPolicyProvider abpAuthorizationPolicyProvider,
IAuthorizationService authorizationService, IAuthorizationService authorizationService,
ICurrentUser currentUser, ICurrentUser currentUser,
ISettingProvider settingProvider, ISettingProvider settingProvider,
SettingDefinitionManager settingDefinitionManager, SettingDefinitionManager settingDefinitionManager,
IFeatureDefinitionManager featureDefinitionManager, IFeatureDefinitionManager featureDefinitionManager,
ILanguageProvider languageProvider) ILanguageProvider languageProvider)
{ {
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
@ -112,9 +113,36 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
localizationConfig.Values[resource.ResourceName] = dictionary; localizationConfig.Values[resource.ResourceName] = dictionary;
} }
localizationConfig.CurrentCulture = GetCurrentCultureInfo();
return localizationConfig; return localizationConfig;
} }
private static CurrentCultureDto GetCurrentCultureInfo()
{
return new CurrentCultureDto
{
Name = CultureInfo.CurrentUICulture.Name,
DisplayName = CultureInfo.CurrentUICulture.DisplayName,
EnglishName = CultureInfo.CurrentUICulture.EnglishName,
NativeName = CultureInfo.CurrentUICulture.NativeName,
IsRightToLeft = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft,
CultureName = CultureInfo.CurrentUICulture.TextInfo.CultureName,
TwoLetterIsoLanguageName = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
ThreeLetterIsoLanguageName = CultureInfo.CurrentUICulture.ThreeLetterISOLanguageName,
DateTimeFormat = new DateTimeFormatDto
{
CalendarAlgorithmType = CultureInfo.CurrentUICulture.DateTimeFormat.Calendar.AlgorithmType.ToString(),
DateTimeFormatLong = CultureInfo.CurrentUICulture.DateTimeFormat.LongDatePattern,
ShortDatePattern = CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern,
FullDateTimePattern = CultureInfo.CurrentUICulture.DateTimeFormat.FullDateTimePattern,
DateSeparator = CultureInfo.CurrentUICulture.DateTimeFormat.DateSeparator,
ShortTimePattern = CultureInfo.CurrentUICulture.DateTimeFormat.ShortTimePattern,
LongTimePattern = CultureInfo.CurrentUICulture.DateTimeFormat.LongTimePattern,
}
};
}
private async Task<ApplicationSettingConfigurationDto> GetSettingConfigAsync() private async Task<ApplicationSettingConfigurationDto> GetSettingConfigAsync()
{ {
var result = new ApplicationSettingConfigurationDto var result = new ApplicationSettingConfigurationDto

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs

@ -25,12 +25,12 @@ namespace Volo.Abp.AspNetCore.Mvc
private readonly IApiDescriptionGroupCollectionProvider _descriptionProvider; private readonly IApiDescriptionGroupCollectionProvider _descriptionProvider;
private readonly AbpAspNetCoreMvcOptions _options; private readonly AbpAspNetCoreMvcOptions _options;
private readonly ApiDescriptionModelOptions _modelOptions; private readonly AbpApiDescriptionModelOptions _modelOptions;
public AspNetCoreApiDescriptionModelProvider( public AspNetCoreApiDescriptionModelProvider(
IApiDescriptionGroupCollectionProvider descriptionProvider, IApiDescriptionGroupCollectionProvider descriptionProvider,
IOptions<AbpAspNetCoreMvcOptions> options, IOptions<AbpAspNetCoreMvcOptions> options,
IOptions<ApiDescriptionModelOptions> modelOptions) IOptions<AbpApiDescriptionModelOptions> modelOptions)
{ {
_descriptionProvider = descriptionProvider; _descriptionProvider = descriptionProvider;
_options = options.Value; _options = options.Value;

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerOptions.cs → framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs

@ -7,13 +7,13 @@ using Volo.Abp.Http.Modeling;
namespace Volo.Abp.AspNetCore.Mvc.Conventions namespace Volo.Abp.AspNetCore.Mvc.Conventions
{ {
public class ConventionalControllerOptions public class AbpConventionalControllerOptions
{ {
public ConventionalControllerSettingList ConventionalControllerSettings { get; } public ConventionalControllerSettingList ConventionalControllerSettings { get; }
public List<Type> FormBodyBindingIgnoredTypes { get; } public List<Type> FormBodyBindingIgnoredTypes { get; }
public ConventionalControllerOptions() public AbpConventionalControllerOptions()
{ {
ConventionalControllerSettings = new ConventionalControllerSettingList(); ConventionalControllerSettings = new ConventionalControllerSettingList();
@ -23,7 +23,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions
}; };
} }
public ConventionalControllerOptions Create(Assembly assembly, [CanBeNull] Action<ConventionalControllerSetting> optionsAction = null) public AbpConventionalControllerOptions Create(Assembly assembly, [CanBeNull] Action<ConventionalControllerSetting> optionsAction = null)
{ {
var setting = new ConventionalControllerSetting(assembly, ModuleApiDescriptionModel.DefaultRootPath); var setting = new ConventionalControllerSetting(assembly, ModuleApiDescriptionModel.DefaultRootPath);
optionsAction?.Invoke(setting); optionsAction?.Invoke(setting);

1
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs

@ -29,6 +29,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization
{ {
return Redirect(GetRedirectUrl(returnUrl)); return Redirect(GetRedirectUrl(returnUrl));
} }
return Redirect("/"); return Redirect("/");
} }

8
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs

@ -13,9 +13,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
public class AbpUowActionFilter : IAsyncActionFilter, ITransientDependency public class AbpUowActionFilter : IAsyncActionFilter, ITransientDependency
{ {
private readonly IUnitOfWorkManager _unitOfWorkManager; private readonly IUnitOfWorkManager _unitOfWorkManager;
private readonly UnitOfWorkDefaultOptions _defaultOptions; private readonly AbpUnitOfWorkDefaultOptions _defaultOptions;
public AbpUowActionFilter(IUnitOfWorkManager unitOfWorkManager, IOptions<UnitOfWorkDefaultOptions> options) public AbpUowActionFilter(IUnitOfWorkManager unitOfWorkManager, IOptions<AbpUnitOfWorkDefaultOptions> options)
{ {
_unitOfWorkManager = unitOfWorkManager; _unitOfWorkManager = unitOfWorkManager;
_defaultOptions = options.Value; _defaultOptions = options.Value;
@ -68,9 +68,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
} }
} }
private UnitOfWorkOptions CreateOptions(ActionExecutingContext context, UnitOfWorkAttribute unitOfWorkAttribute) private AbpUnitOfWorkOptions CreateOptions(ActionExecutingContext context, UnitOfWorkAttribute unitOfWorkAttribute)
{ {
var options = new UnitOfWorkOptions(); var options = new AbpUnitOfWorkOptions();
unitOfWorkAttribute?.SetOptions(options); unitOfWorkAttribute?.SetOptions(options);

7
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs

@ -26,11 +26,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation
return; return;
} }
using (AbpCrossCuttingConcerns.Applying(context.Controller, AbpCrossCuttingConcerns.Validation)) _validator.Validate(context.ModelState);
{ await next();
_validator.Validate(context.ModelState);
await next();
}
} }
} }
} }

1
framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj

@ -19,6 +19,7 @@
<ProjectReference Include="..\Volo.Abp.AspNetCore\Volo.Abp.AspNetCore.csproj" /> <ProjectReference Include="..\Volo.Abp.AspNetCore\Volo.Abp.AspNetCore.csproj" />
<ProjectReference Include="..\Volo.Abp.Http.Client\Volo.Abp.Http.Client.csproj" /> <ProjectReference Include="..\Volo.Abp.Http.Client\Volo.Abp.Http.Client.csproj" />
<ProjectReference Include="..\Volo.Abp.TestBase\Volo.Abp.TestBase.csproj" /> <ProjectReference Include="..\Volo.Abp.TestBase\Volo.Abp.TestBase.csproj" />
<ProjectReference Include="..\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

33
framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs

@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.TestHost; using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Volo.Abp.AspNetCore.TestBase namespace Volo.Abp.AspNetCore.TestBase
{ {
@ -20,31 +22,36 @@ namespace Volo.Abp.AspNetCore.TestBase
protected AbpAspNetCoreIntegratedTestBase() protected AbpAspNetCoreIntegratedTestBase()
{ {
var builder = CreateWebHostBuilder(); var builder = CreateHostBuilder();
Server = CreateTestServer(builder);
Client = Server.CreateClient(); var host = builder.Build();
ServiceProvider = Server.Host.Services; host.Start();
Server = host.GetTestServer();
Client = host.GetTestClient();
ServiceProvider = Server.Services;
ServiceProvider.GetRequiredService<ITestServerAccessor>().Server = Server; ServiceProvider.GetRequiredService<ITestServerAccessor>().Server = Server;
} }
protected virtual IWebHostBuilder CreateWebHostBuilder() protected virtual IHostBuilder CreateHostBuilder()
{ {
return new WebHostBuilder() return Host.CreateDefaultBuilder()
.UseStartup<TStartup>() .ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<TStartup>();
webBuilder.UseTestServer();
})
.UseAutofac()
.ConfigureServices(ConfigureServices); .ConfigureServices(ConfigureServices);
} }
protected virtual void ConfigureServices(WebHostBuilderContext context, IServiceCollection services) protected virtual void ConfigureServices(HostBuilderContext context, IServiceCollection services)
{ {
} }
protected virtual TestServer CreateTestServer(IWebHostBuilder builder)
{
return new TestServer(builder);
}
#region GetUrl #region GetUrl
/// <summary> /// <summary>

4
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Hosting/AbpHostingEnvironmentExtensions.cs

@ -7,9 +7,9 @@ namespace Microsoft.AspNetCore.Hosting
{ {
public static IConfigurationRoot BuildConfiguration( public static IConfigurationRoot BuildConfiguration(
this IWebHostEnvironment env, this IWebHostEnvironment env,
ConfigurationBuilderOptions options = null) AbpConfigurationBuilderOptions options = null)
{ {
options = options ?? new ConfigurationBuilderOptions(); options = options ?? new AbpConfigurationBuilderOptions();
if (options.BasePath.IsNullOrEmpty()) if (options.BasePath.IsNullOrEmpty())
{ {

13
framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace Microsoft.Extensions.DependencyInjection namespace Microsoft.Extensions.DependencyInjection
{ {
@ -9,17 +8,5 @@ namespace Microsoft.Extensions.DependencyInjection
{ {
return services.GetSingletonInstance<IWebHostEnvironment>(); return services.GetSingletonInstance<IWebHostEnvironment>();
} }
public static IConfigurationRoot BuildConfiguration(this IServiceCollection services, ConfigurationBuilderOptions options = null)
{
return services.GetHostingEnvironment().BuildConfiguration(options);
}
public static IConfigurationRoot AddConfiguration(this IServiceCollection services, ConfigurationBuilderOptions options = null)
{
var configuration = services.BuildConfiguration(options);
services.SetConfiguration(configuration);
return configuration;
}
} }
} }

6
framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -18,6 +19,11 @@ namespace Volo.Abp
return context.ServiceProvider.GetRequiredService<IWebHostEnvironment>(); return context.ServiceProvider.GetRequiredService<IWebHostEnvironment>();
} }
public static IConfiguration GetConfiguration(this ApplicationInitializationContext context)
{
return context.ServiceProvider.GetRequiredService<IConfiguration>();
}
public static ILoggerFactory GetLoggerFactory(this ApplicationInitializationContext context) public static ILoggerFactory GetLoggerFactory(this ApplicationInitializationContext context)
{ {
return context.ServiceProvider.GetRequiredService<ILoggerFactory>(); return context.ServiceProvider.GetRequiredService<ILoggerFactory>();

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

@ -29,11 +29,6 @@ namespace Volo.Abp.AspNetCore
)] )]
public class AbpAspNetCoreModule : AbpModule public class AbpAspNetCoreModule : AbpModule
{ {
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddConfiguration();
}
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<AbpAuditingOptions>(options => Configure<AbpAuditingOptions>(options =>

4
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/ExceptionHttpStatusCodeOptions.cs → framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHttpStatusCodeOptions.cs

@ -3,11 +3,11 @@ using System.Net;
namespace Volo.Abp.AspNetCore.ExceptionHandling namespace Volo.Abp.AspNetCore.ExceptionHandling
{ {
public class ExceptionHttpStatusCodeOptions public class AbpExceptionHttpStatusCodeOptions
{ {
public IDictionary<string, HttpStatusCode> ErrorCodeToHttpStatusCodeMappings { get; } public IDictionary<string, HttpStatusCode> ErrorCodeToHttpStatusCodeMappings { get; }
public ExceptionHttpStatusCodeOptions() public AbpExceptionHttpStatusCodeOptions()
{ {
ErrorCodeToHttpStatusCodeMappings = new Dictionary<string, HttpStatusCode>(); ErrorCodeToHttpStatusCodeMappings = new Dictionary<string, HttpStatusCode>();
} }

4
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs

@ -21,13 +21,13 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling
{ {
public bool SendAllExceptionsToClients { get; set; } = false; public bool SendAllExceptionsToClients { get; set; } = false;
protected ExceptionLocalizationOptions LocalizationOptions { get; } protected AbpExceptionLocalizationOptions LocalizationOptions { get; }
protected IStringLocalizerFactory StringLocalizerFactory { get; } protected IStringLocalizerFactory StringLocalizerFactory { get; }
protected IStringLocalizer<AbpUiResource> L { get; } protected IStringLocalizer<AbpUiResource> L { get; }
protected IServiceProvider ServiceProvider { get; } protected IServiceProvider ServiceProvider { get; }
public DefaultExceptionToErrorInfoConverter( public DefaultExceptionToErrorInfoConverter(
IOptions<ExceptionLocalizationOptions> localizationOptions, IOptions<AbpExceptionLocalizationOptions> localizationOptions,
IStringLocalizerFactory stringLocalizerFactory, IStringLocalizerFactory stringLocalizerFactory,
IStringLocalizer<AbpUiResource> abpUiStringLocalizer, IStringLocalizer<AbpUiResource> abpUiStringLocalizer,
IServiceProvider serviceProvider) IServiceProvider serviceProvider)

4
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultHttpExceptionStatusCodeFinder.cs

@ -12,10 +12,10 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling
{ {
public class DefaultHttpExceptionStatusCodeFinder : IHttpExceptionStatusCodeFinder, ITransientDependency public class DefaultHttpExceptionStatusCodeFinder : IHttpExceptionStatusCodeFinder, ITransientDependency
{ {
protected ExceptionHttpStatusCodeOptions Options { get; } protected AbpExceptionHttpStatusCodeOptions Options { get; }
public DefaultHttpExceptionStatusCodeFinder( public DefaultHttpExceptionStatusCodeFinder(
IOptions<ExceptionHttpStatusCodeOptions> options) IOptions<AbpExceptionHttpStatusCodeOptions> options)
{ {
Options = options.Value; Options = options.Value;
} }

6
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs

@ -8,10 +8,10 @@ namespace Volo.Abp.AspNetCore.Tracing
{ {
public class AbpCorrelationIdMiddleware : IMiddleware, ITransientDependency public class AbpCorrelationIdMiddleware : IMiddleware, ITransientDependency
{ {
private readonly CorrelationIdOptions _options; private readonly AbpCorrelationIdOptions _options;
private readonly ICorrelationIdProvider _correlationIdProvider; private readonly ICorrelationIdProvider _correlationIdProvider;
public AbpCorrelationIdMiddleware(IOptions<CorrelationIdOptions> options, public AbpCorrelationIdMiddleware(IOptions<AbpCorrelationIdOptions> options,
ICorrelationIdProvider correlationIdProvider) ICorrelationIdProvider correlationIdProvider)
{ {
_options = options.Value; _options = options.Value;
@ -34,7 +34,7 @@ namespace Volo.Abp.AspNetCore.Tracing
protected virtual void CheckAndSetCorrelationIdOnResponse( protected virtual void CheckAndSetCorrelationIdOnResponse(
HttpContext httpContext, HttpContext httpContext,
CorrelationIdOptions options, AbpCorrelationIdOptions options,
string correlationId) string correlationId)
{ {
if (httpContext.Response.HasStarted) if (httpContext.Response.HasStarted)

4
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AspNetCoreCorrelationIdProvider.cs

@ -10,11 +10,11 @@ namespace Volo.Abp.AspNetCore.Tracing
public class AspNetCoreCorrelationIdProvider : ICorrelationIdProvider, ITransientDependency public class AspNetCoreCorrelationIdProvider : ICorrelationIdProvider, ITransientDependency
{ {
protected IHttpContextAccessor HttpContextAccessor { get; } protected IHttpContextAccessor HttpContextAccessor { get; }
protected CorrelationIdOptions Options { get; } protected AbpCorrelationIdOptions Options { get; }
public AspNetCoreCorrelationIdProvider( public AspNetCoreCorrelationIdProvider(
IHttpContextAccessor httpContextAccessor, IHttpContextAccessor httpContextAccessor,
IOptions<CorrelationIdOptions> options) IOptions<AbpCorrelationIdOptions> options)
{ {
HttpContextAccessor = httpContextAccessor; HttpContextAccessor = httpContextAccessor;
Options = options.Value; Options = options.Value;

4
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/AspNetCoreContentOptions.cs → framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/AbpAspNetCoreContentOptions.cs

@ -2,12 +2,12 @@
namespace Volo.Abp.AspNetCore.VirtualFileSystem namespace Volo.Abp.AspNetCore.VirtualFileSystem
{ {
public class AspNetCoreContentOptions public class AbpAspNetCoreContentOptions
{ {
public List<string> AllowedExtraWebContentFolders { get; } public List<string> AllowedExtraWebContentFolders { get; }
public List<string> AllowedExtraWebContentFileExtensions { get; } public List<string> AllowedExtraWebContentFileExtensions { get; }
public AspNetCoreContentOptions() public AbpAspNetCoreContentOptions()
{ {
AllowedExtraWebContentFolders = new List<string> AllowedExtraWebContentFolders = new List<string>
{ {

4
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs

@ -17,12 +17,12 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem
private readonly IWebHostEnvironment _hostingEnvironment; private readonly IWebHostEnvironment _hostingEnvironment;
private string _rootPath = "/wwwroot"; //TODO: How to handle wwwroot naming? private string _rootPath = "/wwwroot"; //TODO: How to handle wwwroot naming?
protected AspNetCoreContentOptions Options { get; } protected AbpAspNetCoreContentOptions Options { get; }
public WebContentFileProvider( public WebContentFileProvider(
IVirtualFileProvider virtualFileProvider, IVirtualFileProvider virtualFileProvider,
IWebHostEnvironment hostingEnvironment, IWebHostEnvironment hostingEnvironment,
IOptions<AspNetCoreContentOptions> options) IOptions<AbpAspNetCoreContentOptions> options)
{ {
_virtualFileProvider = virtualFileProvider; _virtualFileProvider = virtualFileProvider;
_hostingEnvironment = hostingEnvironment; _hostingEnvironment = hostingEnvironment;

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

@ -29,7 +29,7 @@ namespace Volo.Abp.Authorization
context.Services.AddSingleton<IAuthorizationHandler, PermissionRequirementHandler>(); context.Services.AddSingleton<IAuthorizationHandler, PermissionRequirementHandler>();
Configure<PermissionOptions>(options => Configure<AbpPermissionOptions>(options =>
{ {
options.ValueProviders.Add<UserPermissionValueProvider>(); options.ValueProviders.Add<UserPermissionValueProvider>();
options.ValueProviders.Add<RolePermissionValueProvider>(); options.ValueProviders.Add<RolePermissionValueProvider>();
@ -49,7 +49,7 @@ namespace Volo.Abp.Authorization
} }
}); });
services.Configure<PermissionOptions>(options => services.Configure<AbpPermissionOptions>(options =>
{ {
options.DefinitionProviders.AddIfNotContains(definitionProviders); options.DefinitionProviders.AddIfNotContains(definitionProviders);
}); });

13
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs

@ -1,5 +1,4 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Aspects;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy; using Volo.Abp.DynamicProxy;
using Volo.Abp.Threading; using Volo.Abp.Threading;
@ -17,24 +16,12 @@ namespace Volo.Abp.Authorization
public override void Intercept(IAbpMethodInvocation invocation) public override void Intercept(IAbpMethodInvocation invocation)
{ {
if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.Authorization))
{
invocation.Proceed();
return;
}
AsyncHelper.RunSync(() => AuthorizeAsync(invocation)); AsyncHelper.RunSync(() => AuthorizeAsync(invocation));
invocation.Proceed(); invocation.Proceed();
} }
public override async Task InterceptAsync(IAbpMethodInvocation invocation) public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{ {
if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.Authorization))
{
await invocation.ProceedAsync();
return;
}
await AuthorizeAsync(invocation); await AuthorizeAsync(invocation);
await invocation.ProceedAsync(); await invocation.ProceedAsync();
} }

4
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionOptions.cs → framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/AbpPermissionOptions.cs

@ -2,13 +2,13 @@
namespace Volo.Abp.Authorization.Permissions namespace Volo.Abp.Authorization.Permissions
{ {
public class PermissionOptions public class AbpPermissionOptions
{ {
public ITypeList<IPermissionDefinitionProvider> DefinitionProviders { get; } public ITypeList<IPermissionDefinitionProvider> DefinitionProviders { get; }
public ITypeList<IPermissionValueProvider> ValueProviders { get; } public ITypeList<IPermissionValueProvider> ValueProviders { get; }
public PermissionOptions() public AbpPermissionOptions()
{ {
DefinitionProviders = new TypeList<IPermissionDefinitionProvider>(); DefinitionProviders = new TypeList<IPermissionDefinitionProvider>();
ValueProviders = new TypeList<IPermissionValueProvider>(); ValueProviders = new TypeList<IPermissionValueProvider>();

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs

@ -5,7 +5,7 @@ namespace Volo.Abp.Authorization.Permissions
{ {
public class ClientPermissionValueProvider : PermissionValueProvider public class ClientPermissionValueProvider : PermissionValueProvider
{ {
public const string ProviderName = "Client"; public const string ProviderName = "C";
public override string Name => ProviderName; public override string Name => ProviderName;

4
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinitionManager.cs

@ -16,12 +16,12 @@ namespace Volo.Abp.Authorization.Permissions
protected IDictionary<string, PermissionDefinition> PermissionDefinitions => _lazyPermissionDefinitions.Value; protected IDictionary<string, PermissionDefinition> PermissionDefinitions => _lazyPermissionDefinitions.Value;
private readonly Lazy<Dictionary<string, PermissionDefinition>> _lazyPermissionDefinitions; private readonly Lazy<Dictionary<string, PermissionDefinition>> _lazyPermissionDefinitions;
protected PermissionOptions Options { get; } protected AbpPermissionOptions Options { get; }
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
public PermissionDefinitionManager( public PermissionDefinitionManager(
IOptions<PermissionOptions> options, IOptions<AbpPermissionOptions> options,
IServiceProvider serviceProvider) IServiceProvider serviceProvider)
{ {
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;

4
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionValueProviderManager.cs

@ -12,11 +12,11 @@ namespace Volo.Abp.Authorization.Permissions
public IReadOnlyList<IPermissionValueProvider> ValueProviders => _lazyProviders.Value; public IReadOnlyList<IPermissionValueProvider> ValueProviders => _lazyProviders.Value;
private readonly Lazy<List<IPermissionValueProvider>> _lazyProviders; private readonly Lazy<List<IPermissionValueProvider>> _lazyProviders;
protected PermissionOptions Options { get; } protected AbpPermissionOptions Options { get; }
public PermissionValueProviderManager( public PermissionValueProviderManager(
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IOptions<PermissionOptions> options) IOptions<AbpPermissionOptions> options)
{ {
Options = options.Value; Options = options.Value;

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs

@ -6,7 +6,7 @@ namespace Volo.Abp.Authorization.Permissions
{ {
public class RolePermissionValueProvider : PermissionValueProvider public class RolePermissionValueProvider : PermissionValueProvider
{ {
public const string ProviderName = "Role"; public const string ProviderName = "R";
public override string Name => ProviderName; public override string Name => ProviderName;

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs

@ -5,7 +5,7 @@ namespace Volo.Abp.Authorization.Permissions
{ {
public class UserPermissionValueProvider : PermissionValueProvider public class UserPermissionValueProvider : PermissionValueProvider
{ {
public const string ProviderName = "User"; public const string ProviderName = "U";
public override string Name => ProviderName; public override string Name => ProviderName;

4
framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobOptions.cs → framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobOptions.cs

@ -4,7 +4,7 @@ using System.Collections.Immutable;
namespace Volo.Abp.BackgroundJobs namespace Volo.Abp.BackgroundJobs
{ {
public class BackgroundJobOptions public class AbpBackgroundJobOptions
{ {
private readonly Dictionary<Type, BackgroundJobConfiguration> _jobConfigurationsByArgsType; private readonly Dictionary<Type, BackgroundJobConfiguration> _jobConfigurationsByArgsType;
private readonly Dictionary<string, BackgroundJobConfiguration> _jobConfigurationsByName; private readonly Dictionary<string, BackgroundJobConfiguration> _jobConfigurationsByName;
@ -15,7 +15,7 @@ namespace Volo.Abp.BackgroundJobs
/// </summary> /// </summary>
public bool IsJobExecutionEnabled { get; set; } = true; public bool IsJobExecutionEnabled { get; set; } = true;
public BackgroundJobOptions() public AbpBackgroundJobOptions()
{ {
_jobConfigurationsByArgsType = new Dictionary<Type, BackgroundJobConfiguration>(); _jobConfigurationsByArgsType = new Dictionary<Type, BackgroundJobConfiguration>();
_jobConfigurationsByName = new Dictionary<string, BackgroundJobConfiguration>(); _jobConfigurationsByName = new Dictionary<string, BackgroundJobConfiguration>();

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

@ -29,7 +29,7 @@ namespace Volo.Abp.BackgroundJobs
} }
}); });
services.Configure<BackgroundJobOptions>(options => services.Configure<AbpBackgroundJobOptions>(options =>
{ {
foreach (var jobType in jobTypes) foreach (var jobType in jobTypes)
{ {

4
framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs

@ -10,9 +10,9 @@ namespace Volo.Abp.BackgroundJobs
{ {
public ILogger<BackgroundJobExecuter> Logger { protected get; set; } public ILogger<BackgroundJobExecuter> Logger { protected get; set; }
protected BackgroundJobOptions Options { get; } protected AbpBackgroundJobOptions Options { get; }
public BackgroundJobExecuter(IOptions<BackgroundJobOptions> options) public BackgroundJobExecuter(IOptions<AbpBackgroundJobOptions> options)
{ {
Options = options.Value; Options = options.Value;

4
framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs

@ -5,12 +5,12 @@ namespace Volo.Abp.BackgroundJobs.Hangfire
{ {
public class HangfireJobExecutionAdapter<TArgs> public class HangfireJobExecutionAdapter<TArgs>
{ {
protected BackgroundJobOptions Options { get; } protected AbpBackgroundJobOptions Options { get; }
protected IServiceScopeFactory ServiceScopeFactory { get; } protected IServiceScopeFactory ServiceScopeFactory { get; }
protected IBackgroundJobExecuter JobExecuter { get; } protected IBackgroundJobExecuter JobExecuter { get; }
public HangfireJobExecutionAdapter( public HangfireJobExecutionAdapter(
IOptions<BackgroundJobOptions> options, IOptions<AbpBackgroundJobOptions> options,
IBackgroundJobExecuter jobExecuter, IBackgroundJobExecuter jobExecuter,
IServiceScopeFactory serviceScopeFactory) IServiceScopeFactory serviceScopeFactory)
{ {

4
framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/RabbitMqBackgroundJobOptions.cs → framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/AbpRabbitMqBackgroundJobOptions.cs

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace Volo.Abp.BackgroundJobs.RabbitMQ namespace Volo.Abp.BackgroundJobs.RabbitMQ
{ {
public class RabbitMqBackgroundJobOptions public class AbpRabbitMqBackgroundJobOptions
{ {
/// <summary> /// <summary>
/// Key: Job Args Type /// Key: Job Args Type
@ -15,7 +15,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
/// </summary> /// </summary>
public string DefaultQueueNamePrefix { get; set; } public string DefaultQueueNamePrefix { get; set; }
public RabbitMqBackgroundJobOptions() public AbpRabbitMqBackgroundJobOptions()
{ {
JobQueues = new Dictionary<Type, JobQueueConfiguration>(); JobQueues = new Dictionary<Type, JobQueueConfiguration>();
DefaultQueueNamePrefix = "AbpBackgroundJobs."; DefaultQueueNamePrefix = "AbpBackgroundJobs.";

22
framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs

@ -24,8 +24,8 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
public ILogger<JobQueue<TArgs>> Logger { get; set; } public ILogger<JobQueue<TArgs>> Logger { get; set; }
protected BackgroundJobOptions BackgroundJobOptions { get; } protected AbpBackgroundJobOptions AbpBackgroundJobOptions { get; }
protected RabbitMqBackgroundJobOptions RabbitMqBackgroundJobOptions { get; } protected AbpRabbitMqBackgroundJobOptions AbpRabbitMqBackgroundJobOptions { get; }
protected IChannelPool ChannelPool { get; } protected IChannelPool ChannelPool { get; }
protected IRabbitMqSerializer Serializer { get; } protected IRabbitMqSerializer Serializer { get; }
protected IBackgroundJobExecuter JobExecuter { get; } protected IBackgroundJobExecuter JobExecuter { get; }
@ -35,21 +35,21 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
protected bool IsDiposed { get; private set; } protected bool IsDiposed { get; private set; }
public JobQueue( public JobQueue(
IOptions<BackgroundJobOptions> backgroundJobOptions, IOptions<AbpBackgroundJobOptions> backgroundJobOptions,
IOptions<RabbitMqBackgroundJobOptions> rabbitMqBackgroundJobOptions, IOptions<AbpRabbitMqBackgroundJobOptions> rabbitMqAbpBackgroundJobOptions,
IChannelPool channelPool, IChannelPool channelPool,
IRabbitMqSerializer serializer, IRabbitMqSerializer serializer,
IBackgroundJobExecuter jobExecuter, IBackgroundJobExecuter jobExecuter,
IServiceScopeFactory serviceScopeFactory) IServiceScopeFactory serviceScopeFactory)
{ {
BackgroundJobOptions = backgroundJobOptions.Value; AbpBackgroundJobOptions = backgroundJobOptions.Value;
RabbitMqBackgroundJobOptions = rabbitMqBackgroundJobOptions.Value; AbpRabbitMqBackgroundJobOptions = rabbitMqAbpBackgroundJobOptions.Value;
Serializer = serializer; Serializer = serializer;
JobExecuter = jobExecuter; JobExecuter = jobExecuter;
ServiceScopeFactory = serviceScopeFactory; ServiceScopeFactory = serviceScopeFactory;
ChannelPool = channelPool; ChannelPool = channelPool;
JobConfiguration = BackgroundJobOptions.GetJob(typeof(TArgs)); JobConfiguration = AbpBackgroundJobOptions.GetJob(typeof(TArgs));
QueueConfiguration = GetOrCreateJobQueueConfiguration(); QueueConfiguration = GetOrCreateJobQueueConfiguration();
Logger = NullLogger<JobQueue<TArgs>>.Instance; Logger = NullLogger<JobQueue<TArgs>>.Instance;
@ -57,10 +57,10 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
protected virtual JobQueueConfiguration GetOrCreateJobQueueConfiguration() protected virtual JobQueueConfiguration GetOrCreateJobQueueConfiguration()
{ {
return RabbitMqBackgroundJobOptions.JobQueues.GetOrDefault(typeof(TArgs)) ?? return AbpRabbitMqBackgroundJobOptions.JobQueues.GetOrDefault(typeof(TArgs)) ??
new JobQueueConfiguration( new JobQueueConfiguration(
typeof(TArgs), typeof(TArgs),
RabbitMqBackgroundJobOptions.DefaultQueueNamePrefix + JobConfiguration.JobName AbpRabbitMqBackgroundJobOptions.DefaultQueueNamePrefix + JobConfiguration.JobName
); );
} }
@ -85,7 +85,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
{ {
CheckDisposed(); CheckDisposed();
if (!BackgroundJobOptions.IsJobExecutionEnabled) if (!AbpBackgroundJobOptions.IsJobExecutionEnabled)
{ {
return; return;
} }
@ -129,7 +129,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
var result = QueueConfiguration.Declare(ChannelAccessor.Channel); var result = QueueConfiguration.Declare(ChannelAccessor.Channel);
Logger.LogDebug($"RabbitMQ Queue '{QueueConfiguration.QueueName}' has {result.MessageCount} messages and {result.ConsumerCount} consumers."); Logger.LogDebug($"RabbitMQ Queue '{QueueConfiguration.QueueName}' has {result.MessageCount} messages and {result.ConsumerCount} consumers.");
if (BackgroundJobOptions.IsJobExecutionEnabled) if (AbpBackgroundJobOptions.IsJobExecutionEnabled)
{ {
Consumer = new EventingBasicConsumer(ChannelAccessor.Channel); Consumer = new EventingBasicConsumer(ChannelAccessor.Channel);
Consumer.Received += MessageReceived; Consumer.Received += MessageReceived;

4
framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs

@ -15,10 +15,10 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
protected IServiceProvider ServiceProvider { get; } protected IServiceProvider ServiceProvider { get; }
protected BackgroundJobOptions Options { get; } protected AbpBackgroundJobOptions Options { get; }
public JobQueueManager( public JobQueueManager(
IOptions<BackgroundJobOptions> options, IOptions<AbpBackgroundJobOptions> options,
IServiceProvider serviceProvider) IServiceProvider serviceProvider)
{ {
ServiceProvider = serviceProvider; ServiceProvider = serviceProvider;

4
framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorkerOptions.cs → framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/AbpBackgroundJobWorkerOptions.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.BackgroundJobs namespace Volo.Abp.BackgroundJobs
{ {
public class BackgroundJobWorkerOptions public class AbpBackgroundJobWorkerOptions
{ {
/// <summary> /// <summary>
/// Interval between polling jobs from <see cref="IBackgroundJobStore"/>. /// Interval between polling jobs from <see cref="IBackgroundJobStore"/>.
@ -33,7 +33,7 @@
/// </summary> /// </summary>
public double DefaultWaitFactor { get; set; } public double DefaultWaitFactor { get; set; }
public BackgroundJobWorkerOptions() public AbpBackgroundJobWorkerOptions()
{ {
MaxJobFetchCount = 1000; MaxJobFetchCount = 1000;
JobPollPeriod = 5000; JobPollPeriod = 5000;

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

@ -17,7 +17,7 @@ namespace Volo.Abp.BackgroundJobs
{ {
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)
{ {
var options = context.ServiceProvider.GetRequiredService<IOptions<BackgroundJobOptions>>().Value; var options = context.ServiceProvider.GetRequiredService<IOptions<AbpBackgroundJobOptions>>().Value;
if (options.IsJobExecutionEnabled) if (options.IsJobExecutionEnabled)
{ {
context.ServiceProvider context.ServiceProvider

8
framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs

@ -11,16 +11,16 @@ namespace Volo.Abp.BackgroundJobs
{ {
public class BackgroundJobWorker : PeriodicBackgroundWorkerBase, IBackgroundJobWorker public class BackgroundJobWorker : PeriodicBackgroundWorkerBase, IBackgroundJobWorker
{ {
protected BackgroundJobOptions JobOptions { get; } protected AbpBackgroundJobOptions JobOptions { get; }
protected BackgroundJobWorkerOptions WorkerOptions { get; } protected AbpBackgroundJobWorkerOptions WorkerOptions { get; }
protected IServiceScopeFactory ServiceScopeFactory { get; } protected IServiceScopeFactory ServiceScopeFactory { get; }
public BackgroundJobWorker( public BackgroundJobWorker(
AbpTimer timer, AbpTimer timer,
IOptions<BackgroundJobOptions> jobOptions, IOptions<AbpBackgroundJobOptions> jobOptions,
IOptions<BackgroundJobWorkerOptions> workerOptions, IOptions<AbpBackgroundJobWorkerOptions> workerOptions,
IServiceScopeFactory serviceScopeFactory) IServiceScopeFactory serviceScopeFactory)
: base(timer) : base(timer)
{ {

2
framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerOptions.cs → framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AbpBackgroundWorkerOptions.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.BackgroundWorkers namespace Volo.Abp.BackgroundWorkers
{ {
public class BackgroundWorkerOptions public class AbpBackgroundWorkerOptions
{ {
/// <summary> /// <summary>
/// Default: true. /// Default: true.

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

@ -12,7 +12,7 @@ namespace Volo.Abp.BackgroundWorkers
{ {
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)
{ {
var options = context.ServiceProvider.GetRequiredService<IOptions<BackgroundWorkerOptions>>().Value; var options = context.ServiceProvider.GetRequiredService<IOptions<AbpBackgroundWorkerOptions>>().Value;
if (options.IsEnabled) if (options.IsEnabled)
{ {
AsyncHelper.RunSync( AsyncHelper.RunSync(
@ -25,7 +25,7 @@ namespace Volo.Abp.BackgroundWorkers
public override void OnApplicationShutdown(ApplicationShutdownContext context) public override void OnApplicationShutdown(ApplicationShutdownContext context)
{ {
var options = context.ServiceProvider.GetRequiredService<IOptions<BackgroundWorkerOptions>>().Value; var options = context.ServiceProvider.GetRequiredService<IOptions<AbpBackgroundWorkerOptions>>().Value;
if (options.IsEnabled) if (options.IsEnabled)
{ {
AsyncHelper.RunSync( AsyncHelper.RunSync(

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

@ -21,8 +21,9 @@ namespace Volo.Abp.Caching
context.Services.AddDistributedMemoryCache(); context.Services.AddDistributedMemoryCache();
context.Services.AddSingleton(typeof(IDistributedCache<>), typeof(DistributedCache<>)); context.Services.AddSingleton(typeof(IDistributedCache<>), typeof(DistributedCache<>));
context.Services.AddSingleton(typeof(IDistributedCache<,>), typeof(DistributedCache<,>));
context.Services.Configure<CacheOptions>(cacheOptions => context.Services.Configure<AbpDistributedCacheOptions>(cacheOptions =>
{ {
cacheOptions.GlobalCacheEntryOptions.SlidingExpiration = TimeSpan.FromMinutes(20); cacheOptions.GlobalCacheEntryOptions.SlidingExpiration = TimeSpan.FromMinutes(20);
}); });

17
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/CacheOptions.cs → framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpDistributedCacheOptions.cs

@ -1,11 +1,16 @@
using Microsoft.Extensions.Caching.Distributed; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Extensions.Caching.Distributed;
namespace Volo.Abp.Caching namespace Volo.Abp.Caching
{ {
public class CacheOptions public class AbpDistributedCacheOptions
{ {
/// <summary>
/// Throw or hide exceptions for the distributed cache.
/// </summary>
public bool HideErrors { get; set; } = true;
/// <summary> /// <summary>
/// Cache key prefix. /// Cache key prefix.
/// </summary> /// </summary>
@ -20,13 +25,13 @@ namespace Volo.Abp.Caching
/// List of all cache configurators. /// List of all cache configurators.
/// (func argument:Name of cache) /// (func argument:Name of cache)
/// </summary> /// </summary>
public List<Func<string, DistributedCacheEntryOptions>> CacheConfigurators { get; set; } //TODO list item use a configurator interface instead? public List<Func<string, DistributedCacheEntryOptions>> CacheConfigurators { get; set; } //TODO: use a configurator interface instead?
public CacheOptions() public AbpDistributedCacheOptions()
{ {
CacheConfigurators = new List<Func<string, DistributedCacheEntryOptions>>(); CacheConfigurators = new List<Func<string, DistributedCacheEntryOptions>>();
GlobalCacheEntryOptions = new DistributedCacheEntryOptions(); GlobalCacheEntryOptions = new DistributedCacheEntryOptions();
KeyPrefix = ""; KeyPrefix = "";
} }
} }
} }

179
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs

@ -15,10 +15,36 @@ namespace Volo.Abp.Caching
/// Represents a distributed cache of <typeparamref name="TCacheItem" /> type. /// Represents a distributed cache of <typeparamref name="TCacheItem" /> type.
/// </summary> /// </summary>
/// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam> /// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam>
public class DistributedCache<TCacheItem> : IDistributedCache<TCacheItem> public class DistributedCache<TCacheItem> : DistributedCache<TCacheItem, string>, IDistributedCache<TCacheItem>
where TCacheItem : class where TCacheItem : class
{ {
public ILogger<DistributedCache<TCacheItem>> Logger { get; set; } public DistributedCache(
IOptions<CacheOptions> cacheOption,
IOptions<DistributedCacheOptions> distributedCacheOption,
IDistributedCache cache,
ICancellationTokenProvider cancellationTokenProvider,
IDistributedCacheSerializer serializer,
ICurrentTenant currentTenant) : base(
cacheOption: cacheOption,
distributedCacheOption: distributedCacheOption,
cache: cache,
cancellationTokenProvider: cancellationTokenProvider,
serializer: serializer,
currentTenant: currentTenant)
{
}
}
/// <summary>
/// Represents a distributed cache of <typeparamref name="TCacheItem" /> type.
/// Uses a generic cache key type of <typeparamref name="TCacheKey" /> type.
/// </summary>
/// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam>
/// <typeparam name="TCacheKey">The type of cache key being used.</typeparam>
public class DistributedCache<TCacheItem, TCacheKey> : IDistributedCache<TCacheItem, TCacheKey>
where TCacheItem : class
{
public ILogger<DistributedCache<TCacheItem, TCacheKey>> Logger { get; set; }
protected string CacheName { get; set; } protected string CacheName { get; set; }
@ -36,13 +62,13 @@ namespace Volo.Abp.Caching
protected DistributedCacheEntryOptions DefaultCacheOptions; protected DistributedCacheEntryOptions DefaultCacheOptions;
private readonly CacheOptions _cacheOption; private readonly AbpDistributedCacheOptions _cacheOption;
private readonly DistributedCacheOptions _distributedCacheOption; private readonly AbpDistributedCacheOptions _distributedCacheOption;
public DistributedCache( public DistributedCache(
IOptions<CacheOptions> cacheOption, IOptions<AbpDistributedCacheOptions> cacheOption,
IOptions<DistributedCacheOptions> distributedCacheOption, IOptions<AbpDistributedCacheOptions> distributedCacheOption,
IDistributedCache cache, IDistributedCache cache,
ICancellationTokenProvider cancellationTokenProvider, ICancellationTokenProvider cancellationTokenProvider,
IDistributedCacheSerializer serializer, IDistributedCacheSerializer serializer,
@ -52,7 +78,7 @@ namespace Volo.Abp.Caching
_cacheOption = cacheOption.Value; _cacheOption = cacheOption.Value;
Cache = cache; Cache = cache;
CancellationTokenProvider = cancellationTokenProvider; CancellationTokenProvider = cancellationTokenProvider;
Logger = NullLogger<DistributedCache<TCacheItem>>.Instance; Logger = NullLogger<DistributedCache<TCacheItem, TCacheKey>>.Instance;
Serializer = serializer; Serializer = serializer;
CurrentTenant = currentTenant; CurrentTenant = currentTenant;
@ -60,7 +86,41 @@ namespace Volo.Abp.Caching
SetDefaultOptions(); SetDefaultOptions();
} }
protected virtual string NormalizeKey(TCacheKey key)
{
var normalizedKey = "c:" + CacheName + ",k:" + _cacheOption.KeyPrefix + key.ToString();
if (!IgnoreMultiTenancy && CurrentTenant.Id.HasValue)
{
normalizedKey = "t:" + CurrentTenant.Id.Value + "," + normalizedKey;
}
return normalizedKey;
}
protected virtual DistributedCacheEntryOptions GetDefaultCacheEntryOptions()
{
foreach (var configure in _cacheOption.CacheConfigurators)
{
var options = configure.Invoke(CacheName);
if (options != null)
{
return options;
}
}
return _cacheOption.GlobalCacheEntryOptions;
}
protected virtual void SetDefaultOptions()
{
CacheName = CacheNameAttribute.GetCacheName(typeof(TCacheItem));
//IgnoreMultiTenancy
IgnoreMultiTenancy = typeof(TCacheItem).IsDefined(typeof(IgnoreMultiTenancyAttribute), true);
//Configure default cache entry options
DefaultCacheOptions = GetDefaultCacheEntryOptions();
}
/// <summary> /// <summary>
/// Gets a cache item with the given key. If no cache item is found for the given key then returns null. /// Gets a cache item with the given key. If no cache item is found for the given key then returns null.
/// </summary> /// </summary>
@ -68,7 +128,7 @@ namespace Volo.Abp.Caching
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <returns>The cache item, or null.</returns> /// <returns>The cache item, or null.</returns>
public virtual TCacheItem Get( public virtual TCacheItem Get(
string key, TCacheKey key,
bool? hideErrors = null) bool? hideErrors = null)
{ {
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -106,8 +166,8 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The cache item, or null.</returns> /// <returns>The cache item, or null.</returns>
public virtual async Task<TCacheItem> GetAsync( public virtual async Task<TCacheItem> GetAsync(
string key, TCacheKey key,
bool? hideErrors = null, bool? hideErrors = null,
CancellationToken token = default) CancellationToken token = default)
{ {
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -131,7 +191,7 @@ namespace Volo.Abp.Caching
throw; throw;
} }
if (cachedBytes == null) if (cachedBytes == null)
{ {
return null; return null;
@ -139,7 +199,6 @@ namespace Volo.Abp.Caching
return Serializer.Deserialize<TCacheItem>(cachedBytes); return Serializer.Deserialize<TCacheItem>(cachedBytes);
} }
/// <summary> /// <summary>
/// Gets or Adds a cache item with the given key. If no cache item is found for the given key then adds a cache item /// Gets or Adds a cache item with the given key. If no cache item is found for the given key then adds a cache item
/// provided by <paramref name="factory" /> delegate and returns the provided cache item. /// provided by <paramref name="factory" /> delegate and returns the provided cache item.
@ -149,10 +208,10 @@ namespace Volo.Abp.Caching
/// <param name="optionsFactory">The cache options for the factory delegate.</param> /// <param name="optionsFactory">The cache options for the factory delegate.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <returns>The cache item.</returns> /// <returns>The cache item.</returns>
public TCacheItem GetOrAdd( public virtual TCacheItem GetOrAdd(
string key, TCacheKey key,
Func<TCacheItem> factory, Func<TCacheItem> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null, Func<DistributedCacheEntryOptions> optionsFactory = null,
bool? hideErrors = null) bool? hideErrors = null)
{ {
var value = Get(key, hideErrors); var value = Get(key, hideErrors);
@ -175,7 +234,6 @@ namespace Volo.Abp.Caching
return value; return value;
} }
/// <summary> /// <summary>
/// Gets or Adds a cache item with the given key. If no cache item is found for the given key then adds a cache item /// Gets or Adds a cache item with the given key. If no cache item is found for the given key then adds a cache item
/// provided by <paramref name="factory" /> delegate and returns the provided cache item. /// provided by <paramref name="factory" /> delegate and returns the provided cache item.
@ -186,11 +244,11 @@ namespace Volo.Abp.Caching
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The cache item.</returns> /// <returns>The cache item.</returns>
public async Task<TCacheItem> GetOrAddAsync( public virtual async Task<TCacheItem> GetOrAddAsync(
string key, TCacheKey key,
Func<Task<TCacheItem>> factory, Func<Task<TCacheItem>> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null, Func<DistributedCacheEntryOptions> optionsFactory = null,
bool? hideErrors = null, bool? hideErrors = null,
CancellationToken token = default) CancellationToken token = default)
{ {
token = CancellationTokenProvider.FallbackToProvider(token); token = CancellationTokenProvider.FallbackToProvider(token);
@ -214,7 +272,6 @@ namespace Volo.Abp.Caching
return value; return value;
} }
/// <summary> /// <summary>
/// Sets the cache item value for the provided key. /// Sets the cache item value for the provided key.
/// </summary> /// </summary>
@ -223,9 +280,9 @@ namespace Volo.Abp.Caching
/// <param name="options">The cache options for the value.</param> /// <param name="options">The cache options for the value.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
public virtual void Set( public virtual void Set(
string key, TCacheKey key,
TCacheItem value, TCacheItem value,
DistributedCacheEntryOptions options = null, DistributedCacheEntryOptions options = null,
bool? hideErrors = null) bool? hideErrors = null)
{ {
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -249,7 +306,6 @@ namespace Volo.Abp.Caching
throw; throw;
} }
} }
/// <summary> /// <summary>
/// Sets the cache item value for the provided key. /// Sets the cache item value for the provided key.
/// </summary> /// </summary>
@ -260,10 +316,10 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns> /// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
public virtual async Task SetAsync( public virtual async Task SetAsync(
string key, TCacheKey key,
TCacheItem value, TCacheItem value,
DistributedCacheEntryOptions options = null, DistributedCacheEntryOptions options = null,
bool? hideErrors = null, bool? hideErrors = null,
CancellationToken token = default) CancellationToken token = default)
{ {
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -288,15 +344,14 @@ namespace Volo.Abp.Caching
throw; throw;
} }
} }
/// <summary> /// <summary>
/// Refreshes the cache value of the given key, and resets its sliding expiration timeout. /// Refreshes the cache value of the given key, and resets its sliding expiration timeout.
/// </summary> /// </summary>
/// <param name="key">The key of cached item to be retrieved from the cache.</param> /// <param name="key">The key of cached item to be retrieved from the cache.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
public virtual void Refresh( public virtual void Refresh(
string key, TCacheKey key, bool?
bool? hideErrors = null) hideErrors = null)
{ {
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -315,7 +370,6 @@ namespace Volo.Abp.Caching
throw; throw;
} }
} }
/// <summary> /// <summary>
/// Refreshes the cache value of the given key, and resets its sliding expiration timeout. /// Refreshes the cache value of the given key, and resets its sliding expiration timeout.
/// </summary> /// </summary>
@ -324,8 +378,8 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns> /// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
public virtual async Task RefreshAsync( public virtual async Task RefreshAsync(
string key, TCacheKey key,
bool? hideErrors = null, bool? hideErrors = null,
CancellationToken token = default) CancellationToken token = default)
{ {
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -345,15 +399,13 @@ namespace Volo.Abp.Caching
throw; throw;
} }
} }
/// <summary> /// <summary>
/// Removes the cache item for given key from cache. /// Removes the cache item for given key from cache.
/// </summary> /// </summary>
/// <param name="key">The key of cached item to be retrieved from the cache.</param> /// <param name="key">The key of cached item to be retrieved from the cache.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
public virtual void Remove( public virtual void Remove(
string key, TCacheKey key,
bool? hideErrors = null) bool? hideErrors = null)
{ {
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -372,7 +424,6 @@ namespace Volo.Abp.Caching
throw; throw;
} }
} }
/// <summary> /// <summary>
/// Removes the cache item for given key from cache. /// Removes the cache item for given key from cache.
/// </summary> /// </summary>
@ -381,8 +432,8 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns> /// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
public virtual async Task RemoveAsync( public virtual async Task RemoveAsync(
string key, TCacheKey key,
bool? hideErrors = null, bool? hideErrors = null,
CancellationToken token = default) CancellationToken token = default)
{ {
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -401,42 +452,8 @@ namespace Volo.Abp.Caching
throw; throw;
} }
} }
protected virtual string NormalizeKey(string key) }
{
var normalizedKey = "c:" + CacheName + ",k:" + _cacheOption.KeyPrefix + key;
if (!IgnoreMultiTenancy && CurrentTenant.Id.HasValue)
{
normalizedKey = "t:" + CurrentTenant.Id.Value + "," + normalizedKey;
}
return normalizedKey;
}
protected virtual DistributedCacheEntryOptions GetDefaultCacheEntryOptions()
{
foreach (var configure in _cacheOption.CacheConfigurators)
{
var options = configure.Invoke(CacheName);
if (options != null)
{
return options;
}
}
return _cacheOption.GlobalCacheEntryOptions;
}
protected virtual void SetDefaultOptions()
{
CacheName = CacheNameAttribute.GetCacheName(typeof(TCacheItem));
//IgnoreMultiTenancy
IgnoreMultiTenancy = typeof(TCacheItem).IsDefined(typeof(IgnoreMultiTenancyAttribute), true);
//Configure default cache entry options
DefaultCacheOptions = GetDefaultCacheEntryOptions();
}
}
} }

10
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheOptions.cs

@ -1,10 +0,0 @@
namespace Volo.Abp.Caching
{
public class DistributedCacheOptions
{
/// <summary>
/// Throw or hide exceptions for the distributed cache.
/// </summary>
public bool HideErrors { get; set; } = true;
}
}

33
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs

@ -10,7 +10,18 @@ namespace Volo.Abp.Caching
/// Represents a distributed cache of <typeparamref name="TCacheItem" /> type. /// Represents a distributed cache of <typeparamref name="TCacheItem" /> type.
/// </summary> /// </summary>
/// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam> /// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam>
public interface IDistributedCache<TCacheItem> public interface IDistributedCache<TCacheItem> : IDistributedCache<TCacheItem, string>
where TCacheItem : class
{
}
/// <summary>
/// Represents a distributed cache of <typeparamref name="TCacheItem" /> type.
/// Uses a generic cache key type of <typeparamref name="TCacheKey" /> type.
/// </summary>
/// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam>
/// <typeparam name="TCacheKey">The type of cache key being used.</typeparam>
public interface IDistributedCache<TCacheItem, TCacheKey>
where TCacheItem : class where TCacheItem : class
{ {
/// <summary> /// <summary>
@ -20,7 +31,7 @@ namespace Volo.Abp.Caching
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <returns>The cache item, or null.</returns> /// <returns>The cache item, or null.</returns>
TCacheItem Get( TCacheItem Get(
string key, TCacheKey key,
bool? hideErrors = null bool? hideErrors = null
); );
@ -32,7 +43,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The cache item, or null.</returns> /// <returns>The cache item, or null.</returns>
Task<TCacheItem> GetAsync( Task<TCacheItem> GetAsync(
[NotNull] string key, [NotNull] TCacheKey key,
bool? hideErrors = null, bool? hideErrors = null,
CancellationToken token = default CancellationToken token = default
); );
@ -47,7 +58,7 @@ namespace Volo.Abp.Caching
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <returns>The cache item.</returns> /// <returns>The cache item.</returns>
TCacheItem GetOrAdd( TCacheItem GetOrAdd(
string key, TCacheKey key,
Func<TCacheItem> factory, Func<TCacheItem> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null, Func<DistributedCacheEntryOptions> optionsFactory = null,
bool? hideErrors = null bool? hideErrors = null
@ -64,7 +75,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The cache item.</returns> /// <returns>The cache item.</returns>
Task<TCacheItem> GetOrAddAsync( Task<TCacheItem> GetOrAddAsync(
[NotNull] string key, [NotNull] TCacheKey key,
Func<Task<TCacheItem>> factory, Func<Task<TCacheItem>> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null, Func<DistributedCacheEntryOptions> optionsFactory = null,
bool? hideErrors = null, bool? hideErrors = null,
@ -79,7 +90,7 @@ namespace Volo.Abp.Caching
/// <param name="options">The cache options for the value.</param> /// <param name="options">The cache options for the value.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
void Set( void Set(
string key, TCacheKey key,
TCacheItem value, TCacheItem value,
DistributedCacheEntryOptions options = null, DistributedCacheEntryOptions options = null,
bool? hideErrors = null bool? hideErrors = null
@ -95,7 +106,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns> /// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
Task SetAsync( Task SetAsync(
[NotNull] string key, [NotNull] TCacheKey key,
[NotNull] TCacheItem value, [NotNull] TCacheItem value,
[CanBeNull] DistributedCacheEntryOptions options = null, [CanBeNull] DistributedCacheEntryOptions options = null,
bool? hideErrors = null, bool? hideErrors = null,
@ -108,7 +119,7 @@ namespace Volo.Abp.Caching
/// <param name="key">The key of cached item to be retrieved from the cache.</param> /// <param name="key">The key of cached item to be retrieved from the cache.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
void Refresh( void Refresh(
string key, TCacheKey key,
bool? hideErrors = null bool? hideErrors = null
); );
@ -120,7 +131,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns> /// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
Task RefreshAsync( Task RefreshAsync(
string key, TCacheKey key,
bool? hideErrors = null, bool? hideErrors = null,
CancellationToken token = default CancellationToken token = default
); );
@ -131,7 +142,7 @@ namespace Volo.Abp.Caching
/// <param name="key">The key of cached item to be retrieved from the cache.</param> /// <param name="key">The key of cached item to be retrieved from the cache.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param> /// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
void Remove( void Remove(
string key, TCacheKey key,
bool? hideErrors = null bool? hideErrors = null
); );
@ -143,7 +154,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param> /// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns> /// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
Task RemoveAsync( Task RemoveAsync(
string key, TCacheKey key,
bool? hideErrors = null, bool? hideErrors = null,
CancellationToken token = default CancellationToken token = default
); );

8
framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj

@ -15,10 +15,10 @@
<PackageReference Include="SharpZipLib" Version="1.2.0" /> <PackageReference Include="SharpZipLib" Version="1.2.0" />
<PackageReference Include="HtmlAgilityPack.NetCore" Version="1.5.0.1" /> <PackageReference Include="HtmlAgilityPack.NetCore" Version="1.5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="NuGet.Versioning" Version="5.2.0" /> <PackageReference Include="NuGet.Versioning" Version="5.3.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" /> <PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0" />
<PackageReference Include="System.Security.Permissions" Version="4.5.0" /> <PackageReference Include="System.Security.Permissions" Version="4.6.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.2.1" /> <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.3.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs

@ -23,7 +23,7 @@ namespace Volo.Abp.Cli
// a permanent fix will probably be published with the release of .net core 3.0: https://github.com/dotnet/corefx/issues/36553 // a permanent fix will probably be published with the release of .net core 3.0: https://github.com/dotnet/corefx/issues/36553
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false); AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
Configure<CliOptions>(options => Configure<AbpCliOptions>(options =>
{ {
options.Commands["help"] = typeof(HelpCommand); options.Commands["help"] = typeof(HelpCommand);
options.Commands["new"] = typeof(NewCommand); options.Commands["new"] = typeof(NewCommand);

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save