Browse Source

Merge remote-tracking branch 'upstream/dev' into dev

pull/2528/head
Mehmet Tüken 7 years ago
parent
commit
0cb6389fed
  1. 2
      abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj
  2. 5
      abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalizationModule.cs
  3. 0
      docs/cs/Entity-Framework-Core-PostgreSQL.md
  4. 2
      docs/cs/docs-nav.json
  5. 7
      docs/en/Best-Practices/Entity-Framework-Core-Integration.md
  6. 8
      docs/en/Data-Access.md
  7. 17
      docs/en/Entity-Framework-Core-MySQL.md
  8. 0
      docs/en/Entity-Framework-Core-PostgreSQL.md
  9. 44
      docs/en/Entity-Framework-Core.md
  10. 53
      docs/en/Settings.md
  11. 2
      docs/en/docs-nav.json
  12. 2
      docs/pt-BR/docs-nav.json
  13. 7
      docs/zh-Hans/Best-Practices/Entity-Framework-Core-Integration.md
  14. 0
      docs/zh-Hans/Entity-Framework-Core-PostgreSQL.md
  15. 51
      docs/zh-Hans/Settings.md
  16. 2
      docs/zh-Hans/docs-nav.json
  17. 4
      framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs
  18. 8
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs
  19. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs
  20. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs
  21. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs
  22. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs
  23. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs
  24. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs
  25. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs
  26. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs
  27. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs
  28. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs
  29. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs
  30. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs
  31. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperExtensions.cs
  32. 20
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs
  33. 16
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs
  34. 16
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs
  35. 18
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs
  36. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs
  37. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs
  38. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs
  39. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs
  40. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs
  41. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs
  42. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs
  43. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs
  44. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs
  45. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs
  46. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs
  47. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs
  48. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/MainNavbarMenuViewComponent.cs
  49. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/LanguageSwitchViewComponent.cs
  50. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/MainNavbarToolsViewComponent.cs
  51. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/UserMenuViewComponent.cs
  52. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Toolbars/BasicThemeMainTopToolbarContributor.cs
  53. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs
  54. 10
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs
  55. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs
  56. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs
  57. 15
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
  58. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs
  59. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs
  60. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs
  61. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs
  62. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs
  63. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinder.cs
  64. 9
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxyScriptController.cs
  65. 31
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Response/AbpNoContentActionFilter.cs
  66. 14
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs
  67. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs
  68. 4
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs
  69. 6
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs
  70. 6
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs
  71. 6
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs
  72. 2
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs
  73. 4
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs
  74. 4
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs
  75. 4
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs
  76. 38
      framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs
  77. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs
  78. 6
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs
  79. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs
  80. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs
  81. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs
  82. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs
  83. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs
  84. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs
  85. 10
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs
  86. 8
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs
  87. 4
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/RabbitMqBackgroundJobManager.cs
  88. 4
      framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs
  89. 4
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs
  90. 4
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs
  91. 18
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs
  92. 2
      framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs
  93. 4
      framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs
  94. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs
  95. 16
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs
  96. 11
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs
  97. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs
  98. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs
  99. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs
  100. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs

2
abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj

@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\framework\src\Volo.Abp.Localization\Volo.Abp.Localization.csproj" /> <ProjectReference Include="..\..\..\framework\src\Volo.Abp.Validation\Volo.Abp.Validation.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

5
abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalizationModule.cs

@ -8,13 +8,14 @@ using AbpIoLocalization.Support.Localization;
using AbpIoLocalization.Www; using AbpIoLocalization.Www;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.Validation;
using Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
namespace AbpIoLocalization namespace AbpIoLocalization
{ {
[DependsOn(typeof(AbpLocalizationModule))] [DependsOn(typeof(AbpValidationModule))]
public class AbpIoLocalizationModule : AbpModule public class AbpIoLocalizationModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)

0
docs/cs/EntityFrameworkCore-PostgreSQL-Integration.md → docs/cs/Entity-Framework-Core-PostgreSQL.md

2
docs/cs/docs-nav.json

@ -264,7 +264,7 @@
"items": [ "items": [
{ {
"text": "PostgreSQL integrace", "text": "PostgreSQL integrace",
"path": "EntityFrameworkCore-PostgreSQL-Integration.md" "path": "Entity-Framework-Core-PostgreSQL.md"
} }
] ]
}, },

7
docs/en/Best-Practices/Entity-Framework-Core-Integration.md

@ -174,12 +174,12 @@ public static IQueryable<IdentityUser> IncludeDetails(
* **Do** use the `IncludeDetails` extension method in the repository methods just like used in the example code above (see FindByNormalizedUserNameAsync). * **Do** use the `IncludeDetails` extension method in the repository methods just like used in the example code above (see FindByNormalizedUserNameAsync).
- **Do** override `IncludeDetails` method of the repository for aggregates root which have **sub collections**. Example: - **Do** override `WithDetails` method of the repository for aggregates root which have **sub collections**. Example:
````C# ````C#
protected override IQueryable<IdentityUser> IncludeDetails(IQueryable<IdentityUser> queryable) public override IQueryable<IdentityUser> WithDetails()
{ {
return queryable.IncludeDetails(); //uses the extension method defined above return GetQueryable().IncludeDetails(); // Uses the extension method defined above
} }
```` ````
@ -206,4 +206,3 @@ public class AbpIdentityEntityFrameworkCoreModule : AbpModule
} }
} }
```` ````

8
docs/en/Data-Access.md

@ -1,11 +1,9 @@
# Data Access # Data Access
ABP framework was designed as database agnostic, it can work any type of data source by the help of the [repository](Repositories.md) and [unit of work](Unit-Of-Work.md) abstractions. ABP framework was designed as database agnostic. It can work any type of data source by the help of the [repository](Repositories.md) and [unit of work](Unit-Of-Work.md) abstractions. However, currently the following providers are implemented:
However, currently the following providers are implements: * [Entity Framework Core](Entity-Framework-Core.md) (works with [various DBMS and providers](https://docs.microsoft.com/en-us/ef/core/providers/).)
* [Entity Framework Core](Entity-Framework-Core.md) (works with [various DBMS and providers](https://docs.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli).)
* [MongoDB](MongoDB.md) * [MongoDB](MongoDB.md)
* [Dapper](Dapper.md) * [Dapper](Dapper.md)
More providers might be added in the next releases. More providers will be added in the future.

17
docs/en/Entity-Framework-Core-MySQL.md

@ -0,0 +1,17 @@
# Entity Framework Core MySQL Database Provider
This document explains how to switch to the **MySQL** database provider for **[the application startup template](Startup-Templates/Application.md)** which comes with SQL Server provider pre-configured.
## Replace the Volo.Abp.EntityFrameworkCore.SqlServer Package
`.EntityFrameworkCore` project in the solution depends on the [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer) NuGet package. Remove this package and add the same version of the [Volo.Abp.EntityFrameworkCore.MySQL](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.MySQL) package.
## Replace the Module Dependency
Find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, remove `typeof(AbpEntityFrameworkCoreSqlServerModule)` from the `DependsOn` attribute, add `typeof(AbpEntityFrameworkCoreMySQLModule)` (also replace `using Volo.Abp.EntityFrameworkCore.SqlServer;` with `using Volo.Abp.EntityFrameworkCore.MySQL;`).
## Call UseMySQL
Find `UseSqlServer()` calls in your solution, replace with `UseMySQL()`
TODO

0
docs/en/EntityFrameworkCore-PostgreSQL-Integration.md → docs/en/Entity-Framework-Core-PostgreSQL.md

44
docs/en/Entity-Framework-Core.md

@ -28,6 +28,17 @@ namespace MyCompany.MyProject
> Note: Instead, you can directly download a [startup template](https://abp.io/Templates) with EF Core pre-installed. > Note: Instead, you can directly download a [startup template](https://abp.io/Templates) with EF Core pre-installed.
### Database Management System Selection
Entity Framework Core supports various database management systems ([see all](https://docs.microsoft.com/en-us/ef/core/providers/)). ABP framework and this document doesn't depend on any specific DBMS.
If you are creating a reusable library, avoid to depend on a specific DBMS package. However, in a final application you eventually will select a DBMS.
ABP framework provides integration packages for some common DBMSs to make the configuration a bit easier. [The startup templates](Startup-Templates/Index.md) come with **SQL Server (localdb) pre-configured**. See the following documents to learn how to configure for the other DBMS providers:
* [MySQL](Entity-Framework-Core-MySQL.md)
* [PostgreSQL](Entity-Framework-Core-PostgreSQL.md)
## Creating DbContext ## Creating DbContext
You can create your DbContext as you normally do. It should be derived from `AbpDbContext<T>` as shown below: You can create your DbContext as you normally do. It should be derived from `AbpDbContext<T>` as shown below:
@ -62,7 +73,7 @@ public class MyDbContext : AbpDbContext<MyDbContext>
} }
``` ```
If you don't configure, the `Default` connection string is used. If you configure a specific connection string name, but not define this connection string name in the application configuration then it fallbacks to the `Default` connection string. If you don't configure, the `Default` connection string is used. If you configure a specific connection string name, but not define this connection string name in the application configuration then it fallbacks to the `Default` connection string (see [the connection strings document](Connection-Strings.md) for more information).
## Registering DbContext To Dependency Injection ## Registering DbContext To Dependency Injection
@ -126,7 +137,8 @@ public class BookManager : DomainService
{ {
private readonly IRepository<Book, Guid> _bookRepository; private readonly IRepository<Book, Guid> _bookRepository;
public BookManager(IRepository<Book, Guid> bookRepository) //inject default repository //inject default repository to the constructor
public BookManager(IRepository<Book, Guid> bookRepository)
{ {
_bookRepository = bookRepository; _bookRepository = bookRepository;
} }
@ -142,7 +154,8 @@ public class BookManager : DomainService
Type = type Type = type
}; };
await _bookRepository.InsertAsync(book); //Use a standard repository method //Use a standard repository method
await _bookRepository.InsertAsync(book);
return book; return book;
} }
@ -153,9 +166,9 @@ This sample uses `InsertAsync` method to insert a new entity to the database.
### Add Custom Repositories ### Add Custom Repositories
Default generic repositories are powerful enough in most cases (since they implement `IQueryable`). However, you may need to create a custom repository to add your own repository methods. Default generic repositories are powerful enough in most cases (since they implement `IQueryable`). However, you may need to create a custom repository to add your own repository methods. Assume that you want to delete all books by type.
Assume that you want to delete all books by type. It's suggested to define an interface for your custom repository: It's suggested to define an interface for your custom repository:
````csharp ````csharp
public interface IBookRepository : IRepository<Book, Guid> public interface IBookRepository : IRepository<Book, Guid>
@ -187,21 +200,23 @@ public class BookRepository : EfCoreRepository<BookStoreDbContext, Book, Guid>,
Now, it's possible to [inject](Dependency-Injection.md) the `IBookRepository` and use the `DeleteBooksByType` method when needed. Now, it's possible to [inject](Dependency-Injection.md) the `IBookRepository` and use the `DeleteBooksByType` method when needed.
#### Override Default Generic Repository #### Override the Default Generic Repository
Even if you create a custom repository, you can still inject the default generic repository (`IRepository<Book, Guid>` for this example). Default repository implementation will not use the class you have created. Even if you create a custom repository, you can still inject the default generic repository (`IRepository<Book, Guid>` for this example). Default repository implementation will not use the class you have created.
If you want to replace default repository implementation with your custom repository, do it inside `AddAbpDbContext` options: If you want to replace default repository implementation with your custom repository, do it inside the `AddAbpDbContext` options:
````csharp ````csharp
context.Services.AddAbpDbContext<BookStoreDbContext>(options => context.Services.AddAbpDbContext<BookStoreDbContext>(options =>
{ {
options.AddDefaultRepositories(); options.AddDefaultRepositories();
options.AddRepository<Book, BookRepository>(); //Replaces IRepository<Book, Guid>
//Replaces IRepository<Book, Guid>
options.AddRepository<Book, BookRepository>();
}); });
```` ````
This is especially important when you want to **override a base repository method** to customize it. For instance, you may want to override `DeleteAsync` method to delete an entity in a more efficient way: This is especially important when you want to **override a base repository method** to customize it. For instance, you may want to override `DeleteAsync` method to delete a specific entity in a more efficient way:
````csharp ````csharp
public override async Task DeleteAsync( public override async Task DeleteAsync(
@ -215,7 +230,7 @@ public override async Task DeleteAsync(
### Access to the EF Core API ### Access to the EF Core API
In most cases, you want to hide EF Core APIs behind a repository (this is the main purpose of the repository). However, if you want to access the DbContext instance over the repository, you can use `GetDbContext()` or `GetDbSet()` extension methods. Example: In most cases, you want to hide EF Core APIs behind a repository (this is the main purpose of the repository pattern). However, if you want to access the `DbContext` instance over the repository, you can use `GetDbContext()` or `GetDbSet()` extension methods. Example:
````csharp ````csharp
public class BookService public class BookService
@ -243,9 +258,9 @@ public class BookService
#### Set Default Repository Classes #### Set Default Repository Classes
Default generic repositories are implemented by `EfCoreRepository` class by default. You can create your own implementation and use it for default repository implementation. Default generic repositories are implemented by `EfCoreRepository` class by default. You can create your own implementation and use it for all the default repository implementations.
First, define your repository classes like that: First, define your default repository classes like that:
```csharp ```csharp
public class MyRepositoryBase<TEntity> public class MyRepositoryBase<TEntity>
@ -271,7 +286,7 @@ public class MyRepositoryBase<TEntity, TKey>
First one is for [entities with composite keys](Entities.md), second one is for entities with single primary key. First one is for [entities with composite keys](Entities.md), second one is for entities with single primary key.
It's suggested to inherit from the `EfCoreRepository` class and override methods if needed. Otherwise, you will have to implement all standard repository methods manually. It's suggested to inherit from the `EfCoreRepository` class and override methods if needed. Otherwise, you will have to implement all the standard repository methods manually.
Now, you can use `SetDefaultRepositoryClasses` option: Now, you can use `SetDefaultRepositoryClasses` option:
@ -282,6 +297,7 @@ context.Services.AddAbpDbContext<BookStoreDbContext>(options =>
typeof(MyRepositoryBase<,>), typeof(MyRepositoryBase<,>),
typeof(MyRepositoryBase<>) typeof(MyRepositoryBase<>)
); );
//... //...
}); });
``` ```
@ -316,7 +332,7 @@ public class BookRepository : EfCoreRepository<IBookStoreDbContext, Book, Guid>,
} }
```` ````
One advantage of using interface for a DbContext is then it becomes replaceable by another implementation. One advantage of using an interface for a DbContext is then it will be replaceable by another implementation.
#### Replace Other DbContextes #### Replace Other DbContextes

53
docs/en/Settings.md

@ -40,6 +40,33 @@ ABP automatically discovers this class and registers the setting definitions.
* **Providers**: Can be used to restrict providers available for a particular setting (see the setting value providers section for more). * **Providers**: Can be used to restrict providers available for a particular setting (see the setting value providers section for more).
* **Properties**: A name/value collection to set custom properties about this setting those can be used later in the application code. * **Properties**: A name/value collection to set custom properties about this setting those can be used later in the application code.
### Change Setting Definitions of a Depended Module
In some cases, you may want to change some properties of a settings defined in some other module that your application/module depends on. A setting definition provider can query and update setting definitions.
The following example gets a setting defined by the [Volo.Abp.Emailing](Emailing.md) package and changes its properties:
````csharp
public class MySettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
var smtpHost = context.GetOrNull("Abp.Mailing.Smtp.Host");
if (smtpHost != null)
{
smtpHost.DefaultValue = "mail.mydomain.com";
smtpHost.DisplayName =
new LocalizableString(
typeof(MyLocalizationResource),
"SmtpServer_DisplayName"
);
}
}
}
````
> Using constants for the setting names is a good practice and ABP packages do it. `Abp.Mailing.Smtp.Host` setting name is a constant defined by the `EmailSettingNames` class (in the `Volo.Abp.Emailing` namespace).
## Reading Setting Values ## Reading Setting Values
### ISettingProvider ### ISettingProvider
@ -118,6 +145,30 @@ There are 5 pre-built setting value providers registered by the order below:
Global, Tenant and User setting value providers use the `ISettingStore` to read the value from the data source (see the section below). Global, Tenant and User setting value providers use the `ISettingStore` to read the value from the data source (see the section below).
### Setting Values in the Application Configuration
As mentioned in the previous section, `ConfigurationSettingValueProvider` reads the settings from the `IConfiguration` service, which can read values from the `appsettings.json` by default. So, the easiest way to configure setting values to define them in the `appsettings.json` file.
For example, you can configure [IEmailSender](Emailing.md) settings as shown below:
````json
{
"Settings": {
"Abp.Mailing.DefaultFromAddress": "noreply@mydomain.com",
"Abp.Mailing.DefaultFromDisplayName": "My Application",
"Abp.Mailing.Smtp.Host": "mail.mydomain.com",
"Abp.Mailing.Smtp.Port": "547",
"Abp.Mailing.Smtp.UserName": "myusername",
"Abp.Mailing.Smtp.Password": "mySecretPassW00rd",
"Abp.Mailing.Smtp.EnableSsl": "True"
}
}
````
Setting values should be configured under the `Settings` section as like in this example.
> `IConfiguration` is an .NET Core service and it can read values not only from the `appsettings.json`, but also from the environment, user secrets... etc. See [Microsoft's documentation]( https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/ ) for more.
### Custom Setting Value Providers ### Custom Setting Value Providers
If you need to extend the setting system, you can define a class derived from the `SettingValueProvider` class. Example: If you need to extend the setting system, you can define a class derived from the `SettingValueProvider` class. Example:
@ -165,7 +216,7 @@ This example adds it as the last item, so it will be the first value provider us
### ISettingStore ### ISettingStore
While a setting value provider is free to use any source to get the setting value, the`ISettingStore` service is the default source of the setting values. Global, Tenant and User setting value providers use it. While a setting value provider is free to use any source to get the setting value, the `ISettingStore` service is the default source of the setting values. Global, Tenant and User setting value providers use it.
## ISettingEncryptionService ## ISettingEncryptionService

2
docs/en/docs-nav.json

@ -265,7 +265,7 @@
"items": [ "items": [
{ {
"text": "PostgreSQL Integration", "text": "PostgreSQL Integration",
"path": "EntityFrameworkCore-PostgreSQL-Integration.md" "path": "Entity-Framework-Core-PostgreSQL.md"
} }
] ]
}, },

2
docs/pt-BR/docs-nav.json

@ -249,7 +249,7 @@
"items": [ "items": [
{ {
"text": "Integração do PostgreSQL", "text": "Integração do PostgreSQL",
"path": "EntityFrameworkCore-PostgreSQL-Integration.md" "path": "Entity-Framework-Core-PostgreSQL.md"
} }
] ]
}, },

7
docs/zh-Hans/Best-Practices/Entity-Framework-Core-Integration.md

@ -173,12 +173,12 @@ public static IQueryable<IdentityUser> IncludeDetails(
* **推荐** 推荐在仓储其他方法中使用 `IncludeDetails` 扩展方法, 就像上面的示例代码一样(参阅 FindByNormalizedUserNameAsync). * **推荐** 推荐在仓储其他方法中使用 `IncludeDetails` 扩展方法, 就像上面的示例代码一样(参阅 FindByNormalizedUserNameAsync).
- **推荐** 覆盖具有 **子集合** 的聚合根仓储中的`IncludeDetails` 方法. 例如: - **推荐** 覆盖具有 **子集合** 的聚合根仓储中的 `WithDetails` 方法. 例如:
````C# ````C#
protected override IQueryable<IdentityUser> IncludeDetails(IQueryable<IdentityUser> queryable) public override IQueryable<IdentityUser> WithDetails()
{ {
return queryable.IncludeDetails(); //uses the extension method defined above return GetQueryable().IncludeDetails(); // Uses the extension method defined above
} }
```` ````
@ -205,4 +205,3 @@ public class AbpIdentityEntityFrameworkCoreModule : AbpModule
} }
} }
```` ````

0
docs/zh-Hans/EntityFrameworkCore-PostgreSQL-Integration.md → docs/zh-Hans/Entity-Framework-Core-PostgreSQL.md

51
docs/zh-Hans/Settings.md

@ -40,6 +40,33 @@ ABP会自动发现并注册设置的定义.
* **Providers**: 限制可用于特定的设置值提供程序(参阅设置值提供程序部分了解更多). * **Providers**: 限制可用于特定的设置值提供程序(参阅设置值提供程序部分了解更多).
* **Properties**: 设置此值的自定义属性 名称/值 集合,可以在之后的应用程序代码中使用. * **Properties**: 设置此值的自定义属性 名称/值 集合,可以在之后的应用程序代码中使用.
### 更改依赖模块的设置定义
在某些情况下,你可能希望更改应用程序/模块所依赖的其他模块中定义的设置的某些属性. 设置定义提供程序可以查询和更新设置定义.
下面的示例中获取了由 [Volo.Abp.Emailing](Emailing.md) 包定义的设置并将其更改:
````csharp
public class MySettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
var smtpHost = context.GetOrNull("Abp.Mailing.Smtp.Host");
if (smtpHost != null)
{
smtpHost.DefaultValue = "mail.mydomain.com";
smtpHost.DisplayName =
new LocalizableString(
typeof(MyLocalizationResource),
"SmtpServer_DisplayName"
);
}
}
}
````
> 使用常量作为设置名称是一种好习惯,ABP的包就是这样做的. `Abp.Mailing.Smtp`设置名称是在`EmailSettingNames`类(在Volo.Abp.Emailing名称空间中)定义的常量.
## 读取设置值 ## 读取设置值
### ISettingProvider ### ISettingProvider
@ -118,6 +145,30 @@ var requireDigit = abp.setting.getBoolean('Abp.Identity.Password.RequireDigit');
全局,租户和用户设置值提供程序使用 `ISettingStore` 从数据源读取值(参见下面的小节). 全局,租户和用户设置值提供程序使用 `ISettingStore` 从数据源读取值(参见下面的小节).
### 在应用程序配置中设置值
上一节提到 `ConfigurationSettingValueProvider` 从 `IConfiguration` 服务中读取设置, 该服务默认从 `appsettings.json` 中读取值. 所以在 `appsettings.json` 文件中配置设置值是最简单的方式.
例如你可以像以下方式一样配置 [IEmailSender](Emailing.md) 设置:
````json
{
"Settings": {
"Abp.Mailing.DefaultFromAddress": "noreply@mydomain.com",
"Abp.Mailing.DefaultFromDisplayName": "My Application",
"Abp.Mailing.Smtp.Host": "mail.mydomain.com",
"Abp.Mailing.Smtp.Port": "547",
"Abp.Mailing.Smtp.UserName": "myusername",
"Abp.Mailing.Smtp.Password": "mySecretPassW00rd",
"Abp.Mailing.Smtp.EnableSsl": "True"
}
}
````
设置值应该在 `Settings` 部分配置,如本例所示.
> `IConfiguration`是.NET Core的服务,它不仅可以从 `appsettings.json` 中读取值,还可以从环境,用户机密...等中读取值. 有关更多信息请参阅[微软文档](https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/).
### 自定义设置值提供程序 ### 自定义设置值提供程序
扩展设置系统的方式是定义一个派生自 `SettingValueProvider` 的类. 示例: 扩展设置系统的方式是定义一个派生自 `SettingValueProvider` 的类. 示例:

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

@ -254,7 +254,7 @@
"items": [ "items": [
{ {
"text": "PostgreSQL 集成", "text": "PostgreSQL 集成",
"path": "EntityFrameworkCore-PostgreSQL-Integration.md" "path": "Entity-Framework-Core-PostgreSQL.md"
} }
] ]
}, },

4
framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs

@ -11,14 +11,14 @@ namespace Microsoft.AspNetCore.Builder
{ {
if (ctx.User.Identity?.IsAuthenticated != true) if (ctx.User.Identity?.IsAuthenticated != true)
{ {
var result = await ctx.AuthenticateAsync(schema); var result = await ctx.AuthenticateAsync(schema).ConfigureAwait(false);
if (result.Succeeded && result.Principal != null) if (result.Succeeded && result.Principal != null)
{ {
ctx.User = result.Principal; ctx.User = result.Principal;
} }
} }
await next(); await next().ConfigureAwait(false);
}); });
} }
} }

8
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs

@ -33,7 +33,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
TenantConfiguration tenant = null; TenantConfiguration tenant = null;
if (resolveResult.TenantIdOrName != null) if (resolveResult.TenantIdOrName != null)
{ {
tenant = await FindTenantAsync(resolveResult.TenantIdOrName); tenant = await FindTenantAsync(resolveResult.TenantIdOrName).ConfigureAwait(false);
if (tenant == null) if (tenant == null)
{ {
//TODO: A better exception? //TODO: A better exception?
@ -45,7 +45,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
using (_currentTenant.Change(tenant?.Id, tenant?.Name)) using (_currentTenant.Change(tenant?.Id, tenant?.Name))
{ {
await next(context); await next(context).ConfigureAwait(false);
} }
} }
@ -53,11 +53,11 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
{ {
if (Guid.TryParse(tenantIdOrName, out var parsedTenantId)) if (Guid.TryParse(tenantIdOrName, out var parsedTenantId))
{ {
return await _tenantStore.FindAsync(parsedTenantId); return await _tenantStore.FindAsync(parsedTenantId).ConfigureAwait(false);
} }
else else
{ {
return await _tenantStore.FindAsync(tenantIdOrName); return await _tenantStore.FindAsync(tenantIdOrName).ConfigureAwait(false);
} }
} }
} }

4
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs

@ -43,12 +43,12 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
configuration = await Cache.GetOrAddAsync( configuration = await Cache.GetOrAddAsync(
cacheKey, cacheKey,
async () => await Proxy.Service.GetAsync(), async () => await Proxy.Service.GetAsync().ConfigureAwait(false),
() => new DistributedCacheEntryOptions () => new DistributedCacheEntryOptions
{ {
AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(120) //TODO: Should be configurable. Default value should be higher (5 mins would be good). AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(120) //TODO: Should be configurable. Default value should be higher (5 mins would be good).
} }
); ).ConfigureAwait(false);
if (httpContext != null) if (httpContext != null)
{ {

2
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs

@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
public override async Task<string> GetOrNullAsync(string name) public override async Task<string> GetOrNullAsync(string name)
{ {
var configuration = await ConfigurationClient.GetAsync(); var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
return configuration.Features.Values.GetOrDefault(name); return configuration.Features.Values.GetOrDefault(name);
} }
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs

@ -16,7 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
public async Task<IReadOnlyList<LanguageInfo>> GetLanguagesAsync() public async Task<IReadOnlyList<LanguageInfo>> GetLanguagesAsync()
{ {
var configuration = await ConfigurationClient.GetAsync(); var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
return configuration.Localization.Languages; return configuration.Localization.Languages;
} }
} }

4
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs

@ -16,7 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
public async Task<bool> IsGrantedAsync(string name) public async Task<bool> IsGrantedAsync(string name)
{ {
var configuration = await ConfigurationClient.GetAsync(); var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
return configuration.Auth.GrantedPolicies.ContainsKey(name); return configuration.Auth.GrantedPolicies.ContainsKey(name);
} }
@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
public async Task<bool> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name) public async Task<bool> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name)
{ {
/* This provider always works for the current principal. */ /* This provider always works for the current principal. */
return await IsGrantedAsync(name); return await IsGrantedAsync(name).ConfigureAwait(false);
} }
} }
} }

4
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs

@ -17,13 +17,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
public async Task<string> GetOrNullAsync(string name) public async Task<string> GetOrNullAsync(string name)
{ {
var configuration = await ConfigurationClient.GetAsync(); var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
return configuration.Setting.Values.GetOrDefault(name); return configuration.Setting.Values.GetOrDefault(name);
} }
public async Task<List<SettingValue>> GetAllAsync() public async Task<List<SettingValue>> GetAllAsync()
{ {
var configuration = await ConfigurationClient.GetAsync(); var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
return configuration return configuration
.Setting.Values .Setting.Values
.Select(s => new SettingValue(s.Key, s.Value)) .Select(s => new SettingValue(s.Key, s.Value))

12
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs

@ -39,13 +39,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
tenantConfiguration = await Cache.GetOrAddAsync( tenantConfiguration = await Cache.GetOrAddAsync(
cacheKey, cacheKey,
async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name)), async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name).ConfigureAwait(false)),
() => new DistributedCacheEntryOptions () => new DistributedCacheEntryOptions
{ {
AbsoluteExpirationRelativeToNow = AbsoluteExpirationRelativeToNow =
TimeSpan.FromMinutes(5) //TODO: Should be configurable. TimeSpan.FromMinutes(5) //TODO: Should be configurable.
} }
); ).ConfigureAwait(false);
if (httpContext != null) if (httpContext != null)
{ {
@ -67,13 +67,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
tenantConfiguration = await Cache.GetOrAddAsync( tenantConfiguration = await Cache.GetOrAddAsync(
cacheKey, cacheKey,
async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id)), async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id).ConfigureAwait(false)),
() => new DistributedCacheEntryOptions () => new DistributedCacheEntryOptions
{ {
AbsoluteExpirationRelativeToNow = AbsoluteExpirationRelativeToNow =
TimeSpan.FromMinutes(5) //TODO: Should be configurable. TimeSpan.FromMinutes(5) //TODO: Should be configurable.
} }
); ).ConfigureAwait(false);
if (httpContext != null) if (httpContext != null)
{ {
@ -95,7 +95,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
tenantConfiguration = Cache.GetOrAdd( tenantConfiguration = Cache.GetOrAdd(
cacheKey, cacheKey,
() => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name))), () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name).ConfigureAwait(false))),
() => new DistributedCacheEntryOptions () => new DistributedCacheEntryOptions
{ {
AbsoluteExpirationRelativeToNow = AbsoluteExpirationRelativeToNow =
@ -123,7 +123,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
tenantConfiguration = Cache.GetOrAdd( tenantConfiguration = Cache.GetOrAdd(
cacheKey, cacheKey,
() => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id))), () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id).ConfigureAwait(false))),
() => new DistributedCacheEntryOptions () => new DistributedCacheEntryOptions
{ {
AbsoluteExpirationRelativeToNow = AbsoluteExpirationRelativeToNow =

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Breadcrumb
{ {
var list = InitilizeFormGroupContentsContext(context, output); var list = InitilizeFormGroupContentsContext(context, output);
await output.GetChildContentAsync(); await output.GetChildContentAsync().ConfigureAwait(false);
SetInnerOlTag(context, output); SetInnerOlTag(context, output);
SetInnerList(context, output, list); SetInnerList(context, output, list);

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs

@ -19,7 +19,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Carousel
var itemList = InitilizeCarouselItemsContentsContext(context, output); var itemList = InitilizeCarouselItemsContentsContext(context, output);
await output.GetChildContentAsync(); await output.GetChildContentAsync().ConfigureAwait(false);
SetOneItemAsActive(context, output, itemList); SetOneItemAsActive(context, output, itemList);
SetItems(context, output, itemList); SetItems(context, output, itemList);

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse
{ {
SetRandomIdIfNotProvided(); SetRandomIdIfNotProvided();
var innerContent = (await output.GetChildContentAsync()).GetContent(); var innerContent = (await output.GetChildContentAsync().ConfigureAwait(false)).GetContent();
var html = GetAccordionHeaderItem(context, output) + GetAccordionContentItem(context, output, innerContent); var html = GetAccordionHeaderItem(context, output) + GetAccordionContentItem(context, output, innerContent);

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs

@ -20,7 +20,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse
var items = InitilizeFormGroupContentsContext(context, output); var items = InitilizeFormGroupContentsContext(context, output);
await output.GetChildContentAsync(); await output.GetChildContentAsync().ConfigureAwait(false);
var content = GetContent(items); var content = GetContent(items);

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs

@ -22,7 +22,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse
output.Attributes.AddClass("multi-collapse"); output.Attributes.AddClass("multi-collapse");
} }
var innerContent = (await output.GetChildContentAsync()).GetContent(); var innerContent = (await output.GetChildContentAsync().ConfigureAwait(false)).GetContent();
output.Content.SetHtmlContent(innerContent); output.Content.SetHtmlContent(innerContent);
} }

12
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs

@ -26,9 +26,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{ {
var content = await output.GetChildContentAsync(); var content = await output.GetChildContentAsync().ConfigureAwait(false);
var buttonsAsHtml = await GetButtonsAsHtmlAsync(context, output, content); var buttonsAsHtml = await GetButtonsAsHtmlAsync(context, output, content).ConfigureAwait(false);
output.PreElement.SetHtmlContent(buttonsAsHtml); output.PreElement.SetHtmlContent(buttonsAsHtml);
@ -43,13 +43,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown
{ {
var buttonBuilder = new StringBuilder(""); var buttonBuilder = new StringBuilder("");
var mainButton = await GetMainButtonAsync(context, output, content); var mainButton = await GetMainButtonAsync(context, output, content).ConfigureAwait(false);
buttonBuilder.AppendLine(mainButton); buttonBuilder.AppendLine(mainButton);
if (TagHelper.DropdownStyle == DropdownStyle.Split) if (TagHelper.DropdownStyle == DropdownStyle.Split)
{ {
var splitButton = await GetSplitButtonAsync(context, output); var splitButton = await GetSplitButtonAsync(context, output).ConfigureAwait(false);
buttonBuilder.AppendLine(splitButton); buttonBuilder.AppendLine(splitButton);
} }
@ -68,7 +68,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown
abpButtonTagHelper.ButtonType = TagHelper.ButtonType; abpButtonTagHelper.ButtonType = TagHelper.ButtonType;
var attributes = GetAttributesForMainButton(context, output); var attributes = GetAttributesForMainButton(context, output);
var buttonTag = await abpButtonTagHelper.ProcessAndGetOutputAsync(attributes, context, "button", TagMode.StartTagAndEndTag); var buttonTag = await abpButtonTagHelper.ProcessAndGetOutputAsync(attributes, context, "button", TagMode.StartTagAndEndTag).ConfigureAwait(false);
buttonTag.PreContent.SetHtmlContent(content.GetContent()); buttonTag.PreContent.SetHtmlContent(content.GetContent());
@ -89,7 +89,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown
abpButtonTagHelper.ButtonType = TagHelper.ButtonType; abpButtonTagHelper.ButtonType = TagHelper.ButtonType;
var attributes = GetAttributesForSplitButton(context, output); var attributes = GetAttributesForSplitButton(context, output);
return await abpButtonTagHelper.RenderAsync(attributes, context, _htmlEncoder, "button", TagMode.StartTagAndEndTag); return await abpButtonTagHelper.RenderAsync(attributes, context, _htmlEncoder, "button", TagMode.StartTagAndEndTag).ConfigureAwait(false);
} }
protected virtual TagHelperAttributeList GetAttributesForMainButton(TagHelperContext context, TagHelperOutput output) protected virtual TagHelperAttributeList GetAttributesForMainButton(TagHelperContext context, TagHelperOutput output)

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperExtensions.cs

@ -19,14 +19,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Extensions
tagHelper.Init(context); tagHelper.Init(context);
await tagHelper.ProcessAsync(innerContext, innerOutput); await tagHelper.ProcessAsync(innerContext, innerOutput).ConfigureAwait(false);
return innerOutput; return innerOutput;
} }
public static async Task<string> RenderAsync(this TagHelper tagHelper, TagHelperAttributeList attributeList, TagHelperContext context, HtmlEncoder htmlEncoder, string tagName = "div", TagMode tagMode = TagMode.SelfClosing) public static async Task<string> RenderAsync(this TagHelper tagHelper, TagHelperAttributeList attributeList, TagHelperContext context, HtmlEncoder htmlEncoder, string tagName = "div", TagMode tagMode = TagMode.SelfClosing)
{ {
var innerOutput = await tagHelper.ProcessAndGetOutputAsync(attributeList, context, tagName, tagMode); var innerOutput = await tagHelper.ProcessAndGetOutputAsync(attributeList, context, tagName, tagMode).ConfigureAwait(false);
return innerOutput.Render(htmlEncoder); return innerOutput.Render(htmlEncoder);
} }

20
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs

@ -37,11 +37,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
NormalizeTagMode(context, output); NormalizeTagMode(context, output);
var childContent = (await output.GetChildContentAsync()).GetContent(); var childContent = (await output.GetChildContentAsync().ConfigureAwait(false)).GetContent();
await ConvertToMvcForm(context, output); await ConvertToMvcForm(context, output).ConfigureAwait(false);
await ProcessFieldsAsync(context, output); await ProcessFieldsAsync(context, output).ConfigureAwait(false);
SetContent(context, output, list, childContent); SetContent(context, output, list, childContent);
@ -67,9 +67,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
ViewContext = TagHelper.ViewContext ViewContext = TagHelper.ViewContext
}; };
var formTagOutput = await formTagHelper.ProcessAndGetOutputAsync(output.Attributes, context, "form", TagMode.StartTagAndEndTag); var formTagOutput = await formTagHelper.ProcessAndGetOutputAsync(output.Attributes, context, "form", TagMode.StartTagAndEndTag).ConfigureAwait(false);
await formTagOutput.GetChildContentAsync(); await formTagOutput.GetChildContentAsync().ConfigureAwait(false);
output.PostContent.SetHtmlContent(output.PostContent.GetContent() + formTagOutput.PostContent.GetContent()); output.PostContent.SetHtmlContent(output.PostContent.GetContent() + formTagOutput.PostContent.GetContent());
output.PreContent.SetHtmlContent(output.PreContent.GetContent() + formTagOutput.PreContent.GetContent()); output.PreContent.SetHtmlContent(output.PreContent.GetContent() + formTagOutput.PreContent.GetContent());
@ -134,11 +134,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
{ {
if (IsSelectGroup(context, model)) if (IsSelectGroup(context, model))
{ {
await ProcessSelectGroupAsync(context, output, model); await ProcessSelectGroupAsync(context, output, model).ConfigureAwait(false);
} }
else else
{ {
await ProcessInputGroupAsync(context, output, model); await ProcessInputGroupAsync(context, output, model).ConfigureAwait(false);
} }
} }
} }
@ -147,7 +147,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
{ {
var abpSelectTagHelper = GetSelectGroupTagHelper(context, output, model); var abpSelectTagHelper = GetSelectGroupTagHelper(context, output, model);
await abpSelectTagHelper.RenderAsync(new TagHelperAttributeList(), context, _htmlEncoder, "div", TagMode.StartTagAndEndTag); await abpSelectTagHelper.RenderAsync(new TagHelperAttributeList(), context, _htmlEncoder, "div", TagMode.StartTagAndEndTag).ConfigureAwait(false);
} }
protected virtual AbpTagHelper GetSelectGroupTagHelper(TagHelperContext context, TagHelperOutput output, ModelExpression model) protected virtual AbpTagHelper GetSelectGroupTagHelper(TagHelperContext context, TagHelperOutput output, ModelExpression model)
@ -185,7 +185,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
abpButtonTagHelper.Text = "Submit"; abpButtonTagHelper.Text = "Submit";
abpButtonTagHelper.ButtonType = AbpButtonType.Primary; abpButtonTagHelper.ButtonType = AbpButtonType.Primary;
return await abpButtonTagHelper.RenderAsync(attributes, context, _htmlEncoder, "button", TagMode.StartTagAndEndTag); return await abpButtonTagHelper.RenderAsync(attributes, context, _htmlEncoder, "button", TagMode.StartTagAndEndTag).ConfigureAwait(false);
} }
protected virtual async Task ProcessInputGroupAsync(TagHelperContext context, TagHelperOutput output, ModelExpression model) protected virtual async Task ProcessInputGroupAsync(TagHelperContext context, TagHelperOutput output, ModelExpression model)
@ -195,7 +195,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
abpInputTagHelper.ViewContext = TagHelper.ViewContext; abpInputTagHelper.ViewContext = TagHelper.ViewContext;
abpInputTagHelper.DisplayRequiredSymbol = TagHelper.RequiredSymbols ?? true; abpInputTagHelper.DisplayRequiredSymbol = TagHelper.RequiredSymbols ?? true;
await abpInputTagHelper.RenderAsync(new TagHelperAttributeList(), context, _htmlEncoder, "div", TagMode.StartTagAndEndTag); await abpInputTagHelper.RenderAsync(new TagHelperAttributeList(), context, _htmlEncoder, "div", TagMode.StartTagAndEndTag).ConfigureAwait(false);
} }
protected virtual List<ModelExpression> GetModels(TagHelperContext context, TagHelperOutput output) protected virtual List<ModelExpression> GetModels(TagHelperContext context, TagHelperOutput output)

16
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs

@ -27,7 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{ {
var (innerHtml, isCheckBox) = await GetFormInputGroupAsHtmlAsync(context, output); var (innerHtml, isCheckBox) = await GetFormInputGroupAsHtmlAsync(context, output).ConfigureAwait(false);
var order = TagHelper.AspFor.ModelExplorer.GetDisplayOrder(); var order = TagHelper.AspFor.ModelExplorer.GetDisplayOrder();
@ -57,12 +57,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
protected virtual async Task<(string, bool)> GetFormInputGroupAsHtmlAsync(TagHelperContext context, TagHelperOutput output) protected virtual async Task<(string, bool)> GetFormInputGroupAsHtmlAsync(TagHelperContext context, TagHelperOutput output)
{ {
var (inputTag, isCheckBox) = await GetInputTagHelperOutputAsync(context, output); var (inputTag, isCheckBox) = await GetInputTagHelperOutputAsync(context, output).ConfigureAwait(false);
var inputHtml = inputTag.Render(_encoder); var inputHtml = inputTag.Render(_encoder);
var label = await GetLabelAsHtmlAsync(context, output, inputTag, isCheckBox); var label = await GetLabelAsHtmlAsync(context, output, inputTag, isCheckBox).ConfigureAwait(false);
var info = GetInfoAsHtml(context, output, inputTag, isCheckBox); var info = GetInfoAsHtml(context, output, inputTag, isCheckBox);
var validation = isCheckBox ? "" : await GetValidationAsHtmlAsync(context, output, inputTag); var validation = isCheckBox ? "" : await GetValidationAsHtmlAsync(context, output, inputTag).ConfigureAwait(false);
return (GetContent(context, output, label, inputHtml, validation, info, isCheckBox), isCheckBox); return (GetContent(context, output, label, inputHtml, validation, info, isCheckBox), isCheckBox);
} }
@ -82,7 +82,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
var attributeList = new TagHelperAttributeList { { "class", "text-danger" } }; var attributeList = new TagHelperAttributeList { { "class", "text-danger" } };
return await validationMessageTagHelper.RenderAsync(attributeList, context, _encoder, "span", TagMode.StartTagAndEndTag); return await validationMessageTagHelper.RenderAsync(attributeList, context, _encoder, "span", TagMode.StartTagAndEndTag).ConfigureAwait(false);
} }
protected virtual string GetContent(TagHelperContext context, TagHelperOutput output, string label, string inputHtml, string validation, string infoHtml, bool isCheckbox) protected virtual string GetContent(TagHelperContext context, TagHelperOutput output, string label, string inputHtml, string validation, string infoHtml, bool isCheckbox)
@ -125,7 +125,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
{ {
var tagHelper = GetInputTagHelper(context, output); var tagHelper = GetInputTagHelper(context, output);
var inputTagHelperOutput = await tagHelper.ProcessAndGetOutputAsync(GetInputAttributes(context, output), context, "input"); var inputTagHelperOutput = await tagHelper.ProcessAndGetOutputAsync(GetInputAttributes(context, output), context, "input").ConfigureAwait(false);
ConvertToTextAreaIfTextArea(inputTagHelperOutput); ConvertToTextAreaIfTextArea(inputTagHelperOutput);
AddDisabledAttribute(inputTagHelperOutput); AddDisabledAttribute(inputTagHelperOutput);
@ -227,7 +227,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
if (string.IsNullOrEmpty(TagHelper.Label)) if (string.IsNullOrEmpty(TagHelper.Label))
{ {
return await GetLabelAsHtmlUsingTagHelperAsync(context, output, isCheckbox) + GetRequiredSymbol(context, output); return await GetLabelAsHtmlUsingTagHelperAsync(context, output, isCheckbox).ConfigureAwait(false) + GetRequiredSymbol(context, output);
} }
var checkboxClass = isCheckbox ? "class=\"custom-control-label\" " : ""; var checkboxClass = isCheckbox ? "class=\"custom-control-label\" " : "";
@ -301,7 +301,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
attributeList.AddClass("custom-control-label"); attributeList.AddClass("custom-control-label");
} }
return await labelTagHelper.RenderAsync(attributeList, context, _encoder, "label", TagMode.StartTagAndEndTag); return await labelTagHelper.RenderAsync(attributeList, context, _encoder, "label", TagMode.StartTagAndEndTag).ConfigureAwait(false);
} }
protected virtual void ConvertToTextAreaIfTextArea(TagHelperOutput tagHelperOutput) protected virtual void ConvertToTextAreaIfTextArea(TagHelperOutput tagHelperOutput)

16
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs

@ -30,7 +30,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{ {
var innerHtml = await GetFormInputGroupAsHtmlAsync(context, output); var innerHtml = await GetFormInputGroupAsHtmlAsync(context, output).ConfigureAwait(false);
var order = TagHelper.AspFor.ModelExplorer.GetDisplayOrder(); var order = TagHelper.AspFor.ModelExplorer.GetDisplayOrder();
@ -52,10 +52,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
protected virtual async Task<string> GetFormInputGroupAsHtmlAsync(TagHelperContext context, TagHelperOutput output) protected virtual async Task<string> GetFormInputGroupAsHtmlAsync(TagHelperContext context, TagHelperOutput output)
{ {
var selectTag = await GetSelectTagAsync(context, output); var selectTag = await GetSelectTagAsync(context, output).ConfigureAwait(false);
var selectAsHtml = selectTag.Render(_encoder); var selectAsHtml = selectTag.Render(_encoder);
var label = await GetLabelAsHtmlAsync(context, output, selectTag); var label = await GetLabelAsHtmlAsync(context, output, selectTag).ConfigureAwait(false);
var validation = await GetValidationAsHtmlAsync(context, output, selectTag); var validation = await GetValidationAsHtmlAsync(context, output, selectTag).ConfigureAwait(false);
var infoText = GetInfoAsHtml(context, output, selectTag); var infoText = GetInfoAsHtml(context, output, selectTag);
return label + Environment.NewLine + selectAsHtml + Environment.NewLine + infoText + Environment.NewLine + validation; return label + Environment.NewLine + selectAsHtml + Environment.NewLine + infoText + Environment.NewLine + validation;
@ -75,7 +75,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
ViewContext = TagHelper.ViewContext ViewContext = TagHelper.ViewContext
}; };
var selectTagHelperOutput = await selectTagHelper.ProcessAndGetOutputAsync(GetInputAttributes(context, output), context, "select", TagMode.StartTagAndEndTag); var selectTagHelperOutput = await selectTagHelper.ProcessAndGetOutputAsync(GetInputAttributes(context, output), context, "select", TagMode.StartTagAndEndTag).ConfigureAwait(false);
selectTagHelperOutput.Attributes.AddClass("form-control"); selectTagHelperOutput.Attributes.AddClass("form-control");
selectTagHelperOutput.Attributes.AddClass(GetSize(context, output)); selectTagHelperOutput.Attributes.AddClass(GetSize(context, output));
@ -123,7 +123,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
return "<label " + GetIdAttributeAsString(selectTag) + ">" + TagHelper.Label + "</label>" + GetRequiredSymbol(context, output); return "<label " + GetIdAttributeAsString(selectTag) + ">" + TagHelper.Label + "</label>" + GetRequiredSymbol(context, output);
} }
return await GetLabelAsHtmlUsingTagHelperAsync(context, output) + GetRequiredSymbol(context, output); return await GetLabelAsHtmlUsingTagHelperAsync(context, output).ConfigureAwait(false) + GetRequiredSymbol(context, output);
} }
protected virtual string GetRequiredSymbol(TagHelperContext context, TagHelperOutput output) protected virtual string GetRequiredSymbol(TagHelperContext context, TagHelperOutput output)
@ -242,7 +242,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
ViewContext = TagHelper.ViewContext ViewContext = TagHelper.ViewContext
}; };
return await labelTagHelper.RenderAsync(new TagHelperAttributeList(), context, _encoder, "label", TagMode.StartTagAndEndTag); return await labelTagHelper.RenderAsync(new TagHelperAttributeList(), context, _encoder, "label", TagMode.StartTagAndEndTag).ConfigureAwait(false);
} }
protected virtual async Task<string> GetValidationAsHtmlAsync(TagHelperContext context, TagHelperOutput output, TagHelperOutput inputTag) protected virtual async Task<string> GetValidationAsHtmlAsync(TagHelperContext context, TagHelperOutput output, TagHelperOutput inputTag)
@ -255,7 +255,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
var attributeList = new TagHelperAttributeList { { "class", "text-danger" } }; var attributeList = new TagHelperAttributeList { { "class", "text-danger" } };
return await validationMessageTagHelper.RenderAsync(attributeList, context, _encoder, "span", TagMode.StartTagAndEndTag); return await validationMessageTagHelper.RenderAsync(attributeList, context, _encoder, "span", TagMode.StartTagAndEndTag).ConfigureAwait(false);
} }
protected virtual string GetSize(TagHelperContext context, TagHelperOutput output) protected virtual string GetSize(TagHelperContext context, TagHelperOutput output)

18
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs

@ -31,7 +31,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination
} }
ProcessMainTag(context, output); ProcessMainTag(context, output);
await SetContentAsHtmlAsync(context, output); await SetContentAsHtmlAsync(context, output).ConfigureAwait(false);
} }
protected virtual async Task SetContentAsHtmlAsync(TagHelperContext context, TagHelperOutput output) protected virtual async Task SetContentAsHtmlAsync(TagHelperContext context, TagHelperOutput output)
@ -39,9 +39,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination
var html = new StringBuilder(""); var html = new StringBuilder("");
html.AppendLine(GetOpeningTags(context, output)); html.AppendLine(GetOpeningTags(context, output));
html.AppendLine(await GetPreviousButtonAsync(context, output)); html.AppendLine(await GetPreviousButtonAsync(context, output).ConfigureAwait(false));
html.AppendLine(await GetPagesAsync(context, output)); html.AppendLine(await GetPagesAsync(context, output).ConfigureAwait(false));
html.AppendLine(await GetNextButton(context, output)); html.AppendLine(await GetNextButton(context, output).ConfigureAwait(false));
html.AppendLine(GetClosingTags(context, output)); html.AppendLine(GetClosingTags(context, output));
output.Content.SetHtmlContent(html.ToString()); output.Content.SetHtmlContent(html.ToString());
@ -61,7 +61,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination
foreach (var page in TagHelper.Model.Pages) foreach (var page in TagHelper.Model.Pages)
{ {
pagesHtml.AppendLine(await GetPageAsync(context, output, page)); pagesHtml.AppendLine(await GetPageAsync(context, output, page).ConfigureAwait(false));
} }
return pagesHtml.ToString(); return pagesHtml.ToString();
@ -86,7 +86,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination
} }
else else
{ {
pageHtml.AppendLine(await RenderAnchorTagHelperLinkHtmlAsync(context, output, page.Index.ToString(), page.Index.ToString())); pageHtml.AppendLine(await RenderAnchorTagHelperLinkHtmlAsync(context, output, page.Index.ToString(), page.Index.ToString()).ConfigureAwait(false));
} }
pageHtml.AppendLine("</li>"); pageHtml.AppendLine("</li>");
@ -102,7 +102,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination
: (TagHelper.Model.CurrentPage - 1).ToString(); : (TagHelper.Model.CurrentPage - 1).ToString();
return return
"<li class=\"page-item " + (TagHelper.Model.CurrentPage == 1 ? "disabled" : "") + "\">\r\n" + "<li class=\"page-item " + (TagHelper.Model.CurrentPage == 1 ? "disabled" : "") + "\">\r\n" +
(await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey)) + " </li>"; (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey).ConfigureAwait(false)) + " </li>";
} }
protected virtual async Task<string> GetNextButton(TagHelperContext context, TagHelperOutput output) protected virtual async Task<string> GetNextButton(TagHelperContext context, TagHelperOutput output)
@ -111,7 +111,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination
var currentPage = (TagHelper.Model.CurrentPage + 1).ToString(); var currentPage = (TagHelper.Model.CurrentPage + 1).ToString();
return return
"<li class=\"page-item " + (TagHelper.Model.CurrentPage >= TagHelper.Model.TotalPageCount ? "disabled" : "") + "\">\r\n" + "<li class=\"page-item " + (TagHelper.Model.CurrentPage >= TagHelper.Model.TotalPageCount ? "disabled" : "") + "\">\r\n" +
(await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey)) + (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey).ConfigureAwait(false)) +
" </li>"; " </li>";
} }
@ -121,7 +121,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination
var anchorTagHelper = GetAnchorTagHelper(currentPage, out var attributeList); var anchorTagHelper = GetAnchorTagHelper(currentPage, out var attributeList);
var tagHelperOutput = await anchorTagHelper.ProcessAndGetOutputAsync(attributeList, context, "a", TagMode.StartTagAndEndTag); var tagHelperOutput = await anchorTagHelper.ProcessAndGetOutputAsync(attributeList, context, "a", TagMode.StartTagAndEndTag).ConfigureAwait(false);
tagHelperOutput.Content.SetHtmlContent(localizer[localizationKey]); tagHelperOutput.Content.SetHtmlContent(localizer[localizationKey]);

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs

@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab
throw new Exception("Name of tab dropdown tag can not bu null or empty."); throw new Exception("Name of tab dropdown tag can not bu null or empty.");
} }
await output.GetChildContentAsync(); await output.GetChildContentAsync().ConfigureAwait(false);
var tabHeader = GetTabHeaderItem(context, output); var tabHeader = GetTabHeaderItem(context, output);
var tabHeaderItems = context.GetValue<List<TabItem>>(TabItems); var tabHeaderItems = context.GetValue<List<TabItem>>(TabItems);

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab
{ {
SetPlaceholderForNameIfNotProvided(); SetPlaceholderForNameIfNotProvided();
var innerContent = await output.GetChildContentAsync(); var innerContent = await output.GetChildContentAsync().ConfigureAwait(false);
var tabHeader = GetTabHeaderItem(context, output); var tabHeader = GetTabHeaderItem(context, output);
var tabContent = GetTabContentItem(context, output, innerContent.GetContent()); var tabContent = GetTabContentItem(context, output, innerContent.GetContent());

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs

@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab
var items = InitilizeFormGroupContentsContext(context, output); var items = InitilizeFormGroupContentsContext(context, output);
await output.GetChildContentAsync(); await output.GetChildContentAsync().ConfigureAwait(false);
var headers = GetHeaders(context, output, items); var headers = GetHeaders(context, output, items);
var contents = GetConents(context, output, items); var contents = GetConents(context, output, items);

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

@ -61,12 +61,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
public virtual async Task<IReadOnlyList<string>> GetStyleBundleFilesAsync(string bundleName) public virtual async Task<IReadOnlyList<string>> GetStyleBundleFilesAsync(string bundleName)
{ {
return await GetBundleFilesAsync(Options.StyleBundles, bundleName, StyleBundler); return await GetBundleFilesAsync(Options.StyleBundles, bundleName, StyleBundler).ConfigureAwait(false);
} }
public virtual async Task<IReadOnlyList<string>> GetScriptBundleFilesAsync(string bundleName) public virtual async Task<IReadOnlyList<string>> GetScriptBundleFilesAsync(string bundleName)
{ {
return await GetBundleFilesAsync(Options.ScriptBundles, bundleName, ScriptBundler); return await GetBundleFilesAsync(Options.ScriptBundles, bundleName, ScriptBundler).ConfigureAwait(false);
} }
protected virtual async Task<IReadOnlyList<string>> GetBundleFilesAsync(BundleConfigurationCollection bundles, string bundleName, IBundler bundler) protected virtual async Task<IReadOnlyList<string>> GetBundleFilesAsync(BundleConfigurationCollection bundles, string bundleName, IBundler bundler)
@ -185,17 +185,17 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
foreach (var contributor in contributors) foreach (var contributor in contributors)
{ {
await contributor.PreConfigureBundleAsync(context); await contributor.PreConfigureBundleAsync(context).ConfigureAwait(false);
} }
foreach (var contributor in contributors) foreach (var contributor in contributors)
{ {
await contributor.ConfigureBundleAsync(context); await contributor.ConfigureBundleAsync(context).ConfigureAwait(false);
} }
foreach (var contributor in contributors) foreach (var contributor in contributors)
{ {
await contributor.PostConfigureBundleAsync(context); await contributor.PostConfigureBundleAsync(context).ConfigureAwait(false);
} }
return context.Files; return context.Files;
@ -207,7 +207,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
foreach (var contributor in contributors) foreach (var contributor in contributors)
{ {
await contributor.ConfigureDynamicResourcesAsync(context); await contributor.ConfigureDynamicResourcesAsync(context).ConfigureAwait(false);
} }
return context.Files; return context.Files;

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

@ -33,7 +33,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
TagHelper.CreateBundleTagHelperItem() TagHelper.CreateBundleTagHelperItem()
}, },
TagHelper.GetNameOrNull() TagHelper.GetNameOrNull()
); ).ConfigureAwait(false);
} }
} }
} }

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs

@ -20,16 +20,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
await ResourceService.ProcessAsync( await ResourceService.ProcessAsync(
context, context,
output, output,
await GetBundleItems(context, output), await GetBundleItems(context, output).ConfigureAwait(false),
TagHelper.GetNameOrNull() TagHelper.GetNameOrNull()
); ).ConfigureAwait(false);
} }
protected virtual async Task<List<BundleTagHelperItem>> GetBundleItems(TagHelperContext context, TagHelperOutput output) protected virtual async Task<List<BundleTagHelperItem>> GetBundleItems(TagHelperContext context, TagHelperOutput output)
{ {
var bundleItems = new List<BundleTagHelperItem>(); var bundleItems = new List<BundleTagHelperItem>();
context.Items[AbpTagHelperConsts.ContextBundleItemListKey] = bundleItems; context.Items[AbpTagHelperConsts.ContextBundleItemListKey] = bundleItems;
await output.GetChildContentAsync(); //TODO: Is there a way of executing children without getting content? await output.GetChildContentAsync().ConfigureAwait(false); //TODO: Is there a way of executing children without getting content?
return bundleItems; return bundleItems;
} }
} }

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

@ -56,7 +56,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
CreateBundle(bundleName, bundleItems); CreateBundle(bundleName, bundleItems);
var bundleFiles = await GetBundleFilesAsync(bundleName); var bundleFiles = await GetBundleFilesAsync(bundleName).ConfigureAwait(false);
output.Content.Clear(); output.Content.Clear();

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

@ -36,7 +36,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
protected override async Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName) protected override async Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName)
{ {
return await BundleManager.GetScriptBundleFilesAsync(bundleName); return await BundleManager.GetScriptBundleFilesAsync(bundleName).ConfigureAwait(false);
} }
protected override void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file) protected override void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file)

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

@ -36,7 +36,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
protected override async Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName) protected override async Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName)
{ {
return await BundleManager.GetStyleBundleFilesAsync(bundleName); return await BundleManager.GetStyleBundleFilesAsync(bundleName).ConfigureAwait(false);
} }
protected override void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file) protected override void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file)

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

@ -17,7 +17,7 @@ namespace Pages.Abp.MultiTenancy
public async Task<FindTenantResultDto> FindTenantByNameAsync(string name) public async Task<FindTenantResultDto> FindTenantByNameAsync(string name)
{ {
var tenant = await TenantStore.FindAsync(name); var tenant = await TenantStore.FindAsync(name).ConfigureAwait(false);
if (tenant == null) if (tenant == null)
{ {
@ -34,7 +34,7 @@ namespace Pages.Abp.MultiTenancy
public async Task<FindTenantResultDto> FindTenantByIdAsync(Guid id) public async Task<FindTenantResultDto> FindTenantByIdAsync(Guid id)
{ {
var tenant = await TenantStore.FindAsync(id); var tenant = await TenantStore.FindAsync(id).ConfigureAwait(false);
if (tenant == null) if (tenant == null)
{ {

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

@ -21,14 +21,14 @@ namespace Pages.Abp.MultiTenancy
[Route("tenants/by-name/{name}")] [Route("tenants/by-name/{name}")]
public async Task<FindTenantResultDto> FindTenantByNameAsync(string name) public async Task<FindTenantResultDto> FindTenantByNameAsync(string name)
{ {
return await _abpTenantAppService.FindTenantByNameAsync(name); return await _abpTenantAppService.FindTenantByNameAsync(name).ConfigureAwait(false);
} }
[HttpGet] [HttpGet]
[Route("tenants/by-id/{id}")] [Route("tenants/by-id/{id}")]
public async Task<FindTenantResultDto> FindTenantByIdAsync(Guid id) public async Task<FindTenantResultDto> FindTenantByIdAsync(Guid id)
{ {
return await _abpTenantAppService.FindTenantByIdAsync(id); return await _abpTenantAppService.FindTenantByIdAsync(id).ConfigureAwait(false);
} }
} }
} }

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

@ -34,7 +34,7 @@ namespace Pages.Abp.MultiTenancy
if (CurrentTenant.IsAvailable) if (CurrentTenant.IsAvailable)
{ {
var tenant = await TenantStore.FindAsync(CurrentTenant.GetId()); var tenant = await TenantStore.FindAsync(CurrentTenant.GetId()).ConfigureAwait(false);
Input.Name = tenant?.Name; Input.Name = tenant?.Name;
} }
} }
@ -47,7 +47,7 @@ namespace Pages.Abp.MultiTenancy
} }
else else
{ {
var tenant = await TenantStore.FindAsync(Input.Name); var tenant = await TenantStore.FindAsync(Input.Name).ConfigureAwait(false);
if (tenant == null) if (tenant == null)
{ {
throw new UserFriendlyException(L["GivenTenantIsNotAvailable", Input.Name]); throw new UserFriendlyException(L["GivenTenantIsNotAvailable", Input.Name]);

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/MainNavbarMenuViewComponent.cs

@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Menu
public async Task<IViewComponentResult> InvokeAsync() public async Task<IViewComponentResult> InvokeAsync()
{ {
var menu = await _menuManager.GetAsync(StandardMenus.Main); var menu = await _menuManager.GetAsync(StandardMenus.Main).ConfigureAwait(false);
return View("~/Themes/Basic/Components/Menu/Default.cshtml", menu); return View("~/Themes/Basic/Components/Menu/Default.cshtml", menu);
} }
} }

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

@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar
public async Task<IViewComponentResult> InvokeAsync() public async Task<IViewComponentResult> InvokeAsync()
{ {
var languages = await _languageProvider.GetLanguagesAsync(); var languages = await _languageProvider.GetLanguagesAsync().ConfigureAwait(false);
var currentLanguage = languages.FindByCulture( var currentLanguage = languages.FindByCulture(
CultureInfo.CurrentCulture.Name, CultureInfo.CurrentCulture.Name,
CultureInfo.CurrentUICulture.Name CultureInfo.CurrentUICulture.Name

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/MainNavbarToolsViewComponent.cs

@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar
public async Task<IViewComponentResult> InvokeAsync() public async Task<IViewComponentResult> InvokeAsync()
{ {
var toolbar = await _toolbarManager.GetAsync(StandardToolbars.Main); var toolbar = await _toolbarManager.GetAsync(StandardToolbars.Main).ConfigureAwait(false);
return View("~/Themes/Basic/Components/Toolbar/Default.cshtml", toolbar); return View("~/Themes/Basic/Components/Toolbar/Default.cshtml", toolbar);
} }
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/UserMenuViewComponent.cs

@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar
public async Task<IViewComponentResult> InvokeAsync() public async Task<IViewComponentResult> InvokeAsync()
{ {
var menu = await _menuManager.GetAsync(StandardMenus.User); var menu = await _menuManager.GetAsync(StandardMenus.User).ConfigureAwait(false);
return View("~/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml", menu); return View("~/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml", menu);
} }
} }

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

@ -25,7 +25,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Toolbars
var languageProvider = context.ServiceProvider.GetService<ILanguageProvider>(); var languageProvider = context.ServiceProvider.GetService<ILanguageProvider>();
//TODO: This duplicates GetLanguages() usage. Can we eleminate this? //TODO: This duplicates GetLanguages() usage. Can we eleminate this?
var languages = await languageProvider.GetLanguagesAsync(); var languages = await languageProvider.GetLanguagesAsync().ConfigureAwait(false);
if (languages.Count > 1) if (languages.Count > 1)
{ {
context.Toolbar.Items.Add(new ToolbarItem(typeof(LanguageSwitchViewComponent))); context.Toolbar.Items.Add(new ToolbarItem(typeof(LanguageSwitchViewComponent)));

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

@ -33,7 +33,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars
foreach (var contributor in Options.Contributors) foreach (var contributor in Options.Contributors)
{ {
await contributor.ConfigureToolbarAsync(context); await contributor.ConfigureToolbarAsync(context).ConfigureAwait(false);
} }
} }

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

@ -33,10 +33,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
var widget = Options.Widgets.Find(name); var widget = Options.Widgets.Find(name);
if (widget == null) if (widget == null)
{ {
return await DefaultViewComponentHelper.InvokeAsync(name, arguments); return await DefaultViewComponentHelper.InvokeAsync(name, arguments).ConfigureAwait(false);
} }
return await InvokeWidgetAsync(arguments, widget); return await InvokeWidgetAsync(arguments, widget).ConfigureAwait(false);
} }
public virtual async Task<IHtmlContent> InvokeAsync(Type componentType, object arguments) public virtual async Task<IHtmlContent> InvokeAsync(Type componentType, object arguments)
@ -44,10 +44,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
var widget = Options.Widgets.Find(componentType); var widget = Options.Widgets.Find(componentType);
if (widget == null) if (widget == null)
{ {
return await DefaultViewComponentHelper.InvokeAsync(componentType, arguments); return await DefaultViewComponentHelper.InvokeAsync(componentType, arguments).ConfigureAwait(false);
} }
return await InvokeWidgetAsync(arguments, widget); return await InvokeWidgetAsync(arguments, widget).ConfigureAwait(false);
} }
public virtual void Contextualize(ViewContext viewContext) public virtual void Contextualize(ViewContext viewContext)
@ -68,7 +68,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
return new HtmlContentBuilder() return new HtmlContentBuilder()
.AppendHtml($"<div {wrapperAttributesBuilder}>") .AppendHtml($"<div {wrapperAttributesBuilder}>")
.AppendHtml(await DefaultViewComponentHelper.InvokeAsync(widget.ViewComponentType, arguments)) .AppendHtml(await DefaultViewComponentHelper.InvokeAsync(widget.ViewComponentType, arguments).ConfigureAwait(false))
.AppendHtml("</div>"); .AppendHtml("</div>");
} }
} }

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

@ -27,14 +27,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{ {
var widget = Options.Widgets.Find(widgetComponentType); var widget = Options.Widgets.Find(widgetComponentType);
return await IsGrantedAsyncInternal(widget, widgetComponentType.FullName); return await IsGrantedAsyncInternal(widget, widgetComponentType.FullName).ConfigureAwait(false);
} }
public async Task<bool> IsGrantedAsync(string name) public async Task<bool> IsGrantedAsync(string name)
{ {
var widget = Options.Widgets.Find(name); var widget = Options.Widgets.Find(name);
return await IsGrantedAsyncInternal(widget, name); return await IsGrantedAsyncInternal(widget, name).ConfigureAwait(false);
} }
private async Task<bool> IsGrantedAsyncInternal(WidgetDefinition widget, string wantedWidgetName) private async Task<bool> IsGrantedAsyncInternal(WidgetDefinition widget, string wantedWidgetName)
@ -48,7 +48,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{ {
foreach (var requiredPolicy in widget.RequiredPolicies) foreach (var requiredPolicy in widget.RequiredPolicies)
{ {
if (!(await AuthorizationService.AuthorizeAsync(requiredPolicy)).Succeeded) if (!(await AuthorizationService.AuthorizeAsync(requiredPolicy).ConfigureAwait(false)).Succeeded)
{ {
return false; return false;
} }

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

@ -5,6 +5,7 @@ using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.AspNetCore.Mvc.ExceptionHandling; using Volo.Abp.AspNetCore.Mvc.ExceptionHandling;
using Volo.Abp.AspNetCore.Mvc.Features; using Volo.Abp.AspNetCore.Mvc.Features;
using Volo.Abp.AspNetCore.Mvc.ModelBinding; using Volo.Abp.AspNetCore.Mvc.ModelBinding;
using Volo.Abp.AspNetCore.Mvc.Response;
using Volo.Abp.AspNetCore.Mvc.Uow; using Volo.Abp.AspNetCore.Mvc.Uow;
using Volo.Abp.AspNetCore.Mvc.Validation; using Volo.Abp.AspNetCore.Mvc.Validation;
@ -28,6 +29,7 @@ namespace Volo.Abp.AspNetCore.Mvc
private static void AddFilters(MvcOptions options) private static void AddFilters(MvcOptions options)
{ {
options.Filters.AddService(typeof(AbpAuditActionFilter)); options.Filters.AddService(typeof(AbpAuditActionFilter));
options.Filters.AddService(typeof(AbpNoContentActionFilter));
options.Filters.AddService(typeof(AbpFeatureActionFilter)); options.Filters.AddService(typeof(AbpFeatureActionFilter));
options.Filters.AddService(typeof(AbpValidationActionFilter)); options.Filters.AddService(typeof(AbpValidationActionFilter));
options.Filters.AddService(typeof(AbpUowActionFilter)); options.Filters.AddService(typeof(AbpUowActionFilter));

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

@ -56,11 +56,12 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
return new ApplicationConfigurationDto return new ApplicationConfigurationDto
{ {
Auth = await GetAuthConfigAsync(), Auth = await GetAuthConfigAsync().ConfigureAwait(false),
Features = await GetFeaturesConfigAsync(), Features = await GetFeaturesConfigAsync().ConfigureAwait(false),
Localization = await GetLocalizationConfigAsync(), Localization = await GetLocalizationConfigAsync().ConfigureAwait(false),
CurrentUser = GetCurrentUser(), CurrentUser = GetCurrentUser(),
Setting = await GetSettingConfigAsync() Setting = await GetSettingConfigAsync()
.ConfigureAwait(false)
}; };
} }
@ -81,7 +82,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
var authConfig = new ApplicationAuthConfigurationDto(); var authConfig = new ApplicationAuthConfigurationDto();
var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync(); var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync().ConfigureAwait(false);
Logger.LogDebug($"GetPoliciesNamesAsync returns {policyNames.Count} items."); Logger.LogDebug($"GetPoliciesNamesAsync returns {policyNames.Count} items.");
@ -91,7 +92,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
Logger.LogDebug($"_authorizationService.IsGrantedAsync? {policyName}"); Logger.LogDebug($"_authorizationService.IsGrantedAsync? {policyName}");
if (await _authorizationService.IsGrantedAsync(policyName)) if (await _authorizationService.IsGrantedAsync(policyName).ConfigureAwait(false))
{ {
authConfig.GrantedPolicies[policyName] = true; authConfig.GrantedPolicies[policyName] = true;
} }
@ -174,7 +175,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
continue; continue;
} }
result.Values[settingDefinition.Name] = await _settingProvider.GetOrNullAsync(settingDefinition.Name); result.Values[settingDefinition.Name] = await _settingProvider.GetOrNullAsync(settingDefinition.Name).ConfigureAwait(false);
} }
Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetSettingConfigAsync()"); Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetSettingConfigAsync()");
@ -195,7 +196,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
continue; continue;
} }
result.Values[featureDefinition.Name] = await FeatureChecker.GetOrNullAsync(featureDefinition.Name); result.Values[featureDefinition.Name] = await FeatureChecker.GetOrNullAsync(featureDefinition.Name).ConfigureAwait(false);
} }
Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetFeaturesConfigAsync()"); Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetFeaturesConfigAsync()");

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs

@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
[HttpGet] [HttpGet]
public async Task<ApplicationConfigurationDto> GetAsync() public async Task<ApplicationConfigurationDto> GetAsync()
{ {
return await _applicationConfigurationAppService.GetAsync(); return await _applicationConfigurationAppService.GetAsync().ConfigureAwait(false);
} }
} }
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs

@ -35,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
[Produces(MimeTypes.Application.Javascript, MimeTypes.Text.Plain)] [Produces(MimeTypes.Application.Javascript, MimeTypes.Text.Plain)]
public async Task<ActionResult> Get() public async Task<ActionResult> Get()
{ {
var script = CreateAbpExtendScript(await _configurationAppService.GetAsync()); var script = CreateAbpExtendScript(await _configurationAppService.GetAsync().ConfigureAwait(false));
return Content( return Content(
_options.MinifyGeneratedScript == true _options.MinifyGeneratedScript == true

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs

@ -27,7 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing
{ {
if (!ShouldSaveAudit(context, out var auditLog, out var auditLogAction)) if (!ShouldSaveAudit(context, out var auditLog, out var auditLogAction))
{ {
await next(); await next().ConfigureAwait(false);
return; return;
} }
@ -37,7 +37,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing
try try
{ {
var result = await next(); var result = await next().ConfigureAwait(false);
if (result.Exception != null && !result.ExceptionHandled) if (result.Exception != null && !result.ExceptionHandled)
{ {

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs

@ -40,7 +40,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authentication
[HttpGet] [HttpGet]
public async Task<ActionResult> Logout(string returnUrl = "", string returnUrlHash = "") public async Task<ActionResult> Logout(string returnUrl = "", string returnUrlHash = "")
{ {
await HttpContext.SignOutAsync(); await HttpContext.SignOutAsync().ConfigureAwait(false);
return RedirectSafely(returnUrl, returnUrlHash); return RedirectSafely(returnUrl, returnUrlHash);
} }

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs

@ -23,7 +23,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Features
{ {
if (!context.ActionDescriptor.IsControllerAction()) if (!context.ActionDescriptor.IsControllerAction())
{ {
await next(); await next().ConfigureAwait(false);
return; return;
} }
@ -33,9 +33,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Features
{ {
await _methodInvocationAuthorizationService.CheckAsync( await _methodInvocationAuthorizationService.CheckAsync(
new MethodInvocationFeatureCheckerContext(methodInfo) new MethodInvocationFeatureCheckerContext(methodInfo)
); ).ConfigureAwait(false);
await next(); await next().ConfigureAwait(false);
} }
} }
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinder.cs

@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding
public async Task BindModelAsync(ModelBindingContext bindingContext) public async Task BindModelAsync(ModelBindingContext bindingContext)
{ {
await _simpleTypeModelBinder.BindModelAsync(bindingContext); await _simpleTypeModelBinder.BindModelAsync(bindingContext).ConfigureAwait(false);
if (!bindingContext.Result.IsModelSet) if (!bindingContext.Result.IsModelSet)
{ {

9
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxyScriptController.cs

@ -32,8 +32,13 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting
model.Normalize(); model.Normalize();
var script = _proxyScriptManager.GetScript(model.CreateOptions()); var script = _proxyScriptManager.GetScript(model.CreateOptions());
return Content(_options.MinifyGeneratedScript == true ? _javascriptMinifier.Minify(script) : script,
MimeTypes.Application.Javascript); return Content(
_options.MinifyGeneratedScript == true
? _javascriptMinifier.Minify(script)
: script,
MimeTypes.Application.Javascript
);
} }
} }
} }

31
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Response/AbpNoContentActionFilter.cs

@ -0,0 +1,31 @@
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.Response
{
public class AbpNoContentActionFilter : IAsyncActionFilter, ITransientDependency
{
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
if (!context.ActionDescriptor.IsControllerAction())
{
await next();
return;
}
await next();
if (context.HttpContext.Response.StatusCode == (int)HttpStatusCode.OK)
{
var returnType = context.ActionDescriptor.GetReturnType();
if (returnType == typeof(Task) || returnType == typeof(void))
{
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.NoContent;
}
}
}
}
}

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

@ -25,7 +25,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
{ {
if (!context.ActionDescriptor.IsControllerAction()) if (!context.ActionDescriptor.IsControllerAction())
{ {
await next(); await next().ConfigureAwait(false);
return; return;
} }
@ -39,7 +39,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
if (unitOfWorkAttr?.IsDisabled == true) if (unitOfWorkAttr?.IsDisabled == true)
{ {
await next(); await next().ConfigureAwait(false);
return; return;
} }
@ -48,10 +48,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
//Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware //Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware
if (_unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options)) if (_unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options))
{ {
var result = await next(); var result = await next().ConfigureAwait(false);
if (!Succeed(result)) if (!Succeed(result))
{ {
await RollbackAsync(context); await RollbackAsync(context).ConfigureAwait(false);
} }
return; return;
@ -60,10 +60,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
//Begin a new, independent unit of work //Begin a new, independent unit of work
using (var uow = _unitOfWorkManager.Begin(options)) using (var uow = _unitOfWorkManager.Begin(options))
{ {
var result = await next(); var result = await next().ConfigureAwait(false);
if (Succeed(result)) if (Succeed(result))
{ {
await uow.CompleteAsync(context.HttpContext.RequestAborted); await uow.CompleteAsync(context.HttpContext.RequestAborted).ConfigureAwait(false);
} }
} }
} }
@ -89,7 +89,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
var currentUow = _unitOfWorkManager.Current; var currentUow = _unitOfWorkManager.Current;
if (currentUow != null) if (currentUow != null)
{ {
await currentUow.RollbackAsync(context.HttpContext.RequestAborted); await currentUow.RollbackAsync(context.HttpContext.RequestAborted).ConfigureAwait(false);
} }
} }

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

@ -22,12 +22,12 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation
if (!context.ActionDescriptor.IsControllerAction() || if (!context.ActionDescriptor.IsControllerAction() ||
!context.ActionDescriptor.HasObjectResult()) !context.ActionDescriptor.HasObjectResult())
{ {
await next(); await next().ConfigureAwait(false);
return; return;
} }
_validator.Validate(context.ModelState); _validator.Validate(context.ModelState);
await next(); await next().ConfigureAwait(false);
} }
} }
} }

4
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs

@ -27,11 +27,11 @@ namespace Microsoft.AspNetCore.RequestLocalization
next, next,
new OptionsWrapper<RequestLocalizationOptions>( new OptionsWrapper<RequestLocalizationOptions>(
await _requestLocalizationOptionsProvider.GetLocalizationOptionsAsync() await _requestLocalizationOptionsProvider.GetLocalizationOptionsAsync()
), .ConfigureAwait(false)),
_loggerFactory _loggerFactory
); );
await middleware.Invoke(context); await middleware.Invoke(context).ConfigureAwait(false);
} }
} }
} }

6
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs

@ -36,15 +36,15 @@ namespace Microsoft.AspNetCore.RequestLocalization
{ {
if (_requestLocalizationOptions == null) if (_requestLocalizationOptions == null)
{ {
using (await _syncSemaphore.LockAsync()) using (await _syncSemaphore.LockAsync().ConfigureAwait(false))
{ {
using (var serviceScope = _serviceProviderFactory.CreateScope()) using (var serviceScope = _serviceProviderFactory.CreateScope())
{ {
var languageProvider = serviceScope.ServiceProvider.GetRequiredService<ILanguageProvider>(); var languageProvider = serviceScope.ServiceProvider.GetRequiredService<ILanguageProvider>();
var settingProvider = serviceScope.ServiceProvider.GetRequiredService<ISettingProvider>(); var settingProvider = serviceScope.ServiceProvider.GetRequiredService<ISettingProvider>();
var languages = await languageProvider.GetLanguagesAsync(); var languages = await languageProvider.GetLanguagesAsync().ConfigureAwait(false);
var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage).ConfigureAwait(false);
var options = !languages.Any() var options = !languages.Any()
? new RequestLocalizationOptions() ? new RequestLocalizationOptions()

6
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs

@ -30,7 +30,7 @@ namespace Volo.Abp.AspNetCore.Auditing
{ {
if (!ShouldWriteAuditLog(context)) if (!ShouldWriteAuditLog(context))
{ {
await next(context); await next(context).ConfigureAwait(false);
return; return;
} }
@ -38,11 +38,11 @@ namespace Volo.Abp.AspNetCore.Auditing
{ {
try try
{ {
await next(context); await next(context).ConfigureAwait(false);
} }
finally finally
{ {
await scope.SaveAsync(); await scope.SaveAsync().ConfigureAwait(false);
} }
} }
} }

6
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs

@ -29,7 +29,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling
{ {
try try
{ {
await next(context); await next(context).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -44,7 +44,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling
{ {
if (actionInfo.IsObjectResult) //TODO: Align with AbpExceptionFilter.ShouldHandleException! if (actionInfo.IsObjectResult) //TODO: Align with AbpExceptionFilter.ShouldHandleException!
{ {
await HandleAndWrapException(context, ex); await HandleAndWrapException(context, ex).ConfigureAwait(false);
return; return;
} }
} }
@ -72,7 +72,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling
errorInfoConverter.Convert(exception) errorInfoConverter.Convert(exception)
) )
) )
); ).ConfigureAwait(false);
} }
private Task ClearCacheHeaders(object state) private Task ClearCacheHeaders(object state)

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

@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Tracing
try try
{ {
await next(context); await next(context).ConfigureAwait(false);
} }
finally finally
{ {

4
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs

@ -20,8 +20,8 @@ namespace Volo.Abp.AspNetCore.Uow
{ {
using (var uow = _unitOfWorkManager.Reserve(UnitOfWorkReservationName)) using (var uow = _unitOfWorkManager.Reserve(UnitOfWorkReservationName))
{ {
await next(context); await next(context).ConfigureAwait(false);
await uow.CompleteAsync(context.RequestAborted); await uow.CompleteAsync(context.RequestAborted).ConfigureAwait(false);
} }
} }
} }

4
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs

@ -22,7 +22,7 @@ namespace Volo.Abp.Auditing
{ {
if (!ShouldIntercept(invocation, out var auditLog, out var auditLogAction)) if (!ShouldIntercept(invocation, out var auditLog, out var auditLogAction))
{ {
await invocation.ProceedAsync(); await invocation.ProceedAsync().ConfigureAwait(false);
return; return;
} }
@ -30,7 +30,7 @@ namespace Volo.Abp.Auditing
try try
{ {
await invocation.ProceedAsync(); await invocation.ProceedAsync().ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

4
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs

@ -116,7 +116,7 @@ namespace Volo.Abp.Auditing
if (ShouldSave(saveHandle.AuditLog)) if (ShouldSave(saveHandle.AuditLog))
{ {
await _auditingStore.SaveAsync(saveHandle.AuditLog); await _auditingStore.SaveAsync(saveHandle.AuditLog).ConfigureAwait(false);
} }
} }
@ -152,7 +152,7 @@ namespace Volo.Abp.Auditing
public async Task SaveAsync() public async Task SaveAsync()
{ {
await _auditingManager.SaveAsync(this); await _auditingManager.SaveAsync(this).ConfigureAwait(false);
} }
public void Dispose() public void Dispose()

38
framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs

@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Authorization
authorizationService, authorizationService,
null, null,
policyName policyName
); ).ConfigureAwait(false);
} }
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement)
@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Authorization
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
resource, resource,
requirement requirement
); ).ConfigureAwait(false);
} }
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy)
@ -31,16 +31,16 @@ namespace Microsoft.AspNetCore.Authorization
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
resource, resource,
policy policy
); ).ConfigureAwait(false);
} }
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy)
{ {
return await AuthorizeAsync( return await AuthorizeAsync(
authorizationService, authorizationService,
null, null,
policy policy
); ).ConfigureAwait(false);
} }
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements) public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements)
@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Authorization
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
resource, resource,
requirements requirements
); ).ConfigureAwait(false);
} }
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, string policyName) public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, string policyName)
@ -58,42 +58,42 @@ namespace Microsoft.AspNetCore.Authorization
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
resource, resource,
policyName policyName
); ).ConfigureAwait(false);
} }
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, string policyName) public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, string policyName)
{ {
return (await authorizationService.AuthorizeAsync(policyName)).Succeeded; return (await authorizationService.AuthorizeAsync(policyName).ConfigureAwait(false)).Succeeded;
} }
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement)
{ {
return (await authorizationService.AuthorizeAsync(resource, requirement)).Succeeded; return (await authorizationService.AuthorizeAsync(resource, requirement).ConfigureAwait(false)).Succeeded;
} }
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy)
{ {
return (await authorizationService.AuthorizeAsync(resource, policy)).Succeeded; return (await authorizationService.AuthorizeAsync(resource, policy).ConfigureAwait(false)).Succeeded;
} }
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy)
{ {
return (await authorizationService.AuthorizeAsync(policy)).Succeeded; return (await authorizationService.AuthorizeAsync(policy).ConfigureAwait(false)).Succeeded;
} }
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements) public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements)
{ {
return (await authorizationService.AuthorizeAsync(resource, requirements)).Succeeded; return (await authorizationService.AuthorizeAsync(resource, requirements).ConfigureAwait(false)).Succeeded;
} }
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, string policyName) public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, string policyName)
{ {
return (await authorizationService.AuthorizeAsync(resource, policyName)).Succeeded; return (await authorizationService.AuthorizeAsync(resource, policyName).ConfigureAwait(false)).Succeeded;
} }
public static async Task CheckAsync(this IAuthorizationService authorizationService, string policyName) public static async Task CheckAsync(this IAuthorizationService authorizationService, string policyName)
{ {
if (!await authorizationService.IsGrantedAsync(policyName)) if (!await authorizationService.IsGrantedAsync(policyName).ConfigureAwait(false))
{ {
throw new AbpAuthorizationException("Authorization failed! Given policy has not granted: " + policyName); throw new AbpAuthorizationException("Authorization failed! Given policy has not granted: " + policyName);
} }
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Authorization
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement)
{ {
if (!await authorizationService.IsGrantedAsync(resource, requirement)) if (!await authorizationService.IsGrantedAsync(resource, requirement).ConfigureAwait(false))
{ {
throw new AbpAuthorizationException("Authorization failed! Given requirement has not granted for given resource: " + resource); throw new AbpAuthorizationException("Authorization failed! Given requirement has not granted for given resource: " + resource);
} }
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Authorization
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy)
{ {
if (!await authorizationService.IsGrantedAsync(resource, policy)) if (!await authorizationService.IsGrantedAsync(resource, policy).ConfigureAwait(false))
{ {
throw new AbpAuthorizationException("Authorization failed! Given policy has not granted for given resource: " + resource); throw new AbpAuthorizationException("Authorization failed! Given policy has not granted for given resource: " + resource);
} }
@ -117,7 +117,7 @@ namespace Microsoft.AspNetCore.Authorization
public static async Task CheckAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) public static async Task CheckAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy)
{ {
if (!await authorizationService.IsGrantedAsync(policy)) if (!await authorizationService.IsGrantedAsync(policy).ConfigureAwait(false))
{ {
throw new AbpAuthorizationException("Authorization failed! Given policy has not granted."); throw new AbpAuthorizationException("Authorization failed! Given policy has not granted.");
} }
@ -125,7 +125,7 @@ namespace Microsoft.AspNetCore.Authorization
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements) public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements)
{ {
if (!await authorizationService.IsGrantedAsync(resource, requirements)) if (!await authorizationService.IsGrantedAsync(resource, requirements).ConfigureAwait(false))
{ {
throw new AbpAuthorizationException("Authorization failed! Given requirements have not granted for given resource: " + resource); throw new AbpAuthorizationException("Authorization failed! Given requirements have not granted for given resource: " + resource);
} }
@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Authorization
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, string policyName) public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, string policyName)
{ {
if (!await authorizationService.IsGrantedAsync(resource, policyName)) if (!await authorizationService.IsGrantedAsync(resource, policyName).ConfigureAwait(false))
{ {
throw new AbpAuthorizationException("Authorization failed! Given polist has not granted for given resource: " + resource); throw new AbpAuthorizationException("Authorization failed! Given polist has not granted for given resource: " + resource);
} }

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

@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization
public override async Task<AuthorizationPolicy> GetPolicyAsync(string policyName) public override async Task<AuthorizationPolicy> GetPolicyAsync(string policyName)
{ {
var policy = await base.GetPolicyAsync(policyName); var policy = await base.GetPolicyAsync(policyName).ConfigureAwait(false);
if (policy != null) if (policy != null)
{ {
return policy; return policy;

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

@ -15,8 +15,8 @@ namespace Volo.Abp.Authorization
public override async Task InterceptAsync(IAbpMethodInvocation invocation) public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{ {
await AuthorizeAsync(invocation); await AuthorizeAsync(invocation).ConfigureAwait(false);
await invocation.ProceedAsync(); await invocation.ProceedAsync().ConfigureAwait(false);
} }
protected virtual async Task AuthorizeAsync(IAbpMethodInvocation invocation) protected virtual async Task AuthorizeAsync(IAbpMethodInvocation invocation)
@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization
new MethodInvocationAuthorizationContext( new MethodInvocationAuthorizationContext(
invocation.Method invocation.Method
) )
); ).ConfigureAwait(false);
} }
} }
} }

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

@ -34,7 +34,7 @@ namespace Volo.Abp.Authorization
foreach (var authorizationAttribute in GetAuthorizationDataAttributes(context.Method)) foreach (var authorizationAttribute in GetAuthorizationDataAttributes(context.Method))
{ {
await CheckAsync(authorizationAttribute); await CheckAsync(authorizationAttribute).ConfigureAwait(false);
} }
} }
@ -74,7 +74,7 @@ namespace Volo.Abp.Authorization
} }
else else
{ {
await _authorizationService.CheckAsync(authorizationAttribute.Policy); await _authorizationService.CheckAsync(authorizationAttribute.Policy).ConfigureAwait(false);
} }
//TODO: What about roles and other props? //TODO: What about roles and other props?

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

@ -17,7 +17,7 @@ namespace Volo.Abp.Authorization
AuthorizationHandlerContext context, AuthorizationHandlerContext context,
PermissionRequirement requirement) PermissionRequirement requirement)
{ {
if (await _permissionChecker.IsGrantedAsync(context.User, requirement.PermissionName)) if (await _permissionChecker.IsGrantedAsync(context.User, requirement.PermissionName).ConfigureAwait(false))
{ {
context.Succeed(requirement); context.Succeed(requirement);
} }

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

@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization.Permissions
} }
return await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, clientId) return await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, clientId)
? PermissionGrantResult.Granted .ConfigureAwait(false) ? PermissionGrantResult.Granted
: PermissionGrantResult.Undefined; : PermissionGrantResult.Undefined;
} }
} }

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

@ -29,7 +29,7 @@ namespace Volo.Abp.Authorization.Permissions
public virtual async Task<bool> IsGrantedAsync(string name) public virtual async Task<bool> IsGrantedAsync(string name)
{ {
return await IsGrantedAsync(PrincipalAccessor.Principal, name); return await IsGrantedAsync(PrincipalAccessor.Principal, name).ConfigureAwait(false);
} }
public virtual async Task<bool> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name) public virtual async Task<bool> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name)
@ -56,7 +56,7 @@ namespace Volo.Abp.Authorization.Permissions
continue; continue;
} }
var result = await provider.CheckAsync(context); var result = await provider.CheckAsync(context).ConfigureAwait(false);
if (result == PermissionGrantResult.Granted) if (result == PermissionGrantResult.Granted)
{ {

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

@ -27,7 +27,7 @@ namespace Volo.Abp.Authorization.Permissions
foreach (var role in roles) foreach (var role in roles)
{ {
if (await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, role)) if (await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, role).ConfigureAwait(false))
{ {
return PermissionGrantResult.Granted; return PermissionGrantResult.Granted;
} }

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

@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization.Permissions
} }
return await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, userId) return await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, userId)
? PermissionGrantResult.Granted .ConfigureAwait(false) ? PermissionGrantResult.Granted
: PermissionGrantResult.Undefined; : PermissionGrantResult.Undefined;
} }
} }

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

@ -71,11 +71,11 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
{ {
CheckDisposed(); CheckDisposed();
using (await SyncObj.LockAsync()) using (await SyncObj.LockAsync().ConfigureAwait(false))
{ {
await EnsureInitializedAsync(); await EnsureInitializedAsync().ConfigureAwait(false);
await PublishAsync(args, priority, delay); await PublishAsync(args, priority, delay).ConfigureAwait(false);
return null; return null;
} }
@ -90,9 +90,9 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
return; return;
} }
using (await SyncObj.LockAsync()) using (await SyncObj.LockAsync().ConfigureAwait(false))
{ {
await EnsureInitializedAsync(); await EnsureInitializedAsync().ConfigureAwait(false);
} }
} }

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

@ -40,7 +40,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
foreach (var jobConfiguration in Options.GetJobs()) foreach (var jobConfiguration in Options.GetJobs())
{ {
var jobQueue = (IRunnable)ServiceProvider.GetRequiredService(typeof(IJobQueue<>).MakeGenericType(jobConfiguration.ArgsType)); var jobQueue = (IRunnable)ServiceProvider.GetRequiredService(typeof(IJobQueue<>).MakeGenericType(jobConfiguration.ArgsType));
await jobQueue.StartAsync(cancellationToken); await jobQueue.StartAsync(cancellationToken).ConfigureAwait(false);
JobQueues[jobConfiguration.JobName] = jobQueue; JobQueues[jobConfiguration.JobName] = jobQueue;
} }
} }
@ -49,7 +49,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
{ {
foreach (var jobQueue in JobQueues.Values) foreach (var jobQueue in JobQueues.Values)
{ {
await jobQueue.StopAsync(cancellationToken); await jobQueue.StopAsync(cancellationToken).ConfigureAwait(false);
} }
JobQueues.Clear(); JobQueues.Clear();
@ -64,7 +64,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
return (IJobQueue<TArgs>)jobQueue; return (IJobQueue<TArgs>)jobQueue;
} }
using (await SyncSemaphore.LockAsync()) using (await SyncSemaphore.LockAsync().ConfigureAwait(false))
{ {
if (JobQueues.TryGetValue(jobConfiguration.JobName, out jobQueue)) if (JobQueues.TryGetValue(jobConfiguration.JobName, out jobQueue))
{ {
@ -74,7 +74,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
jobQueue = (IJobQueue<TArgs>)ServiceProvider jobQueue = (IJobQueue<TArgs>)ServiceProvider
.GetRequiredService(typeof(IJobQueue<>).MakeGenericType(typeof(TArgs))); .GetRequiredService(typeof(IJobQueue<>).MakeGenericType(typeof(TArgs)));
await jobQueue.StartAsync(); await jobQueue.StartAsync().ConfigureAwait(false);
JobQueues.TryAdd(jobConfiguration.JobName, jobQueue); JobQueues.TryAdd(jobConfiguration.JobName, jobQueue);

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

@ -19,8 +19,8 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
BackgroundJobPriority priority = BackgroundJobPriority.Normal, BackgroundJobPriority priority = BackgroundJobPriority.Normal,
TimeSpan? delay = null) TimeSpan? delay = null)
{ {
var jobQueue = await _jobQueueManager.GetAsync<TArgs>(); var jobQueue = await _jobQueueManager.GetAsync<TArgs>().ConfigureAwait(false);
return await jobQueue.EnqueueAsync(args, priority, delay); return await jobQueue.EnqueueAsync(args, priority, delay).ConfigureAwait(false);
} }
} }
} }

4
framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs

@ -32,7 +32,7 @@ namespace Volo.Abp.BackgroundJobs
public virtual async Task<string> EnqueueAsync<TArgs>(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null) public virtual async Task<string> EnqueueAsync<TArgs>(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null)
{ {
var jobName = BackgroundJobNameAttribute.GetName<TArgs>(); var jobName = BackgroundJobNameAttribute.GetName<TArgs>();
var jobId = await EnqueueAsync(jobName, args, priority, delay); var jobId = await EnqueueAsync(jobName, args, priority, delay).ConfigureAwait(false);
return jobId.ToString(); return jobId.ToString();
} }
@ -53,7 +53,7 @@ namespace Volo.Abp.BackgroundJobs
jobInfo.NextTryTime = Clock.Now.Add(delay.Value); jobInfo.NextTryTime = Clock.Now.Add(delay.Value);
} }
await Store.InsertAsync(jobInfo); await Store.InsertAsync(jobInfo).ConfigureAwait(false);
return jobInfo.Id; return jobInfo.Id;
} }

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

@ -56,7 +56,7 @@ namespace Volo.Abp.BackgroundWorkers
foreach (var worker in _backgroundWorkers) foreach (var worker in _backgroundWorkers)
{ {
await worker.StartAsync(cancellationToken); await worker.StartAsync(cancellationToken).ConfigureAwait(false);
} }
} }
@ -66,7 +66,7 @@ namespace Volo.Abp.BackgroundWorkers
foreach (var worker in _backgroundWorkers) foreach (var worker in _backgroundWorkers)
{ {
await worker.StopAsync(cancellationToken); await worker.StopAsync(cancellationToken).ConfigureAwait(false);
} }
} }
} }

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

@ -25,14 +25,14 @@ namespace Volo.Abp.BackgroundWorkers
public override async Task StartAsync(CancellationToken cancellationToken = default) public override async Task StartAsync(CancellationToken cancellationToken = default)
{ {
await base.StartAsync(cancellationToken); await base.StartAsync(cancellationToken).ConfigureAwait(false);
Timer.Start(cancellationToken); Timer.Start(cancellationToken);
} }
public override async Task StopAsync(CancellationToken cancellationToken = default) public override async Task StopAsync(CancellationToken cancellationToken = default)
{ {
Timer.Stop(cancellationToken); Timer.Stop(cancellationToken);
await base.StopAsync(cancellationToken); await base.StopAsync(cancellationToken).ConfigureAwait(false);
} }
private void Timer_Elapsed(object sender, System.EventArgs e) private void Timer_Elapsed(object sender, System.EventArgs e)

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

@ -175,7 +175,7 @@ namespace Volo.Abp.Caching
cachedBytes = await Cache.GetAsync( cachedBytes = await Cache.GetAsync(
NormalizeKey(key), NormalizeKey(key),
CancellationTokenProvider.FallbackToProvider(token) CancellationTokenProvider.FallbackToProvider(token)
); ).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -250,22 +250,22 @@ namespace Volo.Abp.Caching
CancellationToken token = default) CancellationToken token = default)
{ {
token = CancellationTokenProvider.FallbackToProvider(token); token = CancellationTokenProvider.FallbackToProvider(token);
var value = await GetAsync(key, hideErrors, token); var value = await GetAsync(key, hideErrors, token).ConfigureAwait(false);
if (value != null) if (value != null)
{ {
return value; return value;
} }
using (await SyncSemaphore.LockAsync(token)) using (await SyncSemaphore.LockAsync(token).ConfigureAwait(false))
{ {
value = await GetAsync(key, hideErrors, token); value = await GetAsync(key, hideErrors, token).ConfigureAwait(false);
if (value != null) if (value != null)
{ {
return value; return value;
} }
value = await factory(); value = await factory().ConfigureAwait(false);
await SetAsync(key, value, optionsFactory?.Invoke(), hideErrors, token); await SetAsync(key, value, optionsFactory?.Invoke(), hideErrors, token).ConfigureAwait(false);
} }
return value; return value;
@ -331,7 +331,7 @@ namespace Volo.Abp.Caching
Serializer.Serialize(value), Serializer.Serialize(value),
options ?? DefaultCacheOptions, options ?? DefaultCacheOptions,
CancellationTokenProvider.FallbackToProvider(token) CancellationTokenProvider.FallbackToProvider(token)
); ).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -387,7 +387,7 @@ namespace Volo.Abp.Caching
try try
{ {
await Cache.RefreshAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)); await Cache.RefreshAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -443,7 +443,7 @@ namespace Volo.Abp.Caching
try try
{ {
await Cache.RemoveAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)); await Cache.RemoveAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

2
framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs

@ -20,7 +20,7 @@ namespace Volo.Abp.Castle.DynamicProxy
public override async Task ProceedAsync() public override async Task ProceedAsync()
{ {
await Proceed(Invocation, ProceedInfo); await Proceed(Invocation, ProceedInfo).ConfigureAwait(false);
} }
} }
} }

4
framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs

@ -19,7 +19,7 @@ namespace Volo.Abp.Castle.DynamicProxy
{ {
await _abpInterceptor.InterceptAsync( await _abpInterceptor.InterceptAsync(
new CastleAbpMethodInvocationAdapter(invocation, proceedInfo, proceed) new CastleAbpMethodInvocationAdapter(invocation, proceedInfo, proceed)
); ).ConfigureAwait(false);
} }
protected override async Task<TResult> InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) protected override async Task<TResult> InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed)
@ -28,7 +28,7 @@ namespace Volo.Abp.Castle.DynamicProxy
await _abpInterceptor.InterceptAsync( await _abpInterceptor.InterceptAsync(
adapter adapter
); ).ConfigureAwait(false);
return (TResult)adapter.ReturnValue; return (TResult)adapter.ReturnValue;
} }

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs

@ -35,7 +35,7 @@ namespace Volo.Abp.Cli.Auth
configuration["[o]abp-organization-name"] = organizationName; configuration["[o]abp-organization-name"] = organizationName;
} }
var accessToken = await AuthenticationService.GetAccessTokenAsync(configuration); var accessToken = await AuthenticationService.GetAccessTokenAsync(configuration).ConfigureAwait(false);
File.WriteAllText(CliPaths.AccessToken, accessToken, Encoding.UTF8); File.WriteAllText(CliPaths.AccessToken, accessToken, Encoding.UTF8);
} }

16
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs

@ -41,7 +41,7 @@ namespace Volo.Abp.Cli
{ {
Logger.LogInformation("ABP CLI (https://abp.io)"); Logger.LogInformation("ABP CLI (https://abp.io)");
await CheckCliVersionAsync(); await CheckCliVersionAsync().ConfigureAwait(false);
var commandLineArgs = CommandLineArgumentParser.Parse(args); var commandLineArgs = CommandLineArgumentParser.Parse(args);
var commandType = CommandSelector.Select(commandLineArgs); var commandType = CommandSelector.Select(commandLineArgs);
@ -52,7 +52,7 @@ namespace Volo.Abp.Cli
try try
{ {
await command.ExecuteAsync(commandLineArgs); await command.ExecuteAsync(commandLineArgs).ConfigureAwait(false);
} }
catch (CliUsageException usageException) catch (CliUsageException usageException)
{ {
@ -69,14 +69,14 @@ namespace Volo.Abp.Cli
{ {
var assembly = typeof(CliService).Assembly; var assembly = typeof(CliService).Assembly;
var toolPath = GetToolPath(assembly); var toolPath = GetToolPath(assembly);
var currentCliVersion = await GetCurrentCliVersion(assembly); var currentCliVersion = await GetCurrentCliVersion(assembly).ConfigureAwait(false);
var updateChannel = GetUpdateChannel(currentCliVersion); var updateChannel = GetUpdateChannel(currentCliVersion);
Logger.LogInformation($"Version {currentCliVersion} ({updateChannel} channel)"); Logger.LogInformation($"Version {currentCliVersion} ({updateChannel} channel)");
try try
{ {
var latestVersion = await GetLatestVersion(updateChannel); var latestVersion = await GetLatestVersion(updateChannel).ConfigureAwait(false);
if (latestVersion != null && latestVersion > currentCliVersion) if (latestVersion != null && latestVersion > currentCliVersion)
{ {
@ -106,7 +106,7 @@ namespace Volo.Abp.Cli
var consoleOutput = new StringReader(CmdHelper.RunCmdAndGetOutput($"dotnet tool list -g")); var consoleOutput = new StringReader(CmdHelper.RunCmdAndGetOutput($"dotnet tool list -g"));
string line; string line;
while ((line = await consoleOutput.ReadLineAsync()) != null) while ((line = await consoleOutput.ReadLineAsync().ConfigureAwait(false)) != null)
{ {
if (line.StartsWith("volo.abp.cli", StringComparison.InvariantCultureIgnoreCase)) if (line.StartsWith("volo.abp.cli", StringComparison.InvariantCultureIgnoreCase))
{ {
@ -155,13 +155,13 @@ namespace Volo.Abp.Cli
switch (updateChannel) switch (updateChannel)
{ {
case UpdateChannel.Stable: case UpdateChannel.Stable:
return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli"); return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli").ConfigureAwait(false);
case UpdateChannel.Prerelease: case UpdateChannel.Prerelease:
return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includePreviews: true); return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includePreviews: true).ConfigureAwait(false);
case UpdateChannel.Nightly: case UpdateChannel.Nightly:
return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includeNightly: true); return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includeNightly: true).ConfigureAwait(false);
default: default:
return default; return default;

11
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs

@ -4,9 +4,9 @@
{ {
#if DEBUG #if DEBUG
public const string WwwAbpIo = "https://localhost:44328/"; public const string WwwAbpIo = "https://localhost:44328/";
public const string AccountAbpIo = "https://localhost:44333/"; public const string AccountAbpIo = "https://localhost:44333/";
public const string NuGetRootPath = "https://localhost:44373/"; public const string NuGetRootPath = "https://localhost:44373/";
#else #else
public const string WwwAbpIo = "https://abp.io/"; public const string WwwAbpIo = "https://abp.io/";
@ -18,7 +18,12 @@
public static string GetNuGetServiceIndexUrl(string apiKey) public static string GetNuGetServiceIndexUrl(string apiKey)
{ {
return NuGetRootPath + apiKey + "/v3/index.json"; return $"{NuGetRootPath}{apiKey}/v3/index.json";
}
public static string GetNuGetPackageInfoUrl(string apiKey, string packageId)
{
return $"{NuGetRootPath}{apiKey}/v3/package/{packageId}/index.json";
} }
} }
} }

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs

@ -42,7 +42,7 @@ namespace Volo.Abp.Cli.Commands
commandLineArgs.Target, commandLineArgs.Target,
commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long), commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long),
skipDbMigrations skipDbMigrations
); ).ConfigureAwait(false);
} }
public string GetUsageInfo() public string GetUsageInfo()

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs

@ -37,7 +37,7 @@ namespace Volo.Abp.Cli.Commands
await ProjectNugetPackageAdder.AddAsync( await ProjectNugetPackageAdder.AddAsync(
GetProjectFile(commandLineArgs), GetProjectFile(commandLineArgs),
commandLineArgs.Target commandLineArgs.Target
); ).ConfigureAwait(false);
} }
public string GetUsageInfo() public string GetUsageInfo()

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs

@ -79,7 +79,7 @@ namespace Volo.Abp.Cli.Commands
gitHubLocalRepositoryPath, gitHubLocalRepositoryPath,
commandLineArgs.Options commandLineArgs.Options
) )
); ).ConfigureAwait(false);
using (var templateFileStream = new MemoryStream(result.ZipContent)) using (var templateFileStream = new MemoryStream(result.ZipContent))
{ {

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs

@ -48,7 +48,7 @@ namespace Volo.Abp.Cli.Commands
commandLineArgs.Target, commandLineArgs.Target,
password, password,
commandLineArgs.Options.GetOrNull(Options.Organization.Short, Options.Organization.Long) commandLineArgs.Options.GetOrNull(Options.Organization.Short, Options.Organization.Long)
); ).ConfigureAwait(false);
Logger.LogInformation($"Successfully logged in as '{commandLineArgs.Target}'"); Logger.LogInformation($"Successfully logged in as '{commandLineArgs.Target}'");
} }

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

Loading…
Cancel
Save