diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj b/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj index 7c8af93c47..aaebfafe6f 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj @@ -5,7 +5,7 @@ - + diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalizationModule.cs b/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalizationModule.cs index 19c707bfad..37541b4d4c 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalizationModule.cs +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalizationModule.cs @@ -8,13 +8,14 @@ using AbpIoLocalization.Support.Localization; using AbpIoLocalization.Www; using Volo.Abp.Localization; using Volo.Abp.Localization.ExceptionHandling; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace AbpIoLocalization { - [DependsOn(typeof(AbpLocalizationModule))] + [DependsOn(typeof(AbpValidationModule))] public class AbpIoLocalizationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/docs/cs/EntityFrameworkCore-PostgreSQL-Integration.md b/docs/cs/Entity-Framework-Core-PostgreSQL.md similarity index 100% rename from docs/cs/EntityFrameworkCore-PostgreSQL-Integration.md rename to docs/cs/Entity-Framework-Core-PostgreSQL.md diff --git a/docs/cs/docs-nav.json b/docs/cs/docs-nav.json index 85cbf43c9d..2854966a10 100644 --- a/docs/cs/docs-nav.json +++ b/docs/cs/docs-nav.json @@ -264,7 +264,7 @@ "items": [ { "text": "PostgreSQL integrace", - "path": "EntityFrameworkCore-PostgreSQL-Integration.md" + "path": "Entity-Framework-Core-PostgreSQL.md" } ] }, diff --git a/docs/en/Best-Practices/Index.md b/docs/en/Best-Practices/Index.md index 1a48c6b46b..f3f626ca63 100644 --- a/docs/en/Best-Practices/Index.md +++ b/docs/en/Best-Practices/Index.md @@ -23,5 +23,5 @@ Also, this guide is mostly usable for general **application development**. * [Data Transfer Objects](Data-Transfer-Objects.md) * Data Access * [Entity Framework Core Integration](Entity-Framework-Core-Integration.md) - * [MongoDB Integration](MongoDB-Integration.md) + * [MongoDB Integration](MongoDB-Integration.md) diff --git a/docs/en/Connection-Strings.md b/docs/en/Connection-Strings.md index 36103011e1..a080e10dea 100644 --- a/docs/en/Connection-Strings.md +++ b/docs/en/Connection-Strings.md @@ -1,11 +1,64 @@ -# Data Access +# Connection Strings -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 is designed to be [modular](Module-Development-Basics.md), [microservice compatible](Microservice-Architecture.md) and [multi-tenancy](Multi-Tenancy.md) aware. Connection string management is also designed to support these scenarios; -However, currently the following providers are implements: +* Allows to set separate connection strings for every module, so every module can have its own physical database. Modules even might be configured to use different DBMSs. +* Allows to set separate connection string and use a separate database per tenant (in a SaaS application). -* [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) -* [Dapper](Dapper.md) +It also supports hybrid scenarios; -More providers might be added in the next releases. \ No newline at end of file +* Allows to group modules into databases (all modules into a single shared database, 2 modules to database A, 3 modules to database B, 1 module to database C and rest of the modules to database D... etc.) +* Allows to group tenants into databases, just like the modules. +* Allows to separate databases per tenant per module (which might be harder to maintain for you because of too many databases, but the ABP framework supports it). + +All the [pre-built application modules](Modules/Index.md) are designed to be compatible these scenarios. + +## Configure the Connection Strings + +See the following configuration: + +````json +"ConnectionStrings": { + "Default": "Server=localhost;Database=MyMainDb;Trusted_Connection=True;", + "AbpIdentityServer": "Server=localhost;Database=MyIdsDb;Trusted_Connection=True;", + "AbpPermissionManagement": "Server=localhost;Database=MyPermissionDb;Trusted_Connection=True;" +} +```` + +> ABP uses the `IConfiguration` service to get the application configuration. While the simplest way to write configuration into the `appsettings.json` file, it is not limited to this file. You can use environment variables, user secrets, Azure Key Vault... etc. See the [configuration](Configuration.md) document for more. + +This configuration defines three different connection strings: + +* `MyMainDb` (the `Default` connection string) is the main connection string of the application. If you don't specify a connection string for a module, it fallbacks to the `Default` connection string. The [application startup template](Startup-Templates/Application.md) is configured to use a single connection string, so all the modules uses a single shared database. +* `MyIdsDb` is used by the [IdentityServer](Modules/IdentityServer.md) module. +* `MyPermissionDb` is used by the [Permission Management](Modules/Permission-Management.md) module. + +[Pre-built application modules](Modules/Index.md) define constants for the connection string names. For example, the IdentityServer module defines a ` ConnectionStringName ` constant in the ` AbpIdentityServerDbProperties ` class (located in the ` Volo.Abp.IdentityServer ` namespace). Other modules similarly define constants, so you can investigate the connection string name. + +## Set the Connection String Name + +A module typically has a unique connection string name associated to its `DbContext` class using the `ConnectionStringName` attribute. Example: + +````csharp +[ConnectionStringName("AbpIdentityServer")] +public class IdentityServerDbContext + : AbpDbContext, IIdentityServerDbContext +{ +} +```` + +For [Entity Framework Core](Entity-Framework-Core.md) and [MongoDB](MongoDB.md), write this to your `DbContext` class (and the interface if it has). + +> If you are developing a reusable, database provider independent module see also [the best practices guide](Best-Practices/Index.md). + +## Database Migrations for the Entity Framework Core + +Relational databases require to create the database and the database schema (tables, views... etc.) before using it. + +The startup template (with EF Core ORM) comes with a single database and a `.EntityFrameworkCore.DbMigrations` project that contains the migration files for that database. This project mainly defines a *YourProjectName*MigrationsDbContext that calls the `Configure...()` methods of the used modules, like `builder.ConfigurePermissionManagement()`. + +Once you want to separate a module's database, you typically will need to create a second migration path. The easiest way to create a copy of the `.EntityFrameworkCore.DbMigrations` project with the `DbContext` inside it, change its content to only call the `Configure...()` methods of the modules needs to be stored in the second database and re-create the initial migration. In this case, you also need to change the `.DbMigrator` application to be able to work with these second database too. In this way, you will have a separate migrations DbContext per database. + +## Multi-Tenancy + +See [the multi-tenancy document](Multi-Tenancy.md) to learn how to use separate databases for tenants. \ No newline at end of file diff --git a/docs/en/Data-Access.md b/docs/en/Data-Access.md index 36103011e1..a37f77eb65 100644 --- a/docs/en/Data-Access.md +++ b/docs/en/Data-Access.md @@ -1,11 +1,15 @@ # 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. +## Database Providers -However, currently the following providers are implements: +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: -* [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).) +* [Entity Framework Core](Entity-Framework-Core.md) (works with [various DBMS and providers](https://docs.microsoft.com/en-us/ef/core/providers/).) * [MongoDB](MongoDB.md) * [Dapper](Dapper.md) -More providers might be added in the next releases. \ No newline at end of file +More providers will be added in the future. + +## See Also + +* [Connection Strings](Connection-Strings.md) \ No newline at end of file diff --git a/docs/en/Entity-Framework-Core-MySQL.md b/docs/en/Entity-Framework-Core-MySQL.md new file mode 100644 index 0000000000..d1fa66e1a4 --- /dev/null +++ b/docs/en/Entity-Framework-Core-MySQL.md @@ -0,0 +1,58 @@ +# Switch to EF Core MySQL 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;`). + +## UseMySQL() + +Find `UseSqlServer()` calls in your solution, replace with `UseMySQL()`. Check the following files: + +* *YourProjectName*EntityFrameworkCoreModule.cs inside the `.EntityFrameworkCore` project. +* *YourProjectName*MigrationsDbContextFactory.cs inside the `.EntityFrameworkCore.DbMigrations` project. + +> Depending on your solution structure, you may find more code files need to be changed. + +## Change the Connection Strings + +MySQL connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com]( https://www.connectionstrings.com/mysql/ ) for details of MySQL connection string options. + +You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure. + +## Change the Migrations DbContext + +MySQL DBMS has some slight differences than the SQL Server. Some module database mapping configuration (especially the field lengths) causes problems with MySQL. For example, some of the the [IdentityServer module](Modules/IdentityServer.md) tables has such problems and it provides an option to configure the fields based on your DBMS. + +The startup template contains a *YourProjectName*MigrationsDbContext which is responsible to maintain and migrate the database schema. This DbContext basically calls extension methods of the depended modules to configure their database tables. + +Open the *YourProjectName*MigrationsDbContext and change the `builder.ConfigureIdentityServer();` line as shown below: + +````csharp +builder.ConfigureIdentityServer(options => +{ + options.DatabaseProvider = EfCoreDatabaseProvider.MySql; +}); +```` + +Then `ConfigureIdentityServer()` method will set the field lengths to not exceed the MySQL limits. Refer to related module documentation if you have any problem while creating or executing the database migrations. + +## Re-Generate the Migrations + +The startup template uses [Entity Framework Core's Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core Migrations depend on the selected DBMS provider. So, changing the DBMS provider will cause the migration fails. + +* Delete the Migrations folder under the `.EntityFrameworkCore.DbMigrations` project and re-build the solution. +* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore.DbMigrations` project as the default project in the Package Manager Console). + +This will create a database migration with all database objects (tables) configured. + +Run the `.DbMigrator` project to create the database and seed the initial data. + +## Run the Application + +It is ready. Just run the application and enjoy coding. \ No newline at end of file diff --git a/docs/en/Entity-Framework-Core-PostgreSQL.md b/docs/en/Entity-Framework-Core-PostgreSQL.md new file mode 100644 index 0000000000..85ce3197f2 --- /dev/null +++ b/docs/en/Entity-Framework-Core-PostgreSQL.md @@ -0,0 +1,41 @@ +# Switch to EF Core PostgreSQL Provider + +This document explains how to switch to the **PostgreSQL** 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.PostgreSql](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.PostgreSql) package. + +## Replace the Module Dependency + +Find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, remove `typeof(AbpEntityFrameworkCoreSqlServerModule)` from the `DependsOn` attribute, add `typeof(AbpEntityFrameworkCorePostgreSqlModule)` (also replace `using Volo.Abp.EntityFrameworkCore.SqlServer;` with `using Volo.Abp.EntityFrameworkCore.PostgreSql;`). + +## UsePostgreSql() + +Find `UseSqlServer()` calls in your solution, replace with `UsePostgreSql()`. Check the following files: + +* *YourProjectName*EntityFrameworkCoreModule.cs inside the `.EntityFrameworkCore` project. +* *YourProjectName*MigrationsDbContextFactory.cs inside the `.EntityFrameworkCore.DbMigrations` project. + +> Depending on your solution structure, you may find more code files need to be changed. + +## Change the Connection Strings + +PostgreSql connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com]( https://www.connectionstrings.com/postgresql/ ) for details of PostgreSql connection string options. + +You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure. + +## Re-Generate the Migrations + +The startup template uses [Entity Framework Core's Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core Migrations depend on the selected DBMS provider. So, changing the DBMS provider will cause the migration fails. + +* Delete the Migrations folder under the `.EntityFrameworkCore.DbMigrations` project and re-build the solution. +* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore.DbMigrations` project as the default project in the Package Manager Console). + +This will create a database migration with all database objects (tables) configured. + +Run the `.DbMigrator` project to create the database and seed the initial data. + +## Run the Application + +It is ready. Just run the application and enjoy coding. \ No newline at end of file diff --git a/docs/en/Entity-Framework-Core-SQLite.md b/docs/en/Entity-Framework-Core-SQLite.md new file mode 100644 index 0000000000..62a8ef815d --- /dev/null +++ b/docs/en/Entity-Framework-Core-SQLite.md @@ -0,0 +1,41 @@ +# Switch to EF Core SQLite Provider + +This document explains how to switch to the **SQLite** 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.Sqlite](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.Sqlite) package. + +## Replace the Module Dependency + +Find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, remove `typeof(AbpEntityFrameworkCoreSqlServerModule)` from the `DependsOn` attribute, add `typeof(AbpEntityFrameworkCoreSqliteModule)` (also replace `using Volo.Abp.EntityFrameworkCore.SqlServer;` with `using Volo.Abp.EntityFrameworkCore.Sqlite;`). + +## UseSqlite() + +Find `UseSqlServer()` calls in your solution, replace with `UseSqlite()`. Check the following files: + +* *YourProjectName*EntityFrameworkCoreModule.cs inside the `.EntityFrameworkCore` project. +* *YourProjectName*MigrationsDbContextFactory.cs inside the `.EntityFrameworkCore.DbMigrations` project. + +> Depending on your solution structure, you may find more code files need to be changed. + +## Change the Connection Strings + +SQLite connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com]( https://www.connectionstrings.com/sqlite/ ) for details of SQLite connection string options. + +You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure. + +## Re-Generate the Migrations + +The startup template uses [Entity Framework Core's Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core Migrations depend on the selected DBMS provider. So, changing the DBMS provider will cause the migration fails. + +* Delete the Migrations folder under the `.EntityFrameworkCore.DbMigrations` project and re-build the solution. +* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore.DbMigrations` project as the default project in the Package Manager Console). + +This will create a database migration with all database objects (tables) configured. + +Run the `.DbMigrator` project to create the database and seed the initial data. + +## Run the Application + +It is ready. Just run the application and enjoy coding. \ No newline at end of file diff --git a/docs/en/Entity-Framework-Core.md b/docs/en/Entity-Framework-Core.md index e608736bcd..b73e16a3e5 100644 --- a/docs/en/Entity-Framework-Core.md +++ b/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. +### 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 You can create your DbContext as you normally do. It should be derived from `AbpDbContext` as shown below: @@ -62,7 +73,7 @@ public class MyDbContext : AbpDbContext } ``` -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 @@ -126,7 +137,8 @@ public class BookManager : DomainService { private readonly IRepository _bookRepository; - public BookManager(IRepository bookRepository) //inject default repository + //inject default repository to the constructor + public BookManager(IRepository bookRepository) { _bookRepository = bookRepository; } @@ -142,7 +154,8 @@ public class BookManager : DomainService Type = type }; - await _bookRepository.InsertAsync(book); //Use a standard repository method + //Use a standard repository method + await _bookRepository.InsertAsync(book); return book; } @@ -153,9 +166,9 @@ This sample uses `InsertAsync` method to insert a new entity to the database. ### 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 public interface IBookRepository : IRepository @@ -187,21 +200,23 @@ public class BookRepository : EfCoreRepository, 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` 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 context.Services.AddAbpDbContext(options => { options.AddDefaultRepositories(); - options.AddRepository(); //Replaces IRepository + + //Replaces IRepository + options.AddRepository(); }); ```` -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 public override async Task DeleteAsync( @@ -215,7 +230,7 @@ public override async Task DeleteAsync( ### 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 public class BookService @@ -243,9 +258,9 @@ public class BookService #### 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 public class MyRepositoryBase @@ -271,7 +286,7 @@ public class MyRepositoryBase 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: @@ -282,6 +297,7 @@ context.Services.AddAbpDbContext(options => typeof(MyRepositoryBase<,>), typeof(MyRepositoryBase<>) ); + //... }); ``` @@ -316,7 +332,7 @@ public class BookRepository : EfCoreRepository, } ```` -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 diff --git a/docs/en/EntityFrameworkCore-PostgreSQL-Integration.md b/docs/en/EntityFrameworkCore-PostgreSQL-Integration.md deleted file mode 100644 index 2f6dd03be7..0000000000 --- a/docs/en/EntityFrameworkCore-PostgreSQL-Integration.md +++ /dev/null @@ -1,73 +0,0 @@ -## Entity Framework Core PostgreSQL Integration - -> See [Entity Framework Core Integration document](../Entity-Framework-Core.md) for the basics of the EF Core integration. - -### EntityFrameworkCore Project Update - -- In `Acme.BookStore.EntityFrameworkCore` project replace package `Volo.Abp.EntityFrameworkCore.SqlServer` with `Volo.Abp.EntityFrameworkCore.PostgreSql` -- Update to use PostgreSQL in `BookStoreEntityFrameworkCoreModule` - - Replace the `AbpEntityFrameworkCoreSqlServerModule` with the `AbpEntityFrameworkCorePostgreSqlModule` - - Replace the `options.UseSqlServer()` with the `options.UsePostgreSql()` -- In other projects update the PostgreSQL connection string in necessary `appsettings.json` files - - more info of [PostgreSQL connection strings](https://www.connectionstrings.com/postgresql/),You need to pay attention to `Npgsql` in this document - -### EntityFrameworkCore.DbMigrations Project Update -- Update to use PostgreSQL in `XXXMigrationsDbContextFactory` - - Replace the `new DbContextOptionsBuilder().UseSqlServer()` with the `new DbContextOptionsBuilder().UseNpgsql()` - -### Delete Existing Migrations - -Delete all existing migration files (including `DbContextModelSnapshot`) - -![postgresql-delete-initial-migrations](images/postgresql-delete-initial-migrations.png) - -### Regenerate Initial Migration - -Set the correct startup project (usually a web project) - -![set-as-startup-project](../images/set-as-startup-project.png) - -Open the **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), select the `.EntityFrameworkCore.DbMigrations` as the **Default project** and execute the following command: - -Run `Add-Migration` command. -```` -PM> Add-Migration Initial -```` - -### Update the Database - -You have two options to create the database. - -#### Using the DbMigrator Application - -The solution contains a console application (named `Acme.BookStore.DbMigrator` in this sample) that can create database, apply migrations and seed initial data. It is useful on development as well as on production environment. - -> `.DbMigrator` project has its own `appsettings.json`. So, if you have changed the connection string above, you should also change this one. - -Right click to the `.DbMigrator` project and select **Set as StartUp Project**: - -![set-as-startup-project](../images/set-as-startup-project.png) - -Hit F5 (or Ctrl+F5) to run the application. It will have an output like shown below: - -![set-as-startup-project](../images/db-migrator-app.png) - -#### Using EF Core Update-Database Command - -Ef Core has `Update-Database` command which creates database if necessary and applies pending migrations. - -Set the correct startup project (usually a web project) - -![set-as-startup-project](../images/set-as-startup-project.png) - -Open the **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), select the `.EntityFrameworkCore.DbMigrations` as the **Default project** and execute the following command: - -```` -PM> Update-Database -```` - -This will create a new database based on the configured connection string. - -![postgresql-update-database](images/postgresql-update-database.png) - -> Using the `.DbMigrator` tool is the suggested way, because it also seeds the initial data to be able to properly run the web application. diff --git a/docs/en/Modules/Docs.md b/docs/en/Modules/Docs.md index 0a74d7ebde..dbafe910da 100644 --- a/docs/en/Modules/Docs.md +++ b/docs/en/Modules/Docs.md @@ -501,6 +501,10 @@ You can also use variables in a text, adding **_Value** postfix to its key: This document assumes that you prefer to use **{{ UI_Value }}** as the UI framework and **{{ DB_Value }}** as the database provider. ```` +Also, **Document_Language_Code** and **Document_Version** keys are pre-defined if you want to get the language code or the version of the current document (This may be useful for creating links that redirects to another documentation system in another domain). + +------ + **IMPORTANT NOTICE**: Scriban uses "{{" and "}}" for syntax. Therefore, you must use escape blocks if you are going to use those in your document (an Angular document, for example). See [Scriban docs]( ) for more information. ### 8- Creating the Navigation Document diff --git a/docs/en/Modules/IdentityServer.md b/docs/en/Modules/IdentityServer.md new file mode 100644 index 0000000000..0d2ab35c21 --- /dev/null +++ b/docs/en/Modules/IdentityServer.md @@ -0,0 +1,3 @@ +# IdentityServer Module + +TODO \ No newline at end of file diff --git a/docs/en/Modules/Index.md b/docs/en/Modules/Index.md index 9d1c1d301f..8616ed2281 100644 --- a/docs/en/Modules/Index.md +++ b/docs/en/Modules/Index.md @@ -17,7 +17,7 @@ There are some **free and open source** application modules developed and mainta * **Blogging**: Used to create fancy blogs. ABP's [own blog](https://abp.io/blog/abp/) already using this module. * [**Docs**](Docs.md): Used to create technical documentation pages. ABP's [own documentation](https://docs.abp.io) already using this module. * **Identity**: Used to manage roles, users and their permissions. -* **Identity Server**: Integrates to IdentityServer4. +* **IdentityServer**: Integrates to IdentityServer4. * **Permission Management**: Used to persist permissions. * **[Setting Management](Setting-Management.md)**: Used to persist and manage the [settings](../Settings.md). * **Tenant Management**: Used to manage tenants for a [multi-tenant](../Multi-Tenancy.md) application. diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index db194177a9..9943c3b6af 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -257,25 +257,42 @@ }, { "text": "Data Access", - "path": "Data-Access.md", + "path": "Data-Access.md", "items": [ { - "text": "Entity Framework Core Integration", - "path": "Entity-Framework-Core.md", - "items": [ + "text": "Connection Strings", + "path": "Connection-Strings.md" + }, + { + "text": "Database Providers", + "items": [ + { + "text": "Entity Framework Core", + "path": "Entity-Framework-Core.md", + "items": [ + { + "text": "Switch to MySQL", + "path": "Entity-Framework-Core-MySQL.md" + }, + { + "text": "Switch to PostgreSQL", + "path": "Entity-Framework-Core-PostgreSQL.md" + }, + { + "text": "Switch to SQLite", + "path": "Entity-Framework-Core-SQLite.md" + } + ] + }, { - "text": "PostgreSQL Integration", - "path": "EntityFrameworkCore-PostgreSQL-Integration.md" + "text": "MongoDB", + "path": "MongoDB.md" + }, + { + "text": "Dapper", + "path": "Dapper.md" } ] - }, - { - "text": "MongoDB Integration", - "path": "MongoDB.md" - }, - { - "text": "Dapper Integration", - "path": "Dapper.md" } ] }, diff --git a/docs/pt-BR/docs-nav.json b/docs/pt-BR/docs-nav.json index 8e7eaf62af..a189b83c09 100644 --- a/docs/pt-BR/docs-nav.json +++ b/docs/pt-BR/docs-nav.json @@ -249,7 +249,7 @@ "items": [ { "text": "Integração do PostgreSQL", - "path": "EntityFrameworkCore-PostgreSQL-Integration.md" + "path": "Entity-Framework-Core-PostgreSQL.md" } ] }, diff --git a/docs/zh-Hans/EntityFrameworkCore-PostgreSQL-Integration.md b/docs/zh-Hans/Entity-Framework-Core-PostgreSQL.md similarity index 100% rename from docs/zh-Hans/EntityFrameworkCore-PostgreSQL-Integration.md rename to docs/zh-Hans/Entity-Framework-Core-PostgreSQL.md diff --git a/docs/zh-Hans/docs-nav.json b/docs/zh-Hans/docs-nav.json index dd740f6c3b..301af0fd6a 100644 --- a/docs/zh-Hans/docs-nav.json +++ b/docs/zh-Hans/docs-nav.json @@ -254,7 +254,7 @@ "items": [ { "text": "PostgreSQL 集成", - "path": "EntityFrameworkCore-PostgreSQL-Integration.md" + "path": "Entity-Framework-Core-PostgreSQL.md" } ] }, diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs index 4ff54f39bf..e93f558afd 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs +++ b/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) { - var result = await ctx.AuthenticateAsync(schema); + var result = await ctx.AuthenticateAsync(schema).ConfigureAwait(false); if (result.Succeeded && result.Principal != null) { ctx.User = result.Principal; } } - await next(); + await next().ConfigureAwait(false); }); } } diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs index ba8802a80e..b260df4247 100644 --- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs @@ -33,7 +33,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy TenantConfiguration tenant = null; if (resolveResult.TenantIdOrName != null) { - tenant = await FindTenantAsync(resolveResult.TenantIdOrName); + tenant = await FindTenantAsync(resolveResult.TenantIdOrName).ConfigureAwait(false); if (tenant == null) { //TODO: A better exception? @@ -45,7 +45,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy 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)) { - return await _tenantStore.FindAsync(parsedTenantId); + return await _tenantStore.FindAsync(parsedTenantId).ConfigureAwait(false); } else { - return await _tenantStore.FindAsync(tenantIdOrName); + return await _tenantStore.FindAsync(tenantIdOrName).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs index 1fbb72bb3e..a4f7eb0567 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs +++ b/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( cacheKey, - async () => await Proxy.Service.GetAsync(), + async () => await Proxy.Service.GetAsync().ConfigureAwait(false), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(120) //TODO: Should be configurable. Default value should be higher (5 mins would be good). } - ); + ).ConfigureAwait(false); if (httpContext != null) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs index f769f512a5..9671703db8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs +++ b/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 GetOrNullAsync(string name) { - var configuration = await ConfigurationClient.GetAsync(); + var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); return configuration.Features.Values.GetOrDefault(name); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs index 02c97c0598..42b6eeb543 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs +++ b/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> GetLanguagesAsync() { - var configuration = await ConfigurationClient.GetAsync(); + var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); return configuration.Localization.Languages; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs index 18f5272e7b..553160029b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs +++ b/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 IsGrantedAsync(string name) { - var configuration = await ConfigurationClient.GetAsync(); + var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); return configuration.Auth.GrantedPolicies.ContainsKey(name); } @@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client public async Task IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name) { /* This provider always works for the current principal. */ - return await IsGrantedAsync(name); + return await IsGrantedAsync(name).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs index db3ea6e9a6..d6526a0b7b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs +++ b/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 GetOrNullAsync(string name) { - var configuration = await ConfigurationClient.GetAsync(); + var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); return configuration.Setting.Values.GetOrDefault(name); } public async Task> GetAllAsync() { - var configuration = await ConfigurationClient.GetAsync(); + var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); return configuration .Setting.Values .Select(s => new SettingValue(s.Key, s.Value)) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs index 236387823c..8e95376663 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs +++ b/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( cacheKey, - async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name)), + async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name).ConfigureAwait(false)), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5) //TODO: Should be configurable. } - ); + ).ConfigureAwait(false); if (httpContext != null) { @@ -67,13 +67,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Client tenantConfiguration = await Cache.GetOrAddAsync( cacheKey, - async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id)), + async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id).ConfigureAwait(false)), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5) //TODO: Should be configurable. } - ); + ).ConfigureAwait(false); if (httpContext != null) { @@ -95,7 +95,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client tenantConfiguration = Cache.GetOrAdd( cacheKey, - () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name))), + () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name).ConfigureAwait(false))), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = @@ -123,7 +123,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client tenantConfiguration = Cache.GetOrAdd( cacheKey, - () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id))), + () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id).ConfigureAwait(false))), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs index 8eeeb1e929..4b3a4dd471 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs +++ b/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); - await output.GetChildContentAsync(); + await output.GetChildContentAsync().ConfigureAwait(false); SetInnerOlTag(context, output); SetInnerList(context, output, list); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs index ffba80fb6f..65cffd8cb6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs +++ b/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); - await output.GetChildContentAsync(); + await output.GetChildContentAsync().ConfigureAwait(false); SetOneItemAsActive(context, output, itemList); SetItems(context, output, itemList); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs index 9dc279334b..509b801ba9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs +++ b/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(); - var innerContent = (await output.GetChildContentAsync()).GetContent(); + var innerContent = (await output.GetChildContentAsync().ConfigureAwait(false)).GetContent(); var html = GetAccordionHeaderItem(context, output) + GetAccordionContentItem(context, output, innerContent); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs index 20e62604a9..c6c5c2eb5e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs +++ b/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); - await output.GetChildContentAsync(); + await output.GetChildContentAsync().ConfigureAwait(false); var content = GetContent(items); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs index 10e49b92a7..2b81961f67 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs +++ b/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"); } - var innerContent = (await output.GetChildContentAsync()).GetContent(); + var innerContent = (await output.GetChildContentAsync().ConfigureAwait(false)).GetContent(); output.Content.SetHtmlContent(innerContent); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs index 673204b302..459a7be318 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs +++ b/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) { - 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); @@ -43,13 +43,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown { var buttonBuilder = new StringBuilder(""); - var mainButton = await GetMainButtonAsync(context, output, content); + var mainButton = await GetMainButtonAsync(context, output, content).ConfigureAwait(false); buttonBuilder.AppendLine(mainButton); if (TagHelper.DropdownStyle == DropdownStyle.Split) { - var splitButton = await GetSplitButtonAsync(context, output); + var splitButton = await GetSplitButtonAsync(context, output).ConfigureAwait(false); buttonBuilder.AppendLine(splitButton); } @@ -68,7 +68,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown abpButtonTagHelper.ButtonType = TagHelper.ButtonType; 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()); @@ -89,7 +89,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown abpButtonTagHelper.ButtonType = TagHelper.ButtonType; 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) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperExtensions.cs index d925fd11e8..6767e2bf1d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperExtensions.cs +++ b/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); - await tagHelper.ProcessAsync(innerContext, innerOutput); + await tagHelper.ProcessAsync(innerContext, innerOutput).ConfigureAwait(false); return innerOutput; } public static async Task 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); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs index ee2a920980..5fb439b6f7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs +++ b/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); - 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); @@ -67,9 +67,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form 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.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)) { - await ProcessSelectGroupAsync(context, output, model); + await ProcessSelectGroupAsync(context, output, model).ConfigureAwait(false); } 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); - 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) @@ -185,7 +185,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form abpButtonTagHelper.Text = "Submit"; 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) @@ -195,7 +195,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form abpInputTagHelper.ViewContext = TagHelper.ViewContext; 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 GetModels(TagHelperContext context, TagHelperOutput output) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs index 75fe4f23e7..b1195b729e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs +++ b/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) { - var (innerHtml, isCheckBox) = await GetFormInputGroupAsHtmlAsync(context, output); + var (innerHtml, isCheckBox) = await GetFormInputGroupAsHtmlAsync(context, output).ConfigureAwait(false); 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) { - var (inputTag, isCheckBox) = await GetInputTagHelperOutputAsync(context, output); + var (inputTag, isCheckBox) = await GetInputTagHelperOutputAsync(context, output).ConfigureAwait(false); 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 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); } @@ -82,7 +82,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form 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) @@ -125,7 +125,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form { 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); AddDisabledAttribute(inputTagHelperOutput); @@ -227,7 +227,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form 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\" " : ""; @@ -301,7 +301,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form 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) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs index b18bc6ed75..f1260883ef 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs +++ b/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) { - var innerHtml = await GetFormInputGroupAsHtmlAsync(context, output); + var innerHtml = await GetFormInputGroupAsHtmlAsync(context, output).ConfigureAwait(false); var order = TagHelper.AspFor.ModelExplorer.GetDisplayOrder(); @@ -52,10 +52,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form protected virtual async Task 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 label = await GetLabelAsHtmlAsync(context, output, selectTag); - var validation = await GetValidationAsHtmlAsync(context, output, selectTag); + var label = await GetLabelAsHtmlAsync(context, output, selectTag).ConfigureAwait(false); + var validation = await GetValidationAsHtmlAsync(context, output, selectTag).ConfigureAwait(false); var infoText = GetInfoAsHtml(context, output, selectTag); 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 }; - 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(GetSize(context, output)); @@ -123,7 +123,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form return "" + 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) @@ -242,7 +242,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form 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 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" } }; - 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) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs index 25307c3fee..f1d2f5c02f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs +++ b/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); - await SetContentAsHtmlAsync(context, output); + await SetContentAsHtmlAsync(context, output).ConfigureAwait(false); } 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(""); html.AppendLine(GetOpeningTags(context, output)); - html.AppendLine(await GetPreviousButtonAsync(context, output)); - html.AppendLine(await GetPagesAsync(context, output)); - html.AppendLine(await GetNextButton(context, output)); + html.AppendLine(await GetPreviousButtonAsync(context, output).ConfigureAwait(false)); + html.AppendLine(await GetPagesAsync(context, output).ConfigureAwait(false)); + html.AppendLine(await GetNextButton(context, output).ConfigureAwait(false)); html.AppendLine(GetClosingTags(context, output)); 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) { - pagesHtml.AppendLine(await GetPageAsync(context, output, page)); + pagesHtml.AppendLine(await GetPageAsync(context, output, page).ConfigureAwait(false)); } return pagesHtml.ToString(); @@ -86,7 +86,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination } 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(""); @@ -102,7 +102,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination : (TagHelper.Model.CurrentPage - 1).ToString(); return "
  • \r\n" + - (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey)) + "
  • "; + (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey).ConfigureAwait(false)) + " "; } protected virtual async Task 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(); return "
  • = TagHelper.Model.TotalPageCount ? "disabled" : "") + "\">\r\n" + - (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey)) + + (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey).ConfigureAwait(false)) + "
  • "; } @@ -121,7 +121,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination 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]); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs index fb724af9c8..1b74a338dd 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs +++ b/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."); } - await output.GetChildContentAsync(); + await output.GetChildContentAsync().ConfigureAwait(false); var tabHeader = GetTabHeaderItem(context, output); var tabHeaderItems = context.GetValue>(TabItems); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs index ba5e3e811a..54a29bf691 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab { public class AbpTabLinkTagHelperService : AbpTagHelperService { - public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { SetPlaceholderForNameIfNotProvided(); @@ -18,6 +18,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab tabHeaderItems.Add(new TabItem(tabHeader, "", false, TagHelper.Name, TagHelper.ParentDropdownName, false)); output.SuppressOutput(); + + return Task.CompletedTask; } protected virtual string GetTabHeaderItem(TagHelperContext context, TagHelperOutput output) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs index 2de18d0592..7d8dc7224c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs +++ b/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(); - var innerContent = await output.GetChildContentAsync(); + var innerContent = await output.GetChildContentAsync().ConfigureAwait(false); var tabHeader = GetTabHeaderItem(context, output); var tabContent = GetTabContentItem(context, output, innerContent.GetContent()); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs index 0098cbc1f0..37d307ac05 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs +++ b/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); - await output.GetChildContentAsync(); + await output.GetChildContentAsync().ConfigureAwait(false); var headers = GetHeaders(context, output, items); var contents = GetConents(context, output, items); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs index f5806364f3..5683a2039f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs +++ b/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> GetStyleBundleFilesAsync(string bundleName) { - return await GetBundleFilesAsync(Options.StyleBundles, bundleName, StyleBundler); + return await GetBundleFilesAsync(Options.StyleBundles, bundleName, StyleBundler).ConfigureAwait(false); } public virtual async Task> GetScriptBundleFilesAsync(string bundleName) { - return await GetBundleFilesAsync(Options.ScriptBundles, bundleName, ScriptBundler); + return await GetBundleFilesAsync(Options.ScriptBundles, bundleName, ScriptBundler).ConfigureAwait(false); } protected virtual async Task> GetBundleFilesAsync(BundleConfigurationCollection bundles, string bundleName, IBundler bundler) @@ -185,17 +185,17 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling foreach (var contributor in contributors) { - await contributor.PreConfigureBundleAsync(context); + await contributor.PreConfigureBundleAsync(context).ConfigureAwait(false); } foreach (var contributor in contributors) { - await contributor.ConfigureBundleAsync(context); + await contributor.ConfigureBundleAsync(context).ConfigureAwait(false); } foreach (var contributor in contributors) { - await contributor.PostConfigureBundleAsync(context); + await contributor.PostConfigureBundleAsync(context).ConfigureAwait(false); } return context.Files; @@ -207,7 +207,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling foreach (var contributor in contributors) { - await contributor.ConfigureDynamicResourcesAsync(context); + await contributor.ConfigureDynamicResourcesAsync(context).ConfigureAwait(false); } return context.Files; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs index fc59051720..a7c504054c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs +++ b/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.GetNameOrNull() - ); + ).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs index a8eadce1e8..45aeffaf92 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs +++ b/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( context, output, - await GetBundleItems(context, output), + await GetBundleItems(context, output).ConfigureAwait(false), TagHelper.GetNameOrNull() - ); + ).ConfigureAwait(false); } protected virtual async Task> GetBundleItems(TagHelperContext context, TagHelperOutput output) { var bundleItems = new List(); 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; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs index 73b6e025ea..9095fdf335 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs +++ b/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); - var bundleFiles = await GetBundleFilesAsync(bundleName); + var bundleFiles = await GetBundleFilesAsync(bundleName).ConfigureAwait(false); output.Content.Clear(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs index b087db517f..8ab0dffc15 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs +++ b/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> 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) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs index 2d273345cb..f82606fa03 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs +++ b/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> 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) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs index d0bea87196..7cb02623f1 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs @@ -17,7 +17,7 @@ namespace Pages.Abp.MultiTenancy public async Task FindTenantByNameAsync(string name) { - var tenant = await TenantStore.FindAsync(name); + var tenant = await TenantStore.FindAsync(name).ConfigureAwait(false); if (tenant == null) { @@ -34,7 +34,7 @@ namespace Pages.Abp.MultiTenancy public async Task FindTenantByIdAsync(Guid id) { - var tenant = await TenantStore.FindAsync(id); + var tenant = await TenantStore.FindAsync(id).ConfigureAwait(false); if (tenant == null) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs index 5da47875d9..c36d36f61f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs +++ b/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}")] public async Task FindTenantByNameAsync(string name) { - return await _abpTenantAppService.FindTenantByNameAsync(name); + return await _abpTenantAppService.FindTenantByNameAsync(name).ConfigureAwait(false); } [HttpGet] [Route("tenants/by-id/{id}")] public async Task FindTenantByIdAsync(Guid id) { - return await _abpTenantAppService.FindTenantByIdAsync(id); + return await _abpTenantAppService.FindTenantByIdAsync(id).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs index bfdbb98db8..da4d6d207d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs +++ b/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) { - var tenant = await TenantStore.FindAsync(CurrentTenant.GetId()); + var tenant = await TenantStore.FindAsync(CurrentTenant.GetId()).ConfigureAwait(false); Input.Name = tenant?.Name; } } @@ -47,7 +47,7 @@ namespace Pages.Abp.MultiTenancy } else { - var tenant = await TenantStore.FindAsync(Input.Name); + var tenant = await TenantStore.FindAsync(Input.Name).ConfigureAwait(false); if (tenant == null) { throw new UserFriendlyException(L["GivenTenantIsNotAvailable", Input.Name]); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/MainNavbarMenuViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/MainNavbarMenuViewComponent.cs index 0369457165..bccd8e00de 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/MainNavbarMenuViewComponent.cs +++ b/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 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); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/LanguageSwitchViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/LanguageSwitchViewComponent.cs index c6921d3210..e58190060b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/LanguageSwitchViewComponent.cs +++ b/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 InvokeAsync() { - var languages = await _languageProvider.GetLanguagesAsync(); + var languages = await _languageProvider.GetLanguagesAsync().ConfigureAwait(false); var currentLanguage = languages.FindByCulture( CultureInfo.CurrentCulture.Name, CultureInfo.CurrentUICulture.Name diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/MainNavbarToolsViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/MainNavbarToolsViewComponent.cs index bfd02bbf4a..862dbe7e2f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/MainNavbarToolsViewComponent.cs +++ b/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 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); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/UserMenuViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/UserMenuViewComponent.cs index cde4208578..feb7fb09a5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/UserMenuViewComponent.cs +++ b/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 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); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Toolbars/BasicThemeMainTopToolbarContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Toolbars/BasicThemeMainTopToolbarContributor.cs index 1ed1d2d5d3..01e812adfe 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Toolbars/BasicThemeMainTopToolbarContributor.cs +++ b/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(); //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) { context.Toolbar.Items.Add(new ToolbarItem(typeof(LanguageSwitchViewComponent))); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs index f1ac30779a..e2d66a7d11 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs +++ b/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) { - await contributor.ConfigureToolbarAsync(context); + await contributor.ConfigureToolbarAsync(context).ConfigureAwait(false); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs index 826c7635cf..e148947c77 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs +++ b/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); 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 InvokeAsync(Type componentType, object arguments) @@ -44,10 +44,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets var widget = Options.Widgets.Find(componentType); 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) @@ -68,7 +68,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets return new HtmlContentBuilder() .AppendHtml($"
    ") - .AppendHtml(await DefaultViewComponentHelper.InvokeAsync(widget.ViewComponentType, arguments)) + .AppendHtml(await DefaultViewComponentHelper.InvokeAsync(widget.ViewComponentType, arguments).ConfigureAwait(false)) .AppendHtml("
    "); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs index ffd03d28dc..2249090bd8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs +++ b/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); - return await IsGrantedAsyncInternal(widget, widgetComponentType.FullName); + return await IsGrantedAsyncInternal(widget, widgetComponentType.FullName).ConfigureAwait(false); } public async Task IsGrantedAsync(string name) { var widget = Options.Widgets.Find(name); - return await IsGrantedAsyncInternal(widget, name); + return await IsGrantedAsyncInternal(widget, name).ConfigureAwait(false); } private async Task IsGrantedAsyncInternal(WidgetDefinition widget, string wantedWidgetName) @@ -48,7 +48,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets { foreach (var requiredPolicy in widget.RequiredPolicies) { - if (!(await AuthorizationService.AuthorizeAsync(requiredPolicy)).Succeeded) + if (!(await AuthorizationService.AuthorizeAsync(requiredPolicy).ConfigureAwait(false)).Succeeded) { return false; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs index a633edb37e..4aedf0b087 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs +++ b/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.Features; using Volo.Abp.AspNetCore.Mvc.ModelBinding; +using Volo.Abp.AspNetCore.Mvc.Response; using Volo.Abp.AspNetCore.Mvc.Uow; using Volo.Abp.AspNetCore.Mvc.Validation; @@ -28,6 +29,7 @@ namespace Volo.Abp.AspNetCore.Mvc private static void AddFilters(MvcOptions options) { options.Filters.AddService(typeof(AbpAuditActionFilter)); + options.Filters.AddService(typeof(AbpNoContentActionFilter)); options.Filters.AddService(typeof(AbpFeatureActionFilter)); options.Filters.AddService(typeof(AbpValidationActionFilter)); options.Filters.AddService(typeof(AbpUowActionFilter)); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs index 5015d146e8..1744658d41 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs +++ b/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 { - Auth = await GetAuthConfigAsync(), - Features = await GetFeaturesConfigAsync(), - Localization = await GetLocalizationConfigAsync(), + Auth = await GetAuthConfigAsync().ConfigureAwait(false), + Features = await GetFeaturesConfigAsync().ConfigureAwait(false), + Localization = await GetLocalizationConfigAsync().ConfigureAwait(false), CurrentUser = GetCurrentUser(), Setting = await GetSettingConfigAsync() +.ConfigureAwait(false) }; } @@ -81,7 +82,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations var authConfig = new ApplicationAuthConfigurationDto(); - var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync(); + var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync().ConfigureAwait(false); Logger.LogDebug($"GetPoliciesNamesAsync returns {policyNames.Count} items."); @@ -91,7 +92,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations Logger.LogDebug($"_authorizationService.IsGrantedAsync? {policyName}"); - if (await _authorizationService.IsGrantedAsync(policyName)) + if (await _authorizationService.IsGrantedAsync(policyName).ConfigureAwait(false)) { authConfig.GrantedPolicies[policyName] = true; } @@ -174,7 +175,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations 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()"); @@ -195,7 +196,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations 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()"); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs index 67672986be..ae41e579c9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations [HttpGet] public async Task GetAsync() { - return await _applicationConfigurationAppService.GetAsync(); + return await _applicationConfigurationAppService.GetAsync().ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs index 6cc01966a5..00cef65179 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs +++ b/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)] public async Task Get() { - var script = CreateAbpExtendScript(await _configurationAppService.GetAsync()); + var script = CreateAbpExtendScript(await _configurationAppService.GetAsync().ConfigureAwait(false)); return Content( _options.MinifyGeneratedScript == true diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs index 33932137cb..4699689d76 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs +++ b/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)) { - await next(); + await next().ConfigureAwait(false); return; } @@ -37,7 +37,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing try { - var result = await next(); + var result = await next().ConfigureAwait(false); if (result.Exception != null && !result.ExceptionHandled) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs index de8958920d..d3a8025813 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authentication [HttpGet] public async Task Logout(string returnUrl = "", string returnUrlHash = "") { - await HttpContext.SignOutAsync(); + await HttpContext.SignOutAsync().ConfigureAwait(false); return RedirectSafely(returnUrl, returnUrlHash); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs index 577acda339..ffca5b12ee 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs +++ b/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()) { - await next(); + await next().ConfigureAwait(false); return; } @@ -33,9 +33,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Features { await _methodInvocationAuthorizationService.CheckAsync( new MethodInvocationFeatureCheckerContext(methodInfo) - ); + ).ConfigureAwait(false); - await next(); + await next().ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinder.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinder.cs index 1916b9aa16..1e31da90f8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinder.cs +++ b/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) { - await _simpleTypeModelBinder.BindModelAsync(bindingContext); + await _simpleTypeModelBinder.BindModelAsync(bindingContext).ConfigureAwait(false); if (!bindingContext.Result.IsModelSet) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Response/AbpNoContentActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Response/AbpNoContentActionFilter.cs new file mode 100644 index 0000000000..b6d56b2f2a --- /dev/null +++ b/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; + } + } + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs index 552ce7e04e..56153fedea 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs +++ b/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()) { - await next(); + await next().ConfigureAwait(false); return; } @@ -39,7 +39,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow if (unitOfWorkAttr?.IsDisabled == true) { - await next(); + await next().ConfigureAwait(false); return; } @@ -48,10 +48,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow //Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware if (_unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options)) { - var result = await next(); + var result = await next().ConfigureAwait(false); if (!Succeed(result)) { - await RollbackAsync(context); + await RollbackAsync(context).ConfigureAwait(false); } return; @@ -60,10 +60,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow //Begin a new, independent unit of work using (var uow = _unitOfWorkManager.Begin(options)) { - var result = await next(); + var result = await next().ConfigureAwait(false); 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; if (currentUow != null) { - await currentUow.RollbackAsync(context.HttpContext.RequestAborted); + await currentUow.RollbackAsync(context.HttpContext.RequestAborted).ConfigureAwait(false); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs index ca87f2b962..963459ab58 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs +++ b/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() || !context.ActionDescriptor.HasObjectResult()) { - await next(); + await next().ConfigureAwait(false); return; } _validator.Validate(context.ModelState); - await next(); + await next().ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs index a7dfa5044c..32fed42dc2 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs @@ -27,11 +27,11 @@ namespace Microsoft.AspNetCore.RequestLocalization next, new OptionsWrapper( await _requestLocalizationOptionsProvider.GetLocalizationOptionsAsync() - ), +.ConfigureAwait(false)), _loggerFactory ); - await middleware.Invoke(context); + await middleware.Invoke(context).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs index c30eafb9d0..51932953ed 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs @@ -36,15 +36,15 @@ namespace Microsoft.AspNetCore.RequestLocalization { if (_requestLocalizationOptions == null) { - using (await _syncSemaphore.LockAsync()) + using (await _syncSemaphore.LockAsync().ConfigureAwait(false)) { using (var serviceScope = _serviceProviderFactory.CreateScope()) { var languageProvider = serviceScope.ServiceProvider.GetRequiredService(); var settingProvider = serviceScope.ServiceProvider.GetRequiredService(); - var languages = await languageProvider.GetLanguagesAsync(); - var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); + var languages = await languageProvider.GetLanguagesAsync().ConfigureAwait(false); + var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage).ConfigureAwait(false); var options = !languages.Any() ? new RequestLocalizationOptions() diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs index 78ae28e63f..d56c29709a 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.AspNetCore.Auditing { if (!ShouldWriteAuditLog(context)) { - await next(context); + await next(context).ConfigureAwait(false); return; } @@ -38,11 +38,11 @@ namespace Volo.Abp.AspNetCore.Auditing { try { - await next(context); + await next(context).ConfigureAwait(false); } finally { - await scope.SaveAsync(); + await scope.SaveAsync().ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs index cdd921dae4..d9954dc424 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling { try { - await next(context); + await next(context).ConfigureAwait(false); } catch (Exception ex) { @@ -44,7 +44,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling { if (actionInfo.IsObjectResult) //TODO: Align with AbpExceptionFilter.ShouldHandleException! { - await HandleAndWrapException(context, ex); + await HandleAndWrapException(context, ex).ConfigureAwait(false); return; } } @@ -72,7 +72,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling errorInfoConverter.Convert(exception) ) ) - ); + ).ConfigureAwait(false); } private Task ClearCacheHeaders(object state) diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs index b3ee565100..068adffefb 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Tracing try { - await next(context); + await next(context).ConfigureAwait(false); } finally { diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs index c9ac1be509..46572b4450 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs +++ b/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)) { - await next(context); - await uow.CompleteAsync(context.RequestAborted); + await next(context).ConfigureAwait(false); + await uow.CompleteAsync(context.RequestAborted).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs index 5a401a218e..a49145298a 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs +++ b/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)) { - await invocation.ProceedAsync(); + await invocation.ProceedAsync().ConfigureAwait(false); return; } @@ -30,7 +30,7 @@ namespace Volo.Abp.Auditing try { - await invocation.ProceedAsync(); + await invocation.ProceedAsync().ConfigureAwait(false); } catch (Exception ex) { diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs index 070684f48a..25738843c0 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs +++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs @@ -116,7 +116,7 @@ namespace Volo.Abp.Auditing 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() { - await _auditingManager.SaveAsync(this); + await _auditingManager.SaveAsync(this).ConfigureAwait(false); } public void Dispose() diff --git a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs index d682d4f0c8..ef033170f6 100644 --- a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs +++ b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Authorization authorizationService, null, policyName - ); + ).ConfigureAwait(false); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) @@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Authorization authorizationService.AsAbpAuthorizationService().CurrentPrincipal, resource, requirement - ); + ).ConfigureAwait(false); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) @@ -31,16 +31,16 @@ namespace Microsoft.AspNetCore.Authorization authorizationService.AsAbpAuthorizationService().CurrentPrincipal, resource, policy - ); + ).ConfigureAwait(false); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) { return await AuthorizeAsync( - authorizationService, + authorizationService, null, policy - ); + ).ConfigureAwait(false); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IEnumerable requirements) @@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Authorization authorizationService.AsAbpAuthorizationService().CurrentPrincipal, resource, requirements - ); + ).ConfigureAwait(false); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, string policyName) @@ -58,42 +58,42 @@ namespace Microsoft.AspNetCore.Authorization authorizationService.AsAbpAuthorizationService().CurrentPrincipal, resource, policyName - ); + ).ConfigureAwait(false); } public static async Task IsGrantedAsync(this IAuthorizationService authorizationService, string policyName) { - return (await authorizationService.AuthorizeAsync(policyName)).Succeeded; + return (await authorizationService.AuthorizeAsync(policyName).ConfigureAwait(false)).Succeeded; } public static async Task 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 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 IsGrantedAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) { - return (await authorizationService.AuthorizeAsync(policy)).Succeeded; + return (await authorizationService.AuthorizeAsync(policy).ConfigureAwait(false)).Succeeded; } public static async Task IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IEnumerable requirements) { - return (await authorizationService.AuthorizeAsync(resource, requirements)).Succeeded; + return (await authorizationService.AuthorizeAsync(resource, requirements).ConfigureAwait(false)).Succeeded; } public static async Task 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) { - if (!await authorizationService.IsGrantedAsync(policyName)) + if (!await authorizationService.IsGrantedAsync(policyName).ConfigureAwait(false)) { 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) { - 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); } @@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Authorization 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); } @@ -117,7 +117,7 @@ namespace Microsoft.AspNetCore.Authorization 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."); } @@ -125,7 +125,7 @@ namespace Microsoft.AspNetCore.Authorization public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IEnumerable 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); } @@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Authorization 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); } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs index f636877fc1..61454b76e1 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization public override async Task GetPolicyAsync(string policyName) { - var policy = await base.GetPolicyAsync(policyName); + var policy = await base.GetPolicyAsync(policyName).ConfigureAwait(false); if (policy != null) { return policy; diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs index 44466884dd..5c7afbd7c7 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs +++ b/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) { - await AuthorizeAsync(invocation); - await invocation.ProceedAsync(); + await AuthorizeAsync(invocation).ConfigureAwait(false); + await invocation.ProceedAsync().ConfigureAwait(false); } protected virtual async Task AuthorizeAsync(IAbpMethodInvocation invocation) @@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization new MethodInvocationAuthorizationContext( invocation.Method ) - ); + ).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs index 56baba8ce4..1e063f1f0e 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs +++ b/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)) { - await CheckAsync(authorizationAttribute); + await CheckAsync(authorizationAttribute).ConfigureAwait(false); } } @@ -74,7 +74,7 @@ namespace Volo.Abp.Authorization } else { - await _authorizationService.CheckAsync(authorizationAttribute.Policy); + await _authorizationService.CheckAsync(authorizationAttribute.Policy).ConfigureAwait(false); } //TODO: What about roles and other props? diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs index d4ec7c1d3c..89c0a1f71b 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Authorization AuthorizationHandlerContext context, PermissionRequirement requirement) { - if (await _permissionChecker.IsGrantedAsync(context.User, requirement.PermissionName)) + if (await _permissionChecker.IsGrantedAsync(context.User, requirement.PermissionName).ConfigureAwait(false)) { context.Succeed(requirement); } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs index d6975e38ec..33aeb568b2 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs +++ b/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) - ? PermissionGrantResult.Granted +.ConfigureAwait(false) ? PermissionGrantResult.Granted : PermissionGrantResult.Undefined; } } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs index 51c8530ee6..165a354743 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.Authorization.Permissions public virtual async Task IsGrantedAsync(string name) { - return await IsGrantedAsync(PrincipalAccessor.Principal, name); + return await IsGrantedAsync(PrincipalAccessor.Principal, name).ConfigureAwait(false); } public virtual async Task IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name) @@ -56,7 +56,7 @@ namespace Volo.Abp.Authorization.Permissions continue; } - var result = await provider.CheckAsync(context); + var result = await provider.CheckAsync(context).ConfigureAwait(false); if (result == PermissionGrantResult.Granted) { diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs index b98867a78e..f5322b4f12 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs +++ b/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) { - if (await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, role)) + if (await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, role).ConfigureAwait(false)) { return PermissionGrantResult.Granted; } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs index c7f327c40c..49a1eec366 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs +++ b/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) - ? PermissionGrantResult.Granted +.ConfigureAwait(false) ? PermissionGrantResult.Granted : PermissionGrantResult.Undefined; } } diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs index ec0ac8ee3f..c9b5790003 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs @@ -4,7 +4,6 @@ using Microsoft.Extensions.Options; using System; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; -using Volo.Abp.Threading; namespace Volo.Abp.BackgroundJobs { @@ -21,7 +20,7 @@ namespace Volo.Abp.BackgroundJobs Logger = NullLogger.Instance; } - public virtual void Execute(JobExecutionContext context) + public virtual async Task ExecuteAsync(JobExecutionContext context) { var job = context.ServiceProvider.GetService(context.JobType); if (job == null) @@ -41,7 +40,7 @@ namespace Volo.Abp.BackgroundJobs { if (jobExecuteMethod.Name == nameof(IAsyncBackgroundJob.ExecuteAsync)) { - AsyncHelper.RunSync(() => (Task) jobExecuteMethod.Invoke(job, new[] {context.JobArgs})); + await ((Task) jobExecuteMethod.Invoke(job, new[] {context.JobArgs})).ConfigureAwait(false); } else { diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/IBackgroundJobExecuter.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/IBackgroundJobExecuter.cs index 2470b2945b..eaea1764f3 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/IBackgroundJobExecuter.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/IBackgroundJobExecuter.cs @@ -1,7 +1,9 @@ -namespace Volo.Abp.BackgroundJobs +using System.Threading.Tasks; + +namespace Volo.Abp.BackgroundJobs { public interface IBackgroundJobExecuter { - void Execute(JobExecutionContext context); + Task ExecuteAsync(JobExecutionContext context); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs b/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs index 4a61aa2845..676a3eaafc 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using Volo.Abp.Threading; namespace Volo.Abp.BackgroundJobs.Hangfire { @@ -25,7 +26,7 @@ namespace Volo.Abp.BackgroundJobs.Hangfire { var jobType = Options.GetJob(typeof(TArgs)).JobType; var context = new JobExecutionContext(scope.ServiceProvider, jobType, args); - JobExecuter.Execute(context); + AsyncHelper.RunSync(() => JobExecuter.ExecuteAsync(context)); } } } diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs index f2b00345a1..fb18ca00f9 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs @@ -10,6 +10,7 @@ using Nito.AsyncEx; using RabbitMQ.Client; using RabbitMQ.Client.Events; using Volo.Abp.RabbitMQ; +using Volo.Abp.Threading; namespace Volo.Abp.BackgroundJobs.RabbitMQ { @@ -71,11 +72,11 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ { 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; } @@ -90,9 +91,9 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ return; } - using (await SyncObj.LockAsync()) + using (await SyncObj.LockAsync().ConfigureAwait(false)) { - await EnsureInitializedAsync(); + await EnsureInitializedAsync().ConfigureAwait(false); } } @@ -181,7 +182,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ try { - JobExecuter.Execute(context); + AsyncHelper.RunSync(() => JobExecuter.ExecuteAsync(context)); ChannelAccessor.Channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false); } catch (BackgroundJobExecutionException) diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs index f07564ad5a..6c50460003 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs +++ b/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()) { var jobQueue = (IRunnable)ServiceProvider.GetRequiredService(typeof(IJobQueue<>).MakeGenericType(jobConfiguration.ArgsType)); - await jobQueue.StartAsync(cancellationToken); + await jobQueue.StartAsync(cancellationToken).ConfigureAwait(false); JobQueues[jobConfiguration.JobName] = jobQueue; } } @@ -49,7 +49,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ { foreach (var jobQueue in JobQueues.Values) { - await jobQueue.StopAsync(cancellationToken); + await jobQueue.StopAsync(cancellationToken).ConfigureAwait(false); } JobQueues.Clear(); @@ -64,7 +64,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ return (IJobQueue)jobQueue; } - using (await SyncSemaphore.LockAsync()) + using (await SyncSemaphore.LockAsync().ConfigureAwait(false)) { if (JobQueues.TryGetValue(jobConfiguration.JobName, out jobQueue)) { @@ -74,7 +74,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ jobQueue = (IJobQueue)ServiceProvider .GetRequiredService(typeof(IJobQueue<>).MakeGenericType(typeof(TArgs))); - await jobQueue.StartAsync(); + await jobQueue.StartAsync().ConfigureAwait(false); JobQueues.TryAdd(jobConfiguration.JobName, jobQueue); diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/RabbitMqBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/RabbitMqBackgroundJobManager.cs index f70d553128..8945beb6cb 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/RabbitMqBackgroundJobManager.cs +++ b/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, TimeSpan? delay = null) { - var jobQueue = await _jobQueueManager.GetAsync(); - return await jobQueue.EnqueueAsync(args, priority, delay); + var jobQueue = await _jobQueueManager.GetAsync().ConfigureAwait(false); + return await jobQueue.EnqueueAsync(args, priority, delay).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs index 74a3f6128f..a16690f346 100644 --- a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs +++ b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -9,92 +10,88 @@ using Volo.Abp.Timing; namespace Volo.Abp.BackgroundJobs { - public class BackgroundJobWorker : PeriodicBackgroundWorkerBase, IBackgroundJobWorker + public class BackgroundJobWorker : AsyncPeriodicBackgroundWorkerBase, IBackgroundJobWorker { protected AbpBackgroundJobOptions JobOptions { get; } protected AbpBackgroundJobWorkerOptions WorkerOptions { get; } - protected IServiceScopeFactory ServiceScopeFactory { get; } - public BackgroundJobWorker( AbpTimer timer, IOptions jobOptions, IOptions workerOptions, IServiceScopeFactory serviceScopeFactory) - : base(timer) + : base( + timer, + serviceScopeFactory) { - ServiceScopeFactory = serviceScopeFactory; WorkerOptions = workerOptions.Value; JobOptions = jobOptions.Value; Timer.Period = WorkerOptions.JobPollPeriod; } - protected override void DoWork() + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - using (var scope = ServiceScopeFactory.CreateScope()) - { - var store = scope.ServiceProvider.GetRequiredService(); + var store = workerContext.ServiceProvider.GetRequiredService(); - var waitingJobs = AsyncHelper.RunSync(() => store.GetWaitingJobsAsync(WorkerOptions.MaxJobFetchCount)); + var waitingJobs = await store.GetWaitingJobsAsync(WorkerOptions.MaxJobFetchCount).ConfigureAwait(false); - if (!waitingJobs.Any()) - { - return; - } + if (!waitingJobs.Any()) + { + return; + } + + var jobExecuter = workerContext.ServiceProvider.GetRequiredService(); + var clock = workerContext.ServiceProvider.GetRequiredService(); + var serializer = workerContext.ServiceProvider.GetRequiredService(); - var jobExecuter = scope.ServiceProvider.GetRequiredService(); - var clock = scope.ServiceProvider.GetRequiredService(); - var serializer = scope.ServiceProvider.GetRequiredService(); + foreach (var jobInfo in waitingJobs) + { + jobInfo.TryCount++; + jobInfo.LastTryTime = clock.Now; - foreach (var jobInfo in waitingJobs) + try { - jobInfo.TryCount++; - jobInfo.LastTryTime = clock.Now; + var jobConfiguration = JobOptions.GetJob(jobInfo.JobName); + var jobArgs = serializer.Deserialize(jobInfo.JobArgs, jobConfiguration.ArgsType); + var context = new JobExecutionContext(workerContext.ServiceProvider, jobConfiguration.JobType, jobArgs); try { - var jobConfiguration = JobOptions.GetJob(jobInfo.JobName); - var jobArgs = serializer.Deserialize(jobInfo.JobArgs, jobConfiguration.ArgsType); - var context = new JobExecutionContext(scope.ServiceProvider, jobConfiguration.JobType, jobArgs); + await jobExecuter.ExecuteAsync(context).ConfigureAwait(false); - try - { - jobExecuter.Execute(context); + await store.DeleteAsync(jobInfo.Id).ConfigureAwait(false); + } + catch (BackgroundJobExecutionException) + { + var nextTryTime = CalculateNextTryTime(jobInfo, clock); - AsyncHelper.RunSync(() => store.DeleteAsync(jobInfo.Id)); + if (nextTryTime.HasValue) + { + jobInfo.NextTryTime = nextTryTime.Value; } - catch (BackgroundJobExecutionException) + else { - var nextTryTime = CalculateNextTryTime(jobInfo, clock); - - if (nextTryTime.HasValue) - { - jobInfo.NextTryTime = nextTryTime.Value; - } - else - { - jobInfo.IsAbandoned = true; - } - - TryUpdate(store, jobInfo); + jobInfo.IsAbandoned = true; } + + await TryUpdateAsync(store, jobInfo).ConfigureAwait(false); } - catch (Exception ex) - { - Logger.LogException(ex); - jobInfo.IsAbandoned = true; - TryUpdate(store, jobInfo); - } + } + catch (Exception ex) + { + Logger.LogException(ex); + jobInfo.IsAbandoned = true; + await TryUpdateAsync(store, jobInfo).ConfigureAwait(false); } } } - protected virtual void TryUpdate(IBackgroundJobStore store, BackgroundJobInfo jobInfo) + protected virtual async Task TryUpdateAsync(IBackgroundJobStore store, BackgroundJobInfo jobInfo) { try { - AsyncHelper.RunSync(() => store.UpdateAsync(jobInfo)); + await store.UpdateAsync(jobInfo).ConfigureAwait(false); } catch (Exception updateEx) { diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs index 0994029f70..266bb37fde 100644 --- a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs +++ b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs @@ -32,7 +32,7 @@ namespace Volo.Abp.BackgroundJobs public virtual async Task EnqueueAsync(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null) { var jobName = BackgroundJobNameAttribute.GetName(); - var jobId = await EnqueueAsync(jobName, args, priority, delay); + var jobId = await EnqueueAsync(jobName, args, priority, delay).ConfigureAwait(false); return jobId.ToString(); } @@ -53,7 +53,7 @@ namespace Volo.Abp.BackgroundJobs jobInfo.NextTryTime = Clock.Now.Add(delay.Value); } - await Store.InsertAsync(jobInfo); + await Store.InsertAsync(jobInfo).ConfigureAwait(false); return jobInfo.Id; } diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs new file mode 100644 index 0000000000..cd8474e654 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs @@ -0,0 +1,55 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Volo.Abp.Threading; + +namespace Volo.Abp.BackgroundWorkers +{ + public abstract class AsyncPeriodicBackgroundWorkerBase : BackgroundWorkerBase + { + protected IServiceScopeFactory ServiceScopeFactory { get; } + protected AbpTimer Timer { get; } + + protected AsyncPeriodicBackgroundWorkerBase( + AbpTimer timer, + IServiceScopeFactory serviceScopeFactory) + { + ServiceScopeFactory = serviceScopeFactory; + Timer = timer; + Timer.Elapsed += Timer_Elapsed; + } + + public override async Task StartAsync(CancellationToken cancellationToken = default) + { + await base.StartAsync(cancellationToken).ConfigureAwait(false); + Timer.Start(cancellationToken); + } + + public override async Task StopAsync(CancellationToken cancellationToken = default) + { + Timer.Stop(cancellationToken); + await base.StopAsync(cancellationToken).ConfigureAwait(false); + } + + private void Timer_Elapsed(object sender, System.EventArgs e) + { + try + { + using (var scope = ServiceScopeFactory.CreateScope()) + { + AsyncHelper.RunSync( + () => DoWorkAsync(new PeriodicBackgroundWorkerContext(scope.ServiceProvider)) + ); + } + } + catch (Exception ex) + { + Logger.LogException(ex); + } + } + + protected abstract Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext); + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerContext.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerContext.cs new file mode 100644 index 0000000000..dc5635ae88 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerContext.cs @@ -0,0 +1,14 @@ +using System; + +namespace Volo.Abp.BackgroundWorkers +{ + public class PeriodicBackgroundWorkerContext + { + public IServiceProvider ServiceProvider { get; } + + public PeriodicBackgroundWorkerContext(IServiceProvider serviceProvider) + { + ServiceProvider = serviceProvider; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs index a8b884e096..27a0b05173 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs @@ -56,7 +56,7 @@ namespace Volo.Abp.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) { - await worker.StopAsync(cancellationToken); + await worker.StopAsync(cancellationToken).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs index e699e4cbc8..863657ab79 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Volo.Abp.Threading; @@ -11,35 +12,38 @@ namespace Volo.Abp.BackgroundWorkers /// public abstract class PeriodicBackgroundWorkerBase : BackgroundWorkerBase { - protected readonly AbpTimer Timer; + protected IServiceScopeFactory ServiceScopeFactory { get; } + protected AbpTimer Timer { get; } - /// - /// Initializes a new instance of the class. - /// - /// A timer. - protected PeriodicBackgroundWorkerBase(AbpTimer timer) + protected PeriodicBackgroundWorkerBase( + AbpTimer timer, + IServiceScopeFactory serviceScopeFactory) { + ServiceScopeFactory = serviceScopeFactory; Timer = timer; Timer.Elapsed += Timer_Elapsed; } public override async Task StartAsync(CancellationToken cancellationToken = default) { - await base.StartAsync(cancellationToken); + await base.StartAsync(cancellationToken).ConfigureAwait(false); Timer.Start(cancellationToken); } public override async Task StopAsync(CancellationToken cancellationToken = default) { Timer.Stop(cancellationToken); - await base.StopAsync(cancellationToken); + await base.StopAsync(cancellationToken).ConfigureAwait(false); } - + private void Timer_Elapsed(object sender, System.EventArgs e) { try { - DoWork(); + using (var scope = ServiceScopeFactory.CreateScope()) + { + DoWork(new PeriodicBackgroundWorkerContext(scope.ServiceProvider)); + } } catch (Exception ex) { @@ -50,6 +54,6 @@ namespace Volo.Abp.BackgroundWorkers /// /// Periodic works should be done by implementing this method. /// - protected abstract void DoWork(); + protected abstract void DoWork(PeriodicBackgroundWorkerContext workerContext); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs index dbcfb184eb..daa64060f7 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs @@ -175,7 +175,7 @@ namespace Volo.Abp.Caching cachedBytes = await Cache.GetAsync( NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token) - ); + ).ConfigureAwait(false); } catch (Exception ex) { @@ -250,22 +250,22 @@ namespace Volo.Abp.Caching CancellationToken token = default) { token = CancellationTokenProvider.FallbackToProvider(token); - var value = await GetAsync(key, hideErrors, token); + var value = await GetAsync(key, hideErrors, token).ConfigureAwait(false); if (value != null) { 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) { return value; } - value = await factory(); - await SetAsync(key, value, optionsFactory?.Invoke(), hideErrors, token); + value = await factory().ConfigureAwait(false); + await SetAsync(key, value, optionsFactory?.Invoke(), hideErrors, token).ConfigureAwait(false); } return value; @@ -331,7 +331,7 @@ namespace Volo.Abp.Caching Serializer.Serialize(value), options ?? DefaultCacheOptions, CancellationTokenProvider.FallbackToProvider(token) - ); + ).ConfigureAwait(false); } catch (Exception ex) { @@ -387,7 +387,7 @@ namespace Volo.Abp.Caching try { - await Cache.RefreshAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)); + await Cache.RefreshAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)).ConfigureAwait(false); } catch (Exception ex) { @@ -443,7 +443,7 @@ namespace Volo.Abp.Caching try { - await Cache.RemoveAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)); + await Cache.RemoveAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)).ConfigureAwait(false); } catch (Exception ex) { diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs index 89f3713521..7fbc9fdf0a 100644 --- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs +++ b/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() { - await Proceed(Invocation, ProceedInfo); + await Proceed(Invocation, ProceedInfo).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs index 8a0c4fdd45..bd379f442d 100644 --- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs +++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Castle.DynamicProxy { await _abpInterceptor.InterceptAsync( new CastleAbpMethodInvocationAdapter(invocation, proceedInfo, proceed) - ); + ).ConfigureAwait(false); } protected override async Task InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func> proceed) @@ -28,7 +28,7 @@ namespace Volo.Abp.Castle.DynamicProxy await _abpInterceptor.InterceptAsync( adapter - ); + ).ConfigureAwait(false); return (TResult)adapter.ReturnValue; } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs index 66d16f9305..3fdd0aae1d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs +++ b/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; } - var accessToken = await AuthenticationService.GetAccessTokenAsync(configuration); + var accessToken = await AuthenticationService.GetAccessTokenAsync(configuration).ConfigureAwait(false); File.WriteAllText(CliPaths.AccessToken, accessToken, Encoding.UTF8); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs index 436e169aad..b53327cba3 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs +++ b/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)"); - await CheckCliVersionAsync(); + await CheckCliVersionAsync().ConfigureAwait(false); var commandLineArgs = CommandLineArgumentParser.Parse(args); var commandType = CommandSelector.Select(commandLineArgs); @@ -52,7 +52,7 @@ namespace Volo.Abp.Cli try { - await command.ExecuteAsync(commandLineArgs); + await command.ExecuteAsync(commandLineArgs).ConfigureAwait(false); } catch (CliUsageException usageException) { @@ -69,14 +69,14 @@ namespace Volo.Abp.Cli { var assembly = typeof(CliService).Assembly; var toolPath = GetToolPath(assembly); - var currentCliVersion = await GetCurrentCliVersion(assembly); + var currentCliVersion = await GetCurrentCliVersion(assembly).ConfigureAwait(false); var updateChannel = GetUpdateChannel(currentCliVersion); Logger.LogInformation($"Version {currentCliVersion} ({updateChannel} channel)"); try { - var latestVersion = await GetLatestVersion(updateChannel); + var latestVersion = await GetLatestVersion(updateChannel).ConfigureAwait(false); if (latestVersion != null && latestVersion > currentCliVersion) { @@ -106,7 +106,7 @@ namespace Volo.Abp.Cli var consoleOutput = new StringReader(CmdHelper.RunCmdAndGetOutput($"dotnet tool list -g")); string line; - while ((line = await consoleOutput.ReadLineAsync()) != null) + while ((line = await consoleOutput.ReadLineAsync().ConfigureAwait(false)) != null) { if (line.StartsWith("volo.abp.cli", StringComparison.InvariantCultureIgnoreCase)) { @@ -155,13 +155,13 @@ namespace Volo.Abp.Cli switch (updateChannel) { case UpdateChannel.Stable: - return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli"); + return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli").ConfigureAwait(false); 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: - return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includeNightly: true); + return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includeNightly: true).ConfigureAwait(false); default: return default; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs index 3081c77cb5..8c4c8c01f2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs @@ -4,9 +4,9 @@ { #if DEBUG public const string WwwAbpIo = "https://localhost:44328/"; - + public const string AccountAbpIo = "https://localhost:44333/"; - + public const string NuGetRootPath = "https://localhost:44373/"; #else public const string WwwAbpIo = "https://abp.io/"; @@ -18,7 +18,12 @@ 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"; } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index 58adc65fc4..d8715c2700 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -42,7 +42,7 @@ namespace Volo.Abp.Cli.Commands commandLineArgs.Target, commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long), skipDbMigrations - ); + ).ConfigureAwait(false); } public string GetUsageInfo() diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs index 03e228f255..cbfde5610f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs @@ -37,7 +37,7 @@ namespace Volo.Abp.Cli.Commands await ProjectNugetPackageAdder.AddAsync( GetProjectFile(commandLineArgs), commandLineArgs.Target - ); + ).ConfigureAwait(false); } public string GetUsageInfo() diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs index e1536c2973..edd7bd985a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs @@ -79,7 +79,7 @@ namespace Volo.Abp.Cli.Commands gitHubLocalRepositoryPath, commandLineArgs.Options ) - ); + ).ConfigureAwait(false); using (var templateFileStream = new MemoryStream(result.ZipContent)) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs index 2da6b82c8a..060bd91cc7 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs @@ -24,12 +24,12 @@ namespace Volo.Abp.Cli.Commands AbpCliOptions = cliOptions.Value; } - public async Task ExecuteAsync(CommandLineArgs commandLineArgs) + public Task ExecuteAsync(CommandLineArgs commandLineArgs) { if (string.IsNullOrWhiteSpace(commandLineArgs.Target)) { Logger.LogInformation(GetUsageInfo()); - return; + return Task.CompletedTask; } var commandType = AbpCliOptions.Commands[commandLineArgs.Target]; @@ -39,6 +39,8 @@ namespace Volo.Abp.Cli.Commands var command = (IConsoleCommand) scope.ServiceProvider.GetRequiredService(commandType); Logger.LogInformation(command.GetUsageInfo()); } + + return Task.CompletedTask; } public string GetUsageInfo() diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs index fe9ed2d98f..175f45aa75 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs @@ -48,7 +48,7 @@ namespace Volo.Abp.Cli.Commands commandLineArgs.Target, password, commandLineArgs.Options.GetOrNull(Options.Organization.Short, Options.Organization.Long) - ); + ).ConfigureAwait(false); Logger.LogInformation($"Successfully logged in as '{commandLineArgs.Target}'"); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 9cfa702fd7..1314f058c2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -97,7 +97,7 @@ namespace Volo.Abp.Cli.Commands gitHubLocalRepositoryPath, commandLineArgs.Options ) - ); + ).ConfigureAwait(false); using (var templateFileStream = new MemoryStream(result.ZipContent)) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs index a47a865617..1697489d71 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs @@ -36,12 +36,12 @@ namespace Volo.Abp.Cli.Commands case "install": Logger.LogInformation("Installing ABP Suite..."); - await InstallSuiteAsync(); + await InstallSuiteAsync().ConfigureAwait(false); break; case "update": Logger.LogInformation("Updating ABP Suite..."); - await UpdateSuiteAsync(); + await UpdateSuiteAsync().ConfigureAwait(false); break; case "remove": @@ -53,7 +53,7 @@ namespace Volo.Abp.Cli.Commands private async Task InstallSuiteAsync() { - var nugetIndexUrl = await GetNuGetIndexUrlAsync(); + var nugetIndexUrl = await GetNuGetIndexUrlAsync().ConfigureAwait(false); if (nugetIndexUrl == null) { @@ -71,7 +71,7 @@ namespace Volo.Abp.Cli.Commands private async Task UpdateSuiteAsync() { - var nugetIndexUrl = await GetNuGetIndexUrlAsync(); + var nugetIndexUrl = await GetNuGetIndexUrlAsync().ConfigureAwait(false); if (nugetIndexUrl == null) { @@ -106,7 +106,7 @@ namespace Volo.Abp.Cli.Commands private async Task GetNuGetIndexUrlAsync() { - var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync(); + var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync().ConfigureAwait(false); if (apiKeyResult == null || string.IsNullOrEmpty(apiKeyResult.ApiKey)) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs index d201790c94..166720c64e 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -37,7 +37,7 @@ namespace Volo.Abp.Cli.Commands if (updateNuget || !updateNpm) { - await UpdateNugetPackages(commandLineArgs, directory); + await UpdateNugetPackages(commandLineArgs, directory).ConfigureAwait(false); } if (updateNpm || !updateNuget) @@ -62,7 +62,7 @@ namespace Volo.Abp.Cli.Commands { var solutionName = Path.GetFileName(solution).RemovePostFix(".sln"); - await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, includePreviews); + await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, includePreviews).ConfigureAwait(false); Logger.LogInformation($"Volo packages are updated in {solutionName} solution."); return; @@ -74,7 +74,7 @@ namespace Volo.Abp.Cli.Commands { var projectName = Path.GetFileName(project).RemovePostFix(".csproj"); - await _nugetPackagesVersionUpdater.UpdateProjectAsync(project, includePreviews); + await _nugetPackagesVersionUpdater.UpdateProjectAsync(project, includePreviews).ConfigureAwait(false); Logger.LogInformation($"Volo packages are updated in {projectName} project."); return; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs index 1b9539d012..4ed8746ce6 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Net; using System.Net.Http; using System.Threading.Tasks; @@ -19,6 +20,7 @@ namespace Volo.Abp.Cli.Licensing protected IJsonSerializer JsonSerializer { get; } protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } private readonly ILogger _logger; + private DeveloperApiKeyResult _apiKeyResult = null; public AbpIoApiKeyService(IJsonSerializer jsonSerializer, IRemoteServiceExceptionHandler remoteServiceExceptionHandler, ILogger logger) { @@ -27,8 +29,20 @@ namespace Volo.Abp.Cli.Licensing _logger = logger; } - public async Task GetApiKeyOrNullAsync() + public async Task GetApiKeyOrNullAsync(bool invalidateCache = false) { + if (invalidateCache) + { + _apiKeyResult = null; + } + + if (_apiKeyResult != null) + { + return _apiKeyResult; + } + + var url = $"{CliUrls.WwwAbpIo}api/license/api-key"; + using (var client = new CliHttpClient()) { var response = await HttpPolicyExtensions @@ -45,27 +59,40 @@ namespace Volo.Abp.Cli.Licensing if (responseMessage.Exception != null) { _logger.LogWarning( - $"{retryCount}. request attempt failed with an error: \"{responseMessage.Exception.Message}\". " + + $"{retryCount}. request attempt failed to {url} with an error: \"{responseMessage.Exception.Message}\". " + $"Waiting {timeSpan.TotalSeconds} secs for the next try..."); } else if (responseMessage.Result != null) { _logger.LogWarning( - $"{retryCount}. request attempt failed with {responseMessage.Result.StatusCode}-{responseMessage.Result.ReasonPhrase}. " + + $"{retryCount}. request attempt failed {url} with {(int)responseMessage.Result.StatusCode}-{responseMessage.Result.ReasonPhrase}. " + $"Waiting {timeSpan.TotalSeconds} secs for the next try..."); } }) - .ExecuteAsync(async () => await client.GetAsync($"{CliUrls.WwwAbpIo}api/license/api-key")); + .ExecuteAsync(async () => await client.GetAsync(url).ConfigureAwait(false)).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { throw new Exception($"ERROR: Remote server returns '{response.StatusCode}'"); } - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response).ConfigureAwait(false); + + var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var apiKeyResult = JsonSerializer.Deserialize(responseContent); + + if (apiKeyResult == null || + string.IsNullOrEmpty(apiKeyResult.ApiKey)) + { + _logger.LogError("Couldn't retrieve your NuGet API key!"); + _logger.LogWarning(File.Exists(CliPaths.AccessToken) + ? "Make sure you have an active session and license on commercial.abp.io. To re-sign in you can use the CLI command \"abp login \"." + : "You are not signed in to commercial.abp.io. Use the CLI command \"abp login \" to sign in."); + + return null; + } - var responseContent = await response.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(responseContent); + return apiKeyResult; } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/IApiKeyService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/IApiKeyService.cs index 23ff81555a..8638472e5c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/IApiKeyService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/IApiKeyService.cs @@ -4,6 +4,6 @@ namespace Volo.Abp.Cli.Licensing { public interface IApiKeyService { - Task GetApiKeyOrNullAsync(); + Task GetApiKeyOrNullAsync(bool invalidateCache = false); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs index 1a067243d5..37d487f106 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs @@ -2,10 +2,19 @@ using Newtonsoft.Json; using NuGet.Versioning; using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Net; +using System.Net.Http; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Polly; +using Polly.Extensions.Http; using Volo.Abp.Cli.Http; +using Volo.Abp.Cli.Licensing; using Volo.Abp.Cli.ProjectBuilding; +using Volo.Abp.Cli.ProjectModification; using Volo.Abp.DependencyInjection; using Volo.Abp.Json; using Volo.Abp.Threading; @@ -14,37 +23,54 @@ namespace Volo.Abp.Cli.NuGet { public class NuGetService : ITransientDependency { + public ILogger Logger { get; set; } protected IJsonSerializer JsonSerializer { get; } - protected ICancellationTokenProvider CancellationTokenProvider { get; } - protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } + private readonly IApiKeyService _apiKeyService; public NuGetService( IJsonSerializer jsonSerializer, IRemoteServiceExceptionHandler remoteServiceExceptionHandler, - ICancellationTokenProvider cancellationTokenProvider) + ICancellationTokenProvider cancellationTokenProvider, IApiKeyService apiKeyService) { JsonSerializer = jsonSerializer; RemoteServiceExceptionHandler = remoteServiceExceptionHandler; CancellationTokenProvider = cancellationTokenProvider; + _apiKeyService = apiKeyService; + Logger = NullLogger.Instance; } public async Task GetLatestVersionOrNullAsync(string packageId, bool includePreviews = false, bool includeNightly = false) { + var url = includeNightly ? + $"https://www.myget.org/F/abp-nightly/api/v3/flatcontainer/{packageId.ToLowerInvariant()}/index.json" : + $"https://api.nuget.org/v3-flatcontainer/{packageId.ToLowerInvariant()}/index.json"; + + using (var client = new CliHttpClient(setBearerToken: false)) { - var url = includeNightly ? - $"https://www.myget.org/F/abp-nightly/api/v3/flatcontainer/{packageId.ToLowerInvariant()}/index.json" : - $"https://api.nuget.org/v3-flatcontainer/{packageId.ToLowerInvariant()}/index.json"; + var responseMessage = await GetHttpResponseMessageWithRetryAsync(client, url).ConfigureAwait(false); - var responseMessage = await client.GetAsync(url, CancellationTokenProvider.Token); + if (responseMessage.StatusCode == HttpStatusCode.NotFound) + { + var commercialNuGetUrl = await GetNuGetUrlForCommercialPackage(packageId).ConfigureAwait(false); + responseMessage = await GetHttpResponseMessageWithRetryAsync(client, commercialNuGetUrl).ConfigureAwait(false); + } + + if (!responseMessage.IsSuccessStatusCode) + { + throw new Exception($"ERROR: Remote server returns '{responseMessage.StatusCode}'"); + } - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage).ConfigureAwait(false); - var result = await responseMessage.Content.ReadAsStringAsync(); + var responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - var versions = JsonSerializer.Deserialize(result).Versions.Select(x => SemanticVersion.Parse(x)); + var versions = JsonSerializer + .Deserialize(responseContent) + .Versions + .Select(SemanticVersion.Parse); if (!includePreviews && !includeNightly) { @@ -56,6 +82,42 @@ namespace Volo.Abp.Cli.NuGet } } + private async Task GetNuGetUrlForCommercialPackage(string packageId) + { + var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync(); + return CliUrls.GetNuGetPackageInfoUrl(apiKeyResult.ApiKey, packageId); + } + + private async Task GetHttpResponseMessageWithRetryAsync(HttpClient client, string url) + { + return await HttpPolicyExtensions + .HandleTransientHttpError() + .OrResult(msg => !msg.IsSuccessStatusCode) + .WaitAndRetryAsync(new[] + { + TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(3), + TimeSpan.FromSeconds(7) + }, + (responseMessage, timeSpan, retryCount, context) => + { + if (responseMessage.Exception != null) + { + Logger.LogWarning( + $"{retryCount}. HTTP request attempt failed to {url} with an error: HTTP {(int)responseMessage.Result.StatusCode}-{responseMessage.Exception.Message}. " + + $"Waiting {timeSpan.TotalSeconds} secs for the next try..."); + } + else if (responseMessage.Result != null) + { + Logger.LogWarning( + $"{retryCount}. HTTP request attempt failed to {url} with an error: {(int)responseMessage.Result.StatusCode}-{responseMessage.Result.ReasonPhrase}. " + + $"Waiting {timeSpan.TotalSeconds} secs for the next try..."); + } + }) + .ExecuteAsync(async () => await client.GetAsync(url, CancellationTokenProvider.Token)); + } + + public class NuGetVersionResultDto { [JsonProperty("versions")] diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs index fd0a0e5246..a422f0ff44 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs @@ -49,7 +49,7 @@ namespace Volo.Abp.Cli.ProjectBuilding string version = null) { - var latestVersion = await GetLatestSourceCodeVersionAsync(name, type); + var latestVersion = await GetLatestSourceCodeVersionAsync(name, type).ConfigureAwait(false); if (version == null) { version = latestVersion; @@ -73,7 +73,7 @@ namespace Volo.Abp.Cli.ProjectBuilding Type = type, Version = version } - ); + ).ConfigureAwait(false); if (Options.CacheTemplates) { @@ -98,11 +98,11 @@ namespace Volo.Abp.Cli.ProjectBuilding MimeTypes.Application.Json ), CancellationTokenProvider.Token - ); + ).ConfigureAwait(false); - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response).ConfigureAwait(false); - var result = await response.Content.ReadAsStringAsync(); + var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false); return JsonSerializer.Deserialize(result).Version; } @@ -118,11 +118,11 @@ namespace Volo.Abp.Cli.ProjectBuilding $"{CliUrls.WwwAbpIo}api/download/{input.Type}/", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json), CancellationTokenProvider.Token - ); + ).ConfigureAwait(false); - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage).ConfigureAwait(false); - return await responseMessage.Content.ReadAsByteArrayAsync(); + return await responseMessage.Content.ReadAsByteArrayAsync().ConfigureAwait(false); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs index fdfbb8b5d3..79fc70cfcc 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs @@ -38,12 +38,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Analyticses $"{CliUrls.WwwAbpIo}api/clianalytics/collect", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json), _cancellationTokenProvider.Token - ); + ).ConfigureAwait(false); if (!responseMessage.IsSuccessStatusCode) { var exceptionMessage = "Remote server returns '" + (int)responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. "; - var remoteServiceErrorMessage = await _remoteServiceExceptionHandler.GetAbpRemoteServiceErrorAsync(responseMessage); + var remoteServiceErrorMessage = await _remoteServiceExceptionHandler.GetAbpRemoteServiceErrorAsync(responseMessage).ConfigureAwait(false); if (remoteServiceErrorMessage != null) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs index 10b3a07172..8f8310977e 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Cli.ProjectBuilding public async Task GetAsync(string name) { - var moduleList = await GetModuleListAsync(); + var moduleList = await GetModuleListAsync().ConfigureAwait(false); var module = moduleList.FirstOrDefault(m => m.Name == name); @@ -47,10 +47,10 @@ namespace Volo.Abp.Cli.ProjectBuilding var responseMessage = await client.GetAsync( $"{CliUrls.WwwAbpIo}api/download/modules/", CancellationTokenProvider.Token - ); + ).ConfigureAwait(false); - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); - var result = await responseMessage.Content.ReadAsStringAsync(); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage).ConfigureAwait(false); + var result = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); return JsonSerializer.Deserialize>(result); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs index 48f109e1d3..f853a9ec15 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs @@ -43,15 +43,15 @@ namespace Volo.Abp.Cli.ProjectBuilding public async Task BuildAsync(ProjectBuildArgs args) { - var moduleInfo = await GetModuleInfoAsync(args); + var moduleInfo = await GetModuleInfoAsync(args).ConfigureAwait(false); var templateFile = await SourceCodeStore.GetAsync( args.TemplateName, SourceCodeTypes.Module, args.Version - ); + ).ConfigureAwait(false); - var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync(); + var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync().ConfigureAwait(false); if (apiKeyResult?.ApiKey != null) { args.ExtraProperties["api-key"] = apiKeyResult.ApiKey; @@ -96,14 +96,14 @@ namespace Volo.Abp.Cli.ProjectBuilding ProjectName = null, TemplateName = args.TemplateName, TemplateVersion = templateFile.Version - }); + }).ConfigureAwait(false); return new ProjectBuildResult(context.Result.ZipContent, args.TemplateName); } private async Task GetModuleInfoAsync(ProjectBuildArgs args) { - return await ModuleInfoProvider.GetAsync(args.TemplateName); + return await ModuleInfoProvider.GetAsync(args.TemplateName).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs index 744641bb8a..8a1af93f23 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.Cli.ProjectBuilding var exceptionMessage = "Remote server returns '" + (int) responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. "; - var remoteServiceErrorMessage = await GetAbpRemoteServiceErrorAsync(responseMessage); + var remoteServiceErrorMessage = await GetAbpRemoteServiceErrorAsync(responseMessage).ConfigureAwait(false); if (remoteServiceErrorMessage != null) { exceptionMessage += remoteServiceErrorMessage; @@ -52,7 +52,7 @@ namespace Volo.Abp.Cli.ProjectBuilding errorResult = _jsonSerializer.Deserialize ( await responseMessage.Content.ReadAsStringAsync() - ); +.ConfigureAwait(false)); } catch (JsonReaderException) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index 9d31e10200..87c399181d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -51,9 +51,9 @@ namespace Volo.Abp.Cli.ProjectBuilding args.TemplateName, SourceCodeTypes.Template, args.Version - ); + ).ConfigureAwait(false); - var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync(); + var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync().ConfigureAwait(false); if (apiKeyResult?.ApiKey != null) { args.ExtraProperties["api-key"] = apiKeyResult.ApiKey; @@ -103,7 +103,7 @@ namespace Volo.Abp.Cli.ProjectBuilding ProjectName = args.SolutionName.FullName, TemplateName = args.TemplateName, TemplateVersion = templateFile.Version - }); + }).ConfigureAwait(false); return new ProjectBuildResult(context.Result.ZipContent, args.SolutionName.ProjectName); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs index 1bacd7cd61..76b7584ae8 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs @@ -45,10 +45,10 @@ namespace Volo.Abp.Cli.ProjectModification await AddAsync( projectFile, await FindNugetPackageInfoAsync(packageName) - ); +.ConfigureAwait(false)).ConfigureAwait(false); } - public async Task AddAsync(string projectFile, NugetPackageInfo package) + public Task AddAsync(string projectFile, NugetPackageInfo package) { using (DirectoryHelper.ChangeCurrentDirectory(Path.GetDirectoryName(projectFile))) { @@ -71,6 +71,8 @@ namespace Volo.Abp.Cli.ProjectModification Logger.LogInformation("Successfully installed."); } + + return Task.CompletedTask; } protected virtual async Task FindNugetPackageInfoAsync(string moduleName) @@ -79,7 +81,7 @@ namespace Volo.Abp.Cli.ProjectModification { var url = $"{CliUrls.WwwAbpIo}api/app/nugetPackage/byName/?name=" + moduleName; - var response = await client.GetAsync(url); + var response = await client.GetAsync(url).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { @@ -88,10 +90,10 @@ namespace Volo.Abp.Cli.ProjectModification throw new CliUsageException($"'{moduleName}' nuget package could not be found!"); } - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response).ConfigureAwait(false); } - var responseContent = await response.Content.ReadAsStringAsync(); + var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); return JsonSerializer.Deserialize(responseContent); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index 5950872419..5e20904812 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs @@ -57,7 +57,7 @@ namespace Volo.Abp.Cli.ProjectModification Check.NotNull(solutionFile, nameof(solutionFile)); Check.NotNull(moduleName, nameof(moduleName)); - var module = await FindModuleInfoAsync(moduleName); + var module = await FindModuleInfoAsync(moduleName).ConfigureAwait(false); Logger.LogInformation($"Installing module '{module.Name}' to the solution '{Path.GetFileNameWithoutExtension(solutionFile)}'"); @@ -72,7 +72,7 @@ namespace Volo.Abp.Cli.ProjectModification continue; } - await ProjectNugetPackageAdder.AddAsync(targetProjectFile, nugetPackage); + await ProjectNugetPackageAdder.AddAsync(targetProjectFile, nugetPackage).ConfigureAwait(false); } if (!module.NpmPackages.IsNullOrEmpty()) @@ -86,7 +86,7 @@ namespace Volo.Abp.Cli.ProjectModification { foreach (var npmPackage in module.NpmPackages.Where(p => p.ApplicationType.HasFlag(NpmApplicationType.Mvc))) { - await ProjectNpmPackageAdder.AddAsync(Path.GetDirectoryName(targetProject), npmPackage); + await ProjectNpmPackageAdder.AddAsync(Path.GetDirectoryName(targetProject), npmPackage).ConfigureAwait(false); } } } @@ -137,7 +137,7 @@ namespace Volo.Abp.Cli.ProjectModification { var url = $"{CliUrls.WwwAbpIo}api/app/module/byName/?name=" + moduleName; - var response = await client.GetAsync(url); + var response = await client.GetAsync(url).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { @@ -146,10 +146,10 @@ namespace Volo.Abp.Cli.ProjectModification throw new CliUsageException($"ERROR: '{moduleName}' module could not be found!"); } - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response).ConfigureAwait(false); } - var responseContent = await response.Content.ReadAsStringAsync(); + var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); return JsonSerializer.Deserialize(responseContent); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs index 9f6b80b792..4137c7b645 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs @@ -1,19 +1,24 @@ -using NuGet.Versioning; +using System; +using NuGet.Versioning; using System.IO; using System.Threading.Tasks; using System.Xml; using Volo.Abp.Cli.NuGet; using Volo.Abp.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; namespace Volo.Abp.Cli.ProjectModification { public class VoloNugetPackagesVersionUpdater : ITransientDependency { private readonly NuGetService _nuGetService; + public ILogger Logger { get; set; } public VoloNugetPackagesVersionUpdater(NuGetService nuGetService) { _nuGetService = nuGetService; + Logger = NullLogger.Instance; } public async Task UpdateSolutionAsync(string solutionPath, bool includePreviews) @@ -22,42 +27,76 @@ namespace Volo.Abp.Cli.ProjectModification foreach (var filePath in projectPaths) { - await UpdateInternalAsync(filePath, includePreviews); + await UpdateInternalAsync(filePath, includePreviews).ConfigureAwait(false); } } public async Task UpdateProjectAsync(string projectPath, bool includePreviews) { - await UpdateInternalAsync(projectPath, includePreviews); + await UpdateInternalAsync(projectPath, includePreviews).ConfigureAwait(false); } protected virtual async Task UpdateInternalAsync(string projectPath, bool includePreviews) { var fileContent = File.ReadAllText(projectPath); - File.WriteAllText(projectPath, await UpdateVoloPackagesAsync(fileContent, includePreviews)); + File.WriteAllText(projectPath, await UpdateVoloPackagesAsync(fileContent, includePreviews).ConfigureAwait(false)); } private async Task UpdateVoloPackagesAsync(string content, bool includePreviews) { - var doc = new XmlDocument() { PreserveWhitespace = true }; - doc.LoadXml(content); + string packageId = null; - foreach (XmlNode package in doc.SelectNodes("/Project/ItemGroup/PackageReference[starts-with(@Include, 'Volo.')]")) + try { - var versionAttribute = package.Attributes["Version"]; + var doc = new XmlDocument() + { + PreserveWhitespace = true + }; + + doc.LoadXml(content); - var packageId = package.Attributes["Include"].Value; - var packageVersion = SemanticVersion.Parse(versionAttribute.Value); - var latestVersion = await _nuGetService.GetLatestVersionOrNullAsync(packageId, includePreviews); + var packageNodeList = doc.SelectNodes("/Project/ItemGroup/PackageReference[starts-with(@Include, 'Volo.')]"); - if (latestVersion != null && packageVersion < latestVersion) + if (packageNodeList != null) { - versionAttribute.Value = latestVersion.ToString(); + foreach (XmlNode package in packageNodeList) + { + if (package.Attributes == null) + { + continue; + } + + var versionAttribute = package.Attributes["Version"]; + + packageId = package.Attributes["Include"].Value; + var packageVersion = SemanticVersion.Parse(versionAttribute.Value); + + Logger.LogDebug("Checking package: \"{0}\" - Current version: {1}", packageId, packageVersion); + + var latestVersion = await _nuGetService.GetLatestVersionOrNullAsync(packageId, includePreviews).ConfigureAwait(false); + + if (latestVersion != null && packageVersion < latestVersion) + { + Logger.LogInformation("Updating package \"{0}\" from v{1} to v{2}.", packageId, packageVersion.ToString(), latestVersion.ToString()); + versionAttribute.Value = latestVersion.ToString(); + } + else + { + Logger.LogDebug("Package: \"{0}-v{1}\" is up to date.", packageId, packageVersion); + } + } + + return await Task.FromResult(doc.OuterXml); } } + catch (Exception ex) + { + Logger.LogError("Cannot update volo packages! An error occured while updating the package \"{0}\". Error: {1}", packageId, ex.Message); + Logger.LogException(ex); + } - return doc.OuterXml; + return await Task.FromResult(content); } } } diff --git a/framework/src/Volo.Abp.Core/System/IO/AbpStreamExtensions.cs b/framework/src/Volo.Abp.Core/System/IO/AbpStreamExtensions.cs index e87ab67527..206de7be0d 100644 --- a/framework/src/Volo.Abp.Core/System/IO/AbpStreamExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/IO/AbpStreamExtensions.cs @@ -17,7 +17,7 @@ namespace System.IO { using (var memoryStream = new MemoryStream()) { - await stream.CopyToAsync(memoryStream); + await stream.CopyToAsync(memoryStream).ConfigureAwait(false); return memoryStream.ToArray(); } } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/ProxyHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/ProxyHelper.cs index 27c839b023..96a1915e26 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/ProxyHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/ProxyHelper.cs @@ -5,13 +5,14 @@ namespace Volo.Abp.DynamicProxy { public static class ProxyHelper { + private const string ProxyNamespace = "Castle.Proxies"; /// /// Returns dynamic proxy target object if this is a proxied object, otherwise returns the given object. /// It supports Castle Dynamic Proxies. /// public static object UnProxy(object obj) { - if (obj.GetType().Namespace != "Castle.Proxies") + if (obj.GetType().Namespace != ProxyNamespace) { return obj; } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs index 21ca7c2086..49a86c388a 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs @@ -54,7 +54,7 @@ namespace Volo.Abp.IO { using (var reader = File.OpenText(path)) { - return await reader.ReadToEndAsync(); + return await reader.ReadToEndAsync().ConfigureAwait(false); } } @@ -68,7 +68,7 @@ namespace Volo.Abp.IO using (var stream = File.Open(path, FileMode.Open)) { var result = new byte[stream.Length]; - await stream.ReadAsync(result, 0, (int)stream.Length); + await stream.ReadAsync(result, 0, (int)stream.Length).ConfigureAwait(false); return result; } } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Localization/AbpCultureHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs similarity index 96% rename from framework/src/Volo.Abp.Core/Volo/Abp/Localization/AbpCultureHelper.cs rename to framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs index ba75ab66ea..92320f737c 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Localization/AbpCultureHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs @@ -4,7 +4,7 @@ using JetBrains.Annotations; namespace Volo.Abp.Localization { - public static class AbpCultureHelper + public static class CultureHelper { public static IDisposable Use([NotNull] string culture, string uiCulture = null) { diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs index 7b440ebfe6..44bd73c074 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs @@ -21,14 +21,14 @@ namespace Volo.Abp.Threading return; } - using (await _semaphore.LockAsync()) + using (await _semaphore.LockAsync().ConfigureAwait(false)) { if (_runBefore) { return; } - await action(); + await action().ConfigureAwait(false); _runBefore = true; } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/InternalAsyncHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/InternalAsyncHelper.cs index 9972e59d3d..ce04a02479 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/InternalAsyncHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/InternalAsyncHelper.cs @@ -14,8 +14,8 @@ namespace Volo.Abp.Threading Exception exception = null; try - { - await actualReturnValue; + { + await actualReturnValue.ConfigureAwait(false); } catch (Exception ex) { @@ -33,9 +33,9 @@ namespace Volo.Abp.Threading Exception exception = null; try - { - await actualReturnValue; - await postAction(); + { + await actualReturnValue.ConfigureAwait(false); + await postAction().ConfigureAwait(false); } catch (Exception ex) { @@ -55,15 +55,15 @@ namespace Volo.Abp.Threading try { if (preAction != null) - { - await preAction(); - } - - await actualReturnValue(); + { + await preAction().ConfigureAwait(false); + } + + await actualReturnValue().ConfigureAwait(false); if (postAction != null) - { - await postAction(); + { + await postAction().ConfigureAwait(false); } } catch (Exception ex) @@ -86,7 +86,7 @@ namespace Volo.Abp.Threading try { - return await actualReturnValue; + return await actualReturnValue.ConfigureAwait(false); } catch (Exception ex) { @@ -114,8 +114,8 @@ namespace Volo.Abp.Threading try { - var result = await actualReturnValue; - await postAction(); + var result = await actualReturnValue.ConfigureAwait(false); + await postAction().ConfigureAwait(false); return result; } catch (Exception ex) @@ -145,15 +145,15 @@ namespace Volo.Abp.Threading try { if (preAction != null) - { - await preAction(); + { + await preAction().ConfigureAwait(false); } - var result = await actualReturnValue(); + var result = await actualReturnValue().ConfigureAwait(false); if (postAction != null) - { - await postAction(); + { + await postAction().ConfigureAwait(false); } return result; diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs index c20badbeb7..a6a073b67b 100644 --- a/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs @@ -31,7 +31,7 @@ namespace Volo.Abp.Data .ServiceProvider .GetRequiredService(contributorType); - await contributor.SeedAsync(context); + await contributor.SeedAsync(context).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/AbpDddApplicationContractsModule.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/AbpDddApplicationContractsModule.cs index 3166152e89..a8c0eb84b4 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/AbpDddApplicationContractsModule.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/AbpDddApplicationContractsModule.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Application Configure(options => { options.Resources - .Add("en") + .Add("en") .AddVirtualJson("/Volo/Abp/Application/Localization/Resources/AbpDdd"); }); } diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/LimitedResultRequestDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/LimitedResultRequestDto.cs index e9476a56bc..95c55174ad 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/LimitedResultRequestDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/LimitedResultRequestDto.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.Application.Dtos { if (MaxResultCount > MaxMaxResultCount) { - var localizer = validationContext.GetRequiredService>(); + var localizer = validationContext.GetRequiredService>(); yield return new ValidationResult( localizer[ diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/AbpDddApplicationContractsResource.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/AbpDddApplicationContractsResource.cs new file mode 100644 index 0000000000..ceef26f7c7 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/AbpDddApplicationContractsResource.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Localization; + +namespace Volo.Abp.Application.Localization.Resources.AbpDdd +{ + [LocalizationResourceName("AbpDddApplicationContracts")] + public class AbpDddApplicationContractsResource + { + + } +} diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/AbpDddResource.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/AbpDddResource.cs deleted file mode 100644 index 75880401d3..0000000000 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/AbpDddResource.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Volo.Abp.Localization; - -namespace Volo.Abp.Application.Localization.Resources.AbpDdd -{ - [LocalizationResourceName("AbpDdd")] - public class AbpDddResource - { - - } -} diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs index 0de23c826b..038ba0cf29 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs @@ -146,7 +146,7 @@ namespace Volo.Abp.Application.Services return; } - await AuthorizationService.CheckAsync(policyName); + await AuthorizationService.CheckAsync(policyName).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs index 4134b59a4c..e5febca25b 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs @@ -93,24 +93,24 @@ namespace Volo.Abp.Application.Services public virtual async Task GetAsync(TKey id) { - await CheckGetPolicyAsync(); + await CheckGetPolicyAsync().ConfigureAwait(false); - var entity = await GetEntityByIdAsync(id); + var entity = await GetEntityByIdAsync(id).ConfigureAwait(false); return MapToGetOutputDto(entity); } public virtual async Task> GetListAsync(TGetListInput input) { - await CheckGetListPolicyAsync(); + await CheckGetListPolicyAsync().ConfigureAwait(false); var query = CreateFilteredQuery(input); - var totalCount = await AsyncQueryableExecuter.CountAsync(query); + var totalCount = await AsyncQueryableExecuter.CountAsync(query).ConfigureAwait(false); query = ApplySorting(query, input); query = ApplyPaging(query, input); - var entities = await AsyncQueryableExecuter.ToListAsync(query); + var entities = await AsyncQueryableExecuter.ToListAsync(query).ConfigureAwait(false); return new PagedResultDto( totalCount, @@ -120,34 +120,34 @@ namespace Volo.Abp.Application.Services public virtual async Task CreateAsync(TCreateInput input) { - await CheckCreatePolicyAsync(); + await CheckCreatePolicyAsync().ConfigureAwait(false); var entity = MapToEntity(input); TryToSetTenantId(entity); - await Repository.InsertAsync(entity, autoSave: true); + await Repository.InsertAsync(entity, autoSave: true).ConfigureAwait(false); return MapToGetOutputDto(entity); } public virtual async Task UpdateAsync(TKey id, TUpdateInput input) { - await CheckUpdatePolicyAsync(); + await CheckUpdatePolicyAsync().ConfigureAwait(false); - var entity = await GetEntityByIdAsync(id); + var entity = await GetEntityByIdAsync(id).ConfigureAwait(false); //TODO: Check if input has id different than given id and normalize if it's default value, throw ex otherwise MapToEntity(input, entity); - await Repository.UpdateAsync(entity, autoSave: true); + await Repository.UpdateAsync(entity, autoSave: true).ConfigureAwait(false); return MapToGetOutputDto(entity); } public virtual async Task DeleteAsync(TKey id) { - await CheckDeletePolicyAsync(); + await CheckDeletePolicyAsync().ConfigureAwait(false); - await Repository.DeleteAsync(id); + await Repository.DeleteAsync(id).ConfigureAwait(false); } protected virtual Task GetEntityByIdAsync(TKey id) @@ -157,27 +157,27 @@ namespace Volo.Abp.Application.Services protected virtual async Task CheckGetPolicyAsync() { - await CheckPolicyAsync(GetPolicyName); + await CheckPolicyAsync(GetPolicyName).ConfigureAwait(false); } protected virtual async Task CheckGetListPolicyAsync() { - await CheckPolicyAsync(GetListPolicyName); + await CheckPolicyAsync(GetListPolicyName).ConfigureAwait(false); } protected virtual async Task CheckCreatePolicyAsync() { - await CheckPolicyAsync(CreatePolicyName); + await CheckPolicyAsync(CreatePolicyName).ConfigureAwait(false); } protected virtual async Task CheckUpdatePolicyAsync() { - await CheckPolicyAsync(UpdatePolicyName); + await CheckPolicyAsync(UpdatePolicyName).ConfigureAwait(false); } protected virtual async Task CheckDeletePolicyAsync() { - await CheckPolicyAsync(DeletePolicyName); + await CheckPolicyAsync(DeletePolicyName).ConfigureAwait(false); } /// diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs index c9219feffc..47e3571ffd 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs @@ -36,14 +36,14 @@ namespace Volo.Abp.Domain.Entities.Events public async Task TriggerEventsAsync(EntityChangeReport changeReport) { - await TriggerEventsInternalAsync(changeReport); + await TriggerEventsInternalAsync(changeReport).ConfigureAwait(false); if (changeReport.IsEmpty() || UnitOfWorkManager.Current == null) { return; } - await UnitOfWorkManager.Current.SaveChangesAsync(); + await UnitOfWorkManager.Current.SaveChangesAsync().ConfigureAwait(false); } public virtual async Task TriggerEntityCreatingEventAsync(object entity) @@ -53,7 +53,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityCreatingEventData<>), entity, true - ); + ).ConfigureAwait(false); } public virtual async Task TriggerEntityCreatedEventOnUowCompletedAsync(object entity) @@ -63,7 +63,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityCreatedEventData<>), entity, false - ); + ).ConfigureAwait(false); var eto = EntityToEtoMapper.Map(entity); if (eto != null) @@ -73,7 +73,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityCreatedEto<>), eto, false - ); + ).ConfigureAwait(false); } } @@ -84,7 +84,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityUpdatingEventData<>), entity, true - ); + ).ConfigureAwait(false); } public virtual async Task TriggerEntityUpdatedEventOnUowCompletedAsync(object entity) @@ -94,7 +94,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityUpdatedEventData<>), entity, false - ); + ).ConfigureAwait(false); var eto = EntityToEtoMapper.Map(entity); if (eto != null) @@ -104,7 +104,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityUpdatedEto<>), eto, false - ); + ).ConfigureAwait(false); } } @@ -115,7 +115,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityDeletingEventData<>), entity, true - ); + ).ConfigureAwait(false); } public virtual async Task TriggerEntityDeletedEventOnUowCompletedAsync(object entity) @@ -125,7 +125,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityDeletedEventData<>), entity, false - ); + ).ConfigureAwait(false); var eto = EntityToEtoMapper.Map(entity); if (eto != null) @@ -135,15 +135,15 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityDeletedEto<>), EntityToEtoMapper.Map(entity), false - ); + ).ConfigureAwait(false); } } protected virtual async Task TriggerEventsInternalAsync(EntityChangeReport changeReport) { - await TriggerEntityChangeEvents(changeReport.ChangedEntities); - await TriggerLocalEvents(changeReport.DomainEvents); - await TriggerDistributedEvents(changeReport.DistributedEvents); + await TriggerEntityChangeEvents(changeReport.ChangedEntities).ConfigureAwait(false); + await TriggerLocalEvents(changeReport.DomainEvents).ConfigureAwait(false); + await TriggerDistributedEvents(changeReport.DistributedEvents).ConfigureAwait(false); } protected virtual async Task TriggerEntityChangeEvents(List changedEntities) @@ -153,16 +153,16 @@ namespace Volo.Abp.Domain.Entities.Events switch (changedEntity.ChangeType) { case EntityChangeType.Created: - await TriggerEntityCreatingEventAsync(changedEntity.Entity); - await TriggerEntityCreatedEventOnUowCompletedAsync(changedEntity.Entity); + await TriggerEntityCreatingEventAsync(changedEntity.Entity).ConfigureAwait(false); + await TriggerEntityCreatedEventOnUowCompletedAsync(changedEntity.Entity).ConfigureAwait(false); break; case EntityChangeType.Updated: - await TriggerEntityUpdatingEventAsync(changedEntity.Entity); - await TriggerEntityUpdatedEventOnUowCompletedAsync(changedEntity.Entity); + await TriggerEntityUpdatingEventAsync(changedEntity.Entity).ConfigureAwait(false); + await TriggerEntityUpdatedEventOnUowCompletedAsync(changedEntity.Entity).ConfigureAwait(false); break; case EntityChangeType.Deleted: - await TriggerEntityDeletingEventAsync(changedEntity.Entity); - await TriggerEntityDeletedEventOnUowCompletedAsync(changedEntity.Entity); + await TriggerEntityDeletingEventAsync(changedEntity.Entity).ConfigureAwait(false); + await TriggerEntityDeletedEventOnUowCompletedAsync(changedEntity.Entity).ConfigureAwait(false); break; default: throw new AbpException("Unknown EntityChangeType: " + changedEntity.ChangeType); @@ -174,7 +174,7 @@ namespace Volo.Abp.Domain.Entities.Events { foreach (var localEvent in localEvents) { - await LocalEventBus.PublishAsync(localEvent.EventData.GetType(), localEvent.EventData); + await LocalEventBus.PublishAsync(localEvent.EventData.GetType(), localEvent.EventData).ConfigureAwait(false); } } @@ -182,7 +182,7 @@ namespace Volo.Abp.Domain.Entities.Events { foreach (var distributedEvent in distributedEvents) { - await DistributedEventBus.PublishAsync(distributedEvent.EventData.GetType(), distributedEvent.EventData); + await DistributedEventBus.PublishAsync(distributedEvent.EventData.GetType(), distributedEvent.EventData).ConfigureAwait(false); } } @@ -193,7 +193,7 @@ namespace Volo.Abp.Domain.Entities.Events if (triggerInCurrentUnitOfWork || UnitOfWorkManager.Current == null) { - await eventPublisher.PublishAsync(eventType, Activator.CreateInstance(eventType, entity)); + await eventPublisher.PublishAsync(eventType, Activator.CreateInstance(eventType, entity)).ConfigureAwait(false); return; } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs index d13d52ed97..ae438fdd01 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.Domain.Repositories { public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, cancellationToken); + var entity = await FindAsync(id, includeDetails, cancellationToken).ConfigureAwait(false); if (entity == null) { @@ -60,13 +60,13 @@ namespace Volo.Abp.Domain.Repositories public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, cancellationToken: cancellationToken); + var entity = await FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); if (entity == null) { return; } - await DeleteAsync(entity, autoSave, cancellationToken); + await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs index 29814f4de6..358d36733e 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs @@ -75,13 +75,13 @@ namespace Volo.Abp.Domain.Repositories public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, cancellationToken: cancellationToken); + var entity = await FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); if (entity == null) { return; } - await DeleteAsync(entity, autoSave, cancellationToken); + await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs index 40ebca015e..915b97a7d4 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Domain.Repositories var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading; if (repo != null) { - await repo.EnsureCollectionLoadedAsync(entity, propertyExpression, cancellationToken); + await repo.EnsureCollectionLoadedAsync(entity, propertyExpression, cancellationToken).ConfigureAwait(false); } } @@ -38,7 +38,7 @@ namespace Volo.Abp.Domain.Repositories var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading; if (repo != null) { - await repo.EnsurePropertyLoadedAsync(entity, propertyExpression, cancellationToken); + await repo.EnsurePropertyLoadedAsync(entity, propertyExpression, cancellationToken).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs index f6588de9fb..aa38f874d6 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs @@ -32,29 +32,29 @@ namespace Volo.Abp.Emailing Subject = subject, Body = body, IsBodyHtml = isBodyHtml - }); + }).ConfigureAwait(false); } public virtual async Task SendAsync(string from, string to, string subject, string body, bool isBodyHtml = true) { - await SendAsync(new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml }); + await SendAsync(new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml }).ConfigureAwait(false); } public virtual async Task SendAsync(MailMessage mail, bool normalize = true) { if (normalize) { - await NormalizeMailAsync(mail); + await NormalizeMailAsync(mail).ConfigureAwait(false); } - await SendEmailAsync(mail); + await SendEmailAsync(mail).ConfigureAwait(false); } public virtual async Task QueueAsync(string to, string subject, string body, bool isBodyHtml = true) { if (!BackgroundJobManager.IsAvailable()) { - await SendAsync(to, subject, body, isBodyHtml); + await SendAsync(to, subject, body, isBodyHtml).ConfigureAwait(false); return; } @@ -66,7 +66,7 @@ namespace Volo.Abp.Emailing Body = body, IsBodyHtml = isBodyHtml } - ); + ).ConfigureAwait(false); } /// @@ -86,8 +86,8 @@ namespace Volo.Abp.Emailing if (mail.From == null || mail.From.Address.IsNullOrEmpty()) { mail.From = new MailAddress( - await Configuration.GetDefaultFromAddressAsync(), - await Configuration.GetDefaultFromDisplayNameAsync(), + await Configuration.GetDefaultFromAddressAsync().ConfigureAwait(false), + await Configuration.GetDefaultFromDisplayNameAsync().ConfigureAwait(false), Encoding.UTF8 ); } diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs index e02b78badd..dafd5b8a4f 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs @@ -37,7 +37,7 @@ namespace Volo.Abp.Emailing /// Value of the setting protected async Task GetNotEmptySettingValueAsync(string name) { - var value = await SettingProvider.GetOrNullAsync(name); + var value = await SettingProvider.GetOrNullAsync(name).ConfigureAwait(false); if (value.IsNullOrEmpty()) { diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs index f97fd57b18..84af1bf348 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs @@ -28,19 +28,19 @@ namespace Volo.Abp.Emailing.Smtp public async Task BuildClientAsync() { - var host = await SmtpConfiguration.GetHostAsync(); - var port = await SmtpConfiguration.GetPortAsync(); + var host = await SmtpConfiguration.GetHostAsync().ConfigureAwait(false); + var port = await SmtpConfiguration.GetPortAsync().ConfigureAwait(false); var smtpClient = new SmtpClient(host, port); try { - if (await SmtpConfiguration.GetEnableSslAsync()) + if (await SmtpConfiguration.GetEnableSslAsync().ConfigureAwait(false)) { smtpClient.EnableSsl = true; } - if (await SmtpConfiguration.GetUseDefaultCredentialsAsync()) + if (await SmtpConfiguration.GetUseDefaultCredentialsAsync().ConfigureAwait(false)) { smtpClient.UseDefaultCredentials = true; } @@ -48,11 +48,11 @@ namespace Volo.Abp.Emailing.Smtp { smtpClient.UseDefaultCredentials = false; - var userName = await SmtpConfiguration.GetUserNameAsync(); + var userName = await SmtpConfiguration.GetUserNameAsync().ConfigureAwait(false); if (!userName.IsNullOrEmpty()) { - var password = await SmtpConfiguration.GetPasswordAsync(); - var domain = await SmtpConfiguration.GetDomainAsync(); + var password = await SmtpConfiguration.GetPasswordAsync().ConfigureAwait(false); + var domain = await SmtpConfiguration.GetDomainAsync().ConfigureAwait(false); smtpClient.Credentials = !domain.IsNullOrEmpty() ? new NetworkCredential(userName, password, domain) : new NetworkCredential(userName, password); @@ -70,9 +70,9 @@ namespace Volo.Abp.Emailing.Smtp protected override async Task SendEmailAsync(MailMessage mail) { - using (var smtpClient = await BuildClientAsync()) + using (var smtpClient = await BuildClientAsync().ConfigureAwait(false)) { - await smtpClient.SendMailAsync(mail); + await smtpClient.SendMailAsync(mail).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/EmailTemplateProvider.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/EmailTemplateProvider.cs index c67af27757..61db6dec2e 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/EmailTemplateProvider.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/EmailTemplateProvider.cs @@ -27,12 +27,12 @@ namespace Volo.Abp.Emailing.Templates public async Task GetAsync(string name) { - return await GetAsync(name, CultureInfo.CurrentUICulture.Name); + return await GetAsync(name, CultureInfo.CurrentUICulture.Name).ConfigureAwait(false); } public async Task GetAsync(string name, string cultureName) { - return await GetInternalAsync(name, cultureName); + return await GetInternalAsync(name, cultureName).ConfigureAwait(false); } protected virtual async Task GetInternalAsync(string name, string cultureName) @@ -59,11 +59,11 @@ namespace Volo.Abp.Emailing.Templates { var emailTemplate = new EmailTemplate(emailTemplateString, emailTemplateDefinition); - await SetLayoutAsync(emailTemplateDefinition, emailTemplate, cultureName); + await SetLayoutAsync(emailTemplateDefinition, emailTemplate, cultureName).ConfigureAwait(false); if (emailTemplateDefinition.SingleTemplateFile) { - await LocalizeAsync(emailTemplateDefinition, emailTemplate, cultureName); + await LocalizeAsync(emailTemplateDefinition, emailTemplate, cultureName).ConfigureAwait(false); } return emailTemplate; @@ -87,7 +87,7 @@ namespace Volo.Abp.Emailing.Templates layout = Options.DefaultLayout; } - var layoutTemplate = await GetInternalAsync(layout, cultureName); + var layoutTemplate = await GetInternalAsync(layout, cultureName).ConfigureAwait(false); emailTemplate.SetLayout(layoutTemplate); } @@ -103,10 +103,10 @@ namespace Volo.Abp.Emailing.Templates var localizer = StringLocalizerFactory.Create(emailTemplateDefinition.LocalizationResource); if (cultureName != null) { - emailTemplate.SetContent( - TemplateLocalizer.Localize(localizer.WithCulture(new CultureInfo(cultureName)), - emailTemplate.Content) - ); + using (CultureHelper.Use(new CultureInfo(cultureName))) + { + emailTemplate.SetContent(TemplateLocalizer.Localize(localizer, emailTemplate.Content)); + } } else { diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/TemplateRender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/TemplateRender.cs index 8c4e24017c..1713cf9f3f 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/TemplateRender.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/TemplateRender.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Emailing.Templates public async Task RenderAsync(string template, object model = null) { var scribanTemplate = Template.Parse(template); - return await scribanTemplate.RenderAsync(model); + return await scribanTemplate.RenderAsync(model).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index 4131a774b5..7890b9b50d 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } return savedEntity; @@ -60,7 +60,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } return updatedEntity; @@ -72,7 +72,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } } @@ -80,12 +80,12 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore { return includeDetails ? await WithDetails().ToListAsync(GetCancellationToken(cancellationToken)) - : await DbSet.ToListAsync(GetCancellationToken(cancellationToken)); +.ConfigureAwait(false) : await DbSet.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public override async Task GetCountAsync(CancellationToken cancellationToken = default) { - return await DbSet.LongCountAsync(GetCancellationToken(cancellationToken)); + return await DbSet.LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } protected override IQueryable GetQueryable() @@ -97,7 +97,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore { var entities = await GetQueryable() .Where(predicate) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); foreach (var entity in entities) { @@ -106,7 +106,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } } @@ -119,7 +119,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore await DbContext .Entry(entity) .Collection(propertyExpression) - .LoadAsync(GetCancellationToken(cancellationToken)); + .LoadAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task EnsurePropertyLoadedAsync( @@ -131,7 +131,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore await DbContext .Entry(entity) .Reference(propertyExpression) - .LoadAsync(GetCancellationToken(cancellationToken)); + .LoadAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public override IQueryable WithDetails() @@ -187,7 +187,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, GetCancellationToken(cancellationToken)); + var entity = await FindAsync(id, includeDetails, GetCancellationToken(cancellationToken)).ConfigureAwait(false); if (entity == null) { @@ -208,18 +208,18 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore { return includeDetails ? await WithDetails().FirstOrDefaultAsync(e => e.Id.Equals(id), GetCancellationToken(cancellationToken)) - : await DbSet.FindAsync(new object[] { id }, GetCancellationToken(cancellationToken)); +.ConfigureAwait(false) : await DbSet.FindAsync(new object[] { id }, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, cancellationToken: cancellationToken); + var entity = await FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); if (entity == null) { return; } - await DeleteAsync(entity, autoSave, cancellationToken); + await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs index 87de3f1247..dea620f1e9 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs @@ -117,9 +117,9 @@ namespace Volo.Abp.EntityFrameworkCore var changeReport = ApplyAbpConcepts(); - var result = await base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken); + var result = await base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken).ConfigureAwait(false); - await EntityChangeEventHelper.TriggerEventsAsync(changeReport); + await EntityChangeEventHelper.TriggerEventsAsync(changeReport).ConfigureAwait(false); if (auditLog != null) { diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs index c530437e6f..9df352837a 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs @@ -85,7 +85,7 @@ namespace Volo.Abp.EventBus.RabbitMq var eventData = Serializer.Deserialize(ea.Body, eventType); - await TriggerHandlersAsync(eventType, eventData); + await TriggerHandlersAsync(eventType, eventData).ConfigureAwait(false); } public IDisposable Subscribe(IDistributedEventHandler handler) where TEvent : class diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/ActionEventHandler.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/ActionEventHandler.cs index a8763edd89..3594ce3c96 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/ActionEventHandler.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/ActionEventHandler.cs @@ -32,7 +32,7 @@ namespace Volo.Abp.EventBus /// public async Task HandleEventAsync(TEvent eventData) { - await Action(eventData); + await Action(eventData).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventBusBase.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventBusBase.cs index cb8ae75336..b77ed00945 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventBusBase.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventBusBase.cs @@ -89,7 +89,7 @@ namespace Volo.Abp.EventBus { var exceptions = new List(); - await TriggerHandlersAsync(eventType, eventData, exceptions); + await TriggerHandlersAsync(eventType, eventData, exceptions).ConfigureAwait(false); if (exceptions.Any()) { @@ -110,7 +110,7 @@ namespace Volo.Abp.EventBus { foreach (var handlerFactory in handlerFactories.EventHandlerFactories) { - await TriggerHandlerAsync(handlerFactory, handlerFactories.EventType, eventData, exceptions); + await TriggerHandlerAsync(handlerFactory, handlerFactories.EventType, eventData, exceptions).ConfigureAwait(false); } } @@ -126,7 +126,7 @@ namespace Volo.Abp.EventBus var baseEventType = eventType.GetGenericTypeDefinition().MakeGenericType(baseArg); var constructorArgs = ((IEventDataWithInheritableGenericArgument)eventData).GetConstructorArgs(); var baseEventData = Activator.CreateInstance(baseEventType, constructorArgs); - await PublishAsync(baseEventType, baseEventData); + await PublishAsync(baseEventType, baseEventData).ConfigureAwait(false); } } } @@ -171,7 +171,7 @@ namespace Volo.Abp.EventBus new[] { eventType } ); - await (Task)method.Invoke(eventHandlerWrapper.EventHandler, new[] { eventData }); + await ((Task)method.Invoke(eventHandlerWrapper.EventHandler, new[] { eventData })).ConfigureAwait(false); } else if (ReflectionHelper.IsAssignableToGenericType(handlerType, typeof(IDistributedEventHandler<>))) { @@ -182,7 +182,7 @@ namespace Volo.Abp.EventBus new[] { eventType } ); - await (Task)method.Invoke(eventHandlerWrapper.EventHandler, new[] { eventData }); + await ((Task)method.Invoke(eventHandlerWrapper.EventHandler, new[] { eventData })).ConfigureAwait(false); } else { diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs index 7db5c18f01..117eeeb06f 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs @@ -119,7 +119,7 @@ namespace Volo.Abp.EventBus.Local { var exceptions = new List(); - await TriggerHandlersAsync(eventType, eventData, exceptions); + await TriggerHandlersAsync(eventType, eventData, exceptions).ConfigureAwait(false); if (exceptions.Any()) { diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs index 49ea1b3f4c..75c9c7ae5f 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.Features return null; } - return await FeatureStore.GetOrNullAsync(feature.Name, Name, editionId.Value.ToString()); + return await FeatureStore.GetOrNullAsync(feature.Name, Name, editionId.Value.ToString()).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs index 0c653c3448..0c90ea7573 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.Features providers = providers.Where(p => featureDefinition.AllowedProviders.Contains(p.Name)); } - return await GetOrNullValueFromProvidersAsync(providers, featureDefinition); + return await GetOrNullValueFromProvidersAsync(providers, featureDefinition).ConfigureAwait(false); } protected virtual async Task GetOrNullValueFromProvidersAsync( @@ -55,7 +55,7 @@ namespace Volo.Abp.Features { foreach (var provider in providers) { - var value = await provider.GetOrNullAsync(feature); + var value = await provider.GetOrNullAsync(feature).ConfigureAwait(false); if (value != null) { return value; diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs index a24e0901f7..23c5c37431 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.Features public virtual async Task IsEnabledAsync(string name) { - var value = await GetOrNullAsync(name); + var value = await GetOrNullAsync(name).ConfigureAwait(false); if (value == null) { return false; diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs index 8850408df0..d26f7be841 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Features Check.NotNull(featureChecker, nameof(featureChecker)); Check.NotNull(name, nameof(name)); - var value = await featureChecker.GetOrNullAsync(name); + var value = await featureChecker.GetOrNullAsync(name).ConfigureAwait(false); return value?.To() ?? defaultValue; } @@ -32,7 +32,7 @@ namespace Volo.Abp.Features { foreach (var featureName in featureNames) { - if (!(await featureChecker.IsEnabledAsync(featureName))) + if (!(await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false))) { return false; } @@ -43,7 +43,7 @@ namespace Volo.Abp.Features foreach (var featureName in featureNames) { - if (await featureChecker.IsEnabledAsync(featureName)) + if (await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false)) { return true; } @@ -54,7 +54,7 @@ namespace Volo.Abp.Features public static async Task CheckEnabledAsync(this IFeatureChecker featureChecker, string featureName) { - if (!(await featureChecker.IsEnabledAsync(featureName))) + if (!(await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false))) { throw new AbpAuthorizationException("Feature is not enabled: " + featureName); } @@ -71,7 +71,7 @@ namespace Volo.Abp.Features { foreach (var featureName in featureNames) { - if (!(await featureChecker.IsEnabledAsync(featureName))) + if (!(await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false))) { throw new AbpAuthorizationException( "Required features are not enabled. All of these features must be enabled: " + @@ -84,7 +84,7 @@ namespace Volo.Abp.Features { foreach (var featureName in featureNames) { - if (await featureChecker.IsEnabledAsync(featureName)) + if (await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false)) { return; } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs index 9986af6275..9f3d5dc356 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs @@ -19,12 +19,12 @@ namespace Volo.Abp.Features { if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.FeatureChecking)) { - await invocation.ProceedAsync(); + await invocation.ProceedAsync().ConfigureAwait(false); return; } - await CheckFeaturesAsync(invocation); - await invocation.ProceedAsync(); + await CheckFeaturesAsync(invocation).ConfigureAwait(false); + await invocation.ProceedAsync().ConfigureAwait(false); } protected virtual async Task CheckFeaturesAsync(IAbpMethodInvocation invocation) @@ -33,7 +33,7 @@ namespace Volo.Abp.Features new MethodInvocationFeatureCheckerContext( invocation.Method ) - ); + ).ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs index da7becc61f..bff6405d57 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Features foreach (var requiresFeatureAttribute in GetRequiredFeatureAttributes(context.Method)) { - await _featureChecker.CheckEnabledAsync(requiresFeatureAttribute.RequiresAll, requiresFeatureAttribute.Features); + await _featureChecker.CheckEnabledAsync(requiresFeatureAttribute.RequiresAll, requiresFeatureAttribute.Features).ConfigureAwait(false); } } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs index 5ae4b5f876..71cdfe3f59 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Features public override async Task GetOrNullAsync(FeatureDefinition feature) { - return await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString()); + return await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString()).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs index 25763efbd5..efc61907dc 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Http.Client.IdentityModel { if (context.RemoteService.GetUseCurrentAccessToken() != false) { - var accessToken = await GetAccessTokenFromHttpContextOrNullAsync(); + var accessToken = await GetAccessTokenFromHttpContextOrNullAsync().ConfigureAwait(false); if (accessToken != null) { context.Request.SetBearerToken(accessToken); @@ -36,7 +36,7 @@ namespace Volo.Abp.Http.Client.IdentityModel await IdentityModelAuthenticationService.TryAuthenticateAsync( context.Client, context.RemoteService.GetIdentityClient() - ); + ).ConfigureAwait(false); } protected virtual async Task GetAccessTokenFromHttpContextOrNullAsync() @@ -47,7 +47,7 @@ namespace Volo.Abp.Http.Client.IdentityModel return null; } - return await httpContext.GetTokenAsync("access_token"); + return await httpContext.GetTokenAsync("access_token").ConfigureAwait(false); } } } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs index 9d1ea2dbbe..b9932124be 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs @@ -27,12 +27,12 @@ namespace Volo.Abp.Http.Client.DynamicProxying string baseUrl, Func> factory) { - using (await _semaphore.LockAsync(CancellationTokenProvider.Token)) + using (await _semaphore.LockAsync(CancellationTokenProvider.Token).ConfigureAwait(false)) { var model = _cache.GetOrDefault(baseUrl); if (model == null) { - _cache[baseUrl] = model = await factory(); + _cache[baseUrl] = model = await factory().ConfigureAwait(false); } return model; diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs index 9b9c8e804c..eb57641c28 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying public async Task FindActionAsync(string baseUrl, Type serviceType, MethodInfo method) { - var apiDescription = await GetApiDescriptionAsync(baseUrl); + var apiDescription = await GetApiDescriptionAsync(baseUrl).ConfigureAwait(false); //TODO: Cache finding? @@ -78,7 +78,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying public virtual async Task GetApiDescriptionAsync(string baseUrl) { - return await Cache.GetAsync(baseUrl, () => GetApiDescriptionFromServerAsync(baseUrl)); + return await Cache.GetAsync(baseUrl, () => GetApiDescriptionFromServerAsync(baseUrl)).ConfigureAwait(false); } protected virtual async Task GetApiDescriptionFromServerAsync(string baseUrl) @@ -88,14 +88,14 @@ namespace Volo.Abp.Http.Client.DynamicProxying var response = await client.GetAsync( baseUrl.EnsureEndsWith('/') + "api/abp/api-definition", CancellationTokenProvider.Token - ); + ).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { throw new AbpException("Remote service returns error! StatusCode = " + response.StatusCode); } - var content = await response.Content.ReadAsStringAsync(); + var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false); var result = JsonConvert.DeserializeObject( content, diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs index 3e0124237f..d60b79b3a5 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs @@ -78,7 +78,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying { if (invocation.Method.ReturnType.GenericTypeArguments.IsNullOrEmpty()) { - await MakeRequestAsync(invocation); + await MakeRequestAsync(invocation).ConfigureAwait(false); } else { @@ -89,14 +89,14 @@ namespace Volo.Abp.Http.Client.DynamicProxying invocation.ReturnValue = await GetResultAsync( result, invocation.Method.ReturnType.GetGenericArguments()[0] - ); + ).ConfigureAwait(false); } } private async Task GetResultAsync(Task task, Type resultType) { - await task; + await task.ConfigureAwait(false); return typeof(Task<>) .MakeGenericType(resultType) .GetProperty(nameof(Task.Result), BindingFlags.Instance | BindingFlags.Public) @@ -105,7 +105,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying private async Task MakeRequestAndGetResultAsync(IAbpMethodInvocation invocation) { - var responseAsString = await MakeRequestAsync(invocation); + var responseAsString = await MakeRequestAsync(invocation).ConfigureAwait(false); //TODO: Think on that if (TypeHelper.IsPrimitiveExtended(typeof(T), true)) @@ -123,7 +123,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying var client = HttpClientFactory.Create(clientConfig.RemoteServiceName); - var action = await ApiDescriptionFinder.FindActionAsync(remoteServiceConfig.BaseUrl, typeof(TService), invocation.Method); + var action = await ApiDescriptionFinder.FindActionAsync(remoteServiceConfig.BaseUrl, typeof(TService), invocation.Method).ConfigureAwait(false); var apiVersion = GetApiVersionInfo(action); var url = remoteServiceConfig.BaseUrl.EnsureEndsWith('/') + UrlBuilder.GenerateUrlWithParameters(action, invocation.ArgumentsDictionary, apiVersion); @@ -141,16 +141,16 @@ namespace Volo.Abp.Http.Client.DynamicProxying remoteServiceConfig, clientConfig.RemoteServiceName ) - ); + ).ConfigureAwait(false); - var response = await client.SendAsync(requestMessage, GetCancellationToken()); + var response = await client.SendAsync(requestMessage, GetCancellationToken()).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { - await ThrowExceptionForResponseAsync(response); + await ThrowExceptionForResponseAsync(response).ConfigureAwait(false); } - return await response.Content.ReadAsStringAsync(); + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); } private ApiVersionInfo GetApiVersionInfo(ActionApiDescriptionModel action) @@ -240,7 +240,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying { var errorResponse = JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ); +.ConfigureAwait(false)); throw new AbpRemoteCallException(errorResponse.Error); } diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs index ca6e41d60d..488745836e 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.IdentityModel [NotNull] HttpClient client, string identityClientName = null) { - var accessToken = await GetAccessTokenOrNullAsync(identityClientName); + var accessToken = await GetAccessTokenOrNullAsync(identityClientName).ConfigureAwait(false); if (accessToken == null) { return false; @@ -55,18 +55,18 @@ namespace Volo.Abp.IdentityModel return null; } - return await GetAccessTokenAsync(configuration); + return await GetAccessTokenAsync(configuration).ConfigureAwait(false); } public virtual async Task GetAccessTokenAsync(IdentityClientConfiguration configuration) { - var discoveryResponse = await GetDiscoveryResponse(configuration); + var discoveryResponse = await GetDiscoveryResponse(configuration).ConfigureAwait(false); if (discoveryResponse.IsError) { throw new AbpException($"Could not retrieve the OpenId Connect discovery document! ErrorType: {discoveryResponse.ErrorType}. Error: {discoveryResponse.Error}"); } - var tokenResponse = await GetTokenResponse(discoveryResponse, configuration); + var tokenResponse = await GetTokenResponse(discoveryResponse, configuration).ConfigureAwait(false); if (tokenResponse.IsError) { throw new AbpException($"Could not get token from the OpenId Connect server! ErrorType: {tokenResponse.ErrorType}. Error: {tokenResponse.Error}. ErrorDescription: {tokenResponse.ErrorDescription}. HttpStatusCode: {tokenResponse.HttpStatusCode}"); @@ -104,7 +104,7 @@ namespace Volo.Abp.IdentityModel { RequireHttps = configuration.RequireHttps } - }); + }).ConfigureAwait(false); } } @@ -118,14 +118,14 @@ namespace Volo.Abp.IdentityModel { case OidcConstants.GrantTypes.ClientCredentials: return await httpClient.RequestClientCredentialsTokenAsync( - await CreateClientCredentialsTokenRequestAsync(discoveryResponse, configuration), + await CreateClientCredentialsTokenRequestAsync(discoveryResponse, configuration).ConfigureAwait(false), CancellationTokenProvider.Token - ); + ).ConfigureAwait(false); case OidcConstants.GrantTypes.Password: return await httpClient.RequestPasswordTokenAsync( - await CreatePasswordTokenRequestAsync(discoveryResponse, configuration), + await CreatePasswordTokenRequestAsync(discoveryResponse, configuration).ConfigureAwait(false), CancellationTokenProvider.Token - ); + ).ConfigureAwait(false); default: throw new AbpException("Grant type was not implemented: " + configuration.GrantType); } diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpDictionaryBasedStringLocalizer.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpDictionaryBasedStringLocalizer.cs index d6b7073ee5..79c164eb5f 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpDictionaryBasedStringLocalizer.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpDictionaryBasedStringLocalizer.cs @@ -41,6 +41,7 @@ namespace Volo.Abp.Localization ); } + [Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")] public IStringLocalizer WithCulture(CultureInfo culture) { return new CultureWrapperStringLocalizer(culture.Name, this); @@ -70,10 +71,13 @@ namespace Volo.Abp.Localization { foreach (var baseLocalizer in BaseLocalizers) { - var baseLocalizedString = baseLocalizer.WithCulture(CultureInfo.GetCultureInfo(cultureName))[name]; - if (baseLocalizedString != null && !baseLocalizedString.ResourceNotFound) + using (CultureHelper.Use(CultureInfo.GetCultureInfo(cultureName))) { - return baseLocalizedString; + var baseLocalizedString = baseLocalizer[name]; + if (baseLocalizedString != null && !baseLocalizedString.ResourceNotFound) + { + return baseLocalizedString; + } } } @@ -132,20 +136,23 @@ namespace Volo.Abp.Localization if (includeBaseLocalizers) { - foreach (var baseLocalizer in BaseLocalizers.Select(l => l.WithCulture(CultureInfo.GetCultureInfo(cultureName)))) + foreach (var baseLocalizer in BaseLocalizers.Select(l => l)) { - //TODO: Try/catch is a workaround here! - try + using (CultureHelper.Use(CultureInfo.GetCultureInfo(cultureName))) { - var baseLocalizedString = baseLocalizer.GetAllStrings(includeParentCultures); - foreach (var localizedString in baseLocalizedString) + //TODO: Try/catch is a workaround here! + try { - allStrings[localizedString.Name] = localizedString; + var baseLocalizedString = baseLocalizer.GetAllStrings(includeParentCultures); + foreach (var localizedString in baseLocalizedString) + { + allStrings[localizedString.Name] = localizedString; + } } - } - catch (MissingManifestResourceException) - { + catch (MissingManifestResourceException) + { + } } } } @@ -198,6 +205,7 @@ namespace Volo.Abp.Localization return _innerLocalizer.GetAllStrings(_cultureName, includeParentCultures); } + [Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")] public IStringLocalizer WithCulture(CultureInfo culture) { return new CultureWrapperStringLocalizer(culture.Name, _innerLocalizer); diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs index 175e3f9d12..be39960b4f 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs @@ -1,5 +1,4 @@ using Volo.Abp.Localization.Resources.AbpLocalization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.Settings; using Volo.Abp.VirtualFileSystem; @@ -28,12 +27,6 @@ namespace Volo.Abp.Localization .Resources .Add("en"); - //TODO: Obsolete, Remove in the future version - options - .Resources - .Add("en") - .AddVirtualJson("/Volo/Abp/Validation/Localization");//load from Volo.Abp.Validation - options .Resources .Add("en") diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs index 14afe69dac..127d2550dd 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs @@ -1,4 +1,4 @@ -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Localization.Resources.AbpLocalization; using Volo.Abp.Settings; namespace Volo.Abp.Localization @@ -18,7 +18,7 @@ namespace Volo.Abp.Localization private static LocalizableString L(string name) { - return LocalizableString.Create(name); + return LocalizableString.Create(name); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs index abfd1688b7..7e3b5400c9 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs @@ -1,6 +1,4 @@ -using System; - -namespace Volo.Abp.Localization.Resources.AbpLocalization +namespace Volo.Abp.Localization.Resources.AbpLocalization { [LocalizationResourceName("AbpLocalization")] public class AbpLocalizationResource diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs deleted file mode 100644 index 5d0151fe66..0000000000 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Volo.Abp.Localization.Resources.AbpValidation -{ - //TODO: Move to Volo.Abp.Validation! - - [LocalizationResourceName("AbpValidation")] - [Obsolete("This resource is obsolete.Use Volo.Abp.Validation.Localization.AbpValidationResource instead.", false)] - public class AbpValidationResource - { - - } -} diff --git a/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs b/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs index da99e7d4de..f798ebf01e 100644 --- a/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs +++ b/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs @@ -30,11 +30,11 @@ namespace Volo.Abp.MailKit protected override async Task SendEmailAsync(MailMessage mail) { - using (var client = await BuildClientAsync()) + using (var client = await BuildClientAsync().ConfigureAwait(false)) { var message = MimeMessage.CreateFromMailMessage(mail); - await client.SendAsync(message); - await client.DisconnectAsync(true); + await client.SendAsync(message).ConfigureAwait(false); + await client.DisconnectAsync(true).ConfigureAwait(false); } } @@ -44,7 +44,7 @@ namespace Volo.Abp.MailKit try { - await ConfigureClient(client); + await ConfigureClient(client).ConfigureAwait(false); return client; } catch @@ -57,20 +57,20 @@ namespace Volo.Abp.MailKit protected virtual async Task ConfigureClient(SmtpClient client) { client.Connect( - await SmtpConfiguration.GetHostAsync(), - await SmtpConfiguration.GetPortAsync(), + await SmtpConfiguration.GetHostAsync().ConfigureAwait(false), + await SmtpConfiguration.GetPortAsync().ConfigureAwait(false), await GetSecureSocketOption() - ); +.ConfigureAwait(false)); - if (await SmtpConfiguration.GetUseDefaultCredentialsAsync()) + if (await SmtpConfiguration.GetUseDefaultCredentialsAsync().ConfigureAwait(false)) { return; } client.Authenticate( - await SmtpConfiguration.GetUserNameAsync(), + await SmtpConfiguration.GetUserNameAsync().ConfigureAwait(false), await SmtpConfiguration.GetPasswordAsync() - ); +.ConfigureAwait(false)); } protected virtual async Task GetSecureSocketOption() @@ -81,7 +81,7 @@ namespace Volo.Abp.MailKit } return await SmtpConfiguration.GetEnableSslAsync() - ? SecureSocketOptions.SslOnConnect +.ConfigureAwait(false) ? SecureSocketOptions.SslOnConnect : SecureSocketOptions.StartTlsWhenAvailable; } } diff --git a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs index b81aa7ae87..d554e09de1 100644 --- a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs +++ b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs @@ -101,7 +101,7 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, cancellationToken); + var entity = await FindAsync(id, includeDetails, cancellationToken).ConfigureAwait(false); if (entity == null) { @@ -118,13 +118,13 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, cancellationToken: cancellationToken); + var entity = await FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); if (entity == null) { return; } - await DeleteAsync(entity, autoSave, cancellationToken); + await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs index 4e8ccaa82e..1ee3cbf80d 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs @@ -58,12 +58,12 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { - await ApplyAbpConceptsForAddedEntityAsync(entity); + await ApplyAbpConceptsForAddedEntityAsync(entity).ConfigureAwait(false); await Collection.InsertOneAsync( entity, cancellationToken: GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); return entity; } @@ -78,14 +78,14 @@ namespace Volo.Abp.Domain.Repositories.MongoDB if (entity is ISoftDelete softDeleteEntity && softDeleteEntity.IsDeleted) { SetDeletionAuditProperties(entity); - await TriggerEntityDeleteEventsAsync(entity); + await TriggerEntityDeleteEventsAsync(entity).ConfigureAwait(false); } else { - await TriggerEntityUpdateEventsAsync(entity); + await TriggerEntityUpdateEventsAsync(entity).ConfigureAwait(false); } - await TriggerDomainEventsAsync(entity); + await TriggerDomainEventsAsync(entity).ConfigureAwait(false); var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); @@ -93,7 +93,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, cancellationToken: GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); if (result.MatchedCount <= 0) { @@ -108,7 +108,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { - await ApplyAbpConceptsForDeletedEntityAsync(entity); + await ApplyAbpConceptsForDeletedEntityAsync(entity).ConfigureAwait(false); var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); if (entity is ISoftDelete softDeleteEntity) @@ -118,7 +118,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, cancellationToken: GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); if (result.MatchedCount <= 0) { @@ -130,7 +130,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB var result = await Collection.DeleteOneAsync( CreateEntityFilter(entity, true, oldConcurrencyStamp), GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); if (result.DeletedCount <= 0) { @@ -141,12 +141,12 @@ namespace Volo.Abp.Domain.Repositories.MongoDB public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().ToListAsync(GetCancellationToken(cancellationToken)); + return await GetMongoQueryable().ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public override async Task GetCountAsync(CancellationToken cancellationToken = default) { - return await GetMongoQueryable().LongCountAsync(GetCancellationToken(cancellationToken)); + return await GetMongoQueryable().LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public override async Task DeleteAsync( @@ -156,11 +156,11 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { var entities = await GetMongoQueryable() .Where(predicate) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); foreach (var entity in entities) { - await DeleteAsync(entity, autoSave, cancellationToken); + await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); } } @@ -187,33 +187,33 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { CheckAndSetId(entity); SetCreationAuditProperties(entity); - await TriggerEntityCreateEvents(entity); - await TriggerDomainEventsAsync(entity); + await TriggerEntityCreateEvents(entity).ConfigureAwait(false); + await TriggerDomainEventsAsync(entity).ConfigureAwait(false); } private async Task TriggerEntityCreateEvents(TEntity entity) { - await EntityChangeEventHelper.TriggerEntityCreatedEventOnUowCompletedAsync(entity); - await EntityChangeEventHelper.TriggerEntityCreatingEventAsync(entity); + await EntityChangeEventHelper.TriggerEntityCreatedEventOnUowCompletedAsync(entity).ConfigureAwait(false); + await EntityChangeEventHelper.TriggerEntityCreatingEventAsync(entity).ConfigureAwait(false); } protected virtual async Task TriggerEntityUpdateEventsAsync(TEntity entity) { - await EntityChangeEventHelper.TriggerEntityUpdatedEventOnUowCompletedAsync(entity); - await EntityChangeEventHelper.TriggerEntityUpdatingEventAsync(entity); + await EntityChangeEventHelper.TriggerEntityUpdatedEventOnUowCompletedAsync(entity).ConfigureAwait(false); + await EntityChangeEventHelper.TriggerEntityUpdatingEventAsync(entity).ConfigureAwait(false); } protected virtual async Task ApplyAbpConceptsForDeletedEntityAsync(TEntity entity) { SetDeletionAuditProperties(entity); - await TriggerEntityDeleteEventsAsync(entity); - await TriggerDomainEventsAsync(entity); + await TriggerEntityDeleteEventsAsync(entity).ConfigureAwait(false); + await TriggerDomainEventsAsync(entity).ConfigureAwait(false); } protected virtual async Task TriggerEntityDeleteEventsAsync(TEntity entity) { - await EntityChangeEventHelper.TriggerEntityDeletedEventOnUowCompletedAsync(entity); - await EntityChangeEventHelper.TriggerEntityDeletingEventAsync(entity); + await EntityChangeEventHelper.TriggerEntityDeletedEventOnUowCompletedAsync(entity).ConfigureAwait(false); + await EntityChangeEventHelper.TriggerEntityDeletingEventAsync(entity).ConfigureAwait(false); } protected virtual void CheckAndSetId(TEntity entity) @@ -266,7 +266,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { foreach (var localEvent in localEvents) { - await LocalEventBus.PublishAsync(localEvent.GetType(), localEvent); + await LocalEventBus.PublishAsync(localEvent.GetType(), localEvent).ConfigureAwait(false); } generatesDomainEventsEntity.ClearLocalEvents(); @@ -277,7 +277,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { foreach (var distributedEvent in distributedEvents) { - await DistributedEventBus.PublishAsync(distributedEvent.GetType(), distributedEvent); + await DistributedEventBus.PublishAsync(distributedEvent.GetType(), distributedEvent).ConfigureAwait(false); } generatesDomainEventsEntity.ClearDistributedEvents(); @@ -324,7 +324,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, cancellationToken); + var entity = await FindAsync(id, includeDetails, cancellationToken).ConfigureAwait(false); if (entity == null) { @@ -341,7 +341,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { return await Collection .Find(CreateEntityFilter(id, true)) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual Task DeleteAsync( diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfiguration.cs b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfiguration.cs index 37ad3c74da..0ba64417a3 100644 --- a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfiguration.cs +++ b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfiguration.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.MultiTenancy public string Name { get; set; } - public ConnectionStrings ConnectionStrings { get; } + public ConnectionStrings ConnectionStrings { get; set; } public TenantConfiguration() { diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs index 1214a82a99..8e136fc2ac 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs @@ -63,13 +63,13 @@ namespace Volo.Abp.RabbitMQ public virtual async Task BindAsync(string routingKey) { QueueBindCommands.Enqueue(new QueueBindCommand(QueueBindType.Bind, routingKey)); - await TrySendQueueBindCommandsAsync(); + await TrySendQueueBindCommandsAsync().ConfigureAwait(false); } public virtual async Task UnbindAsync(string routingKey) { QueueBindCommands.Enqueue(new QueueBindCommand(QueueBindType.Unbind, routingKey)); - await TrySendQueueBindCommandsAsync(); + await TrySendQueueBindCommandsAsync().ConfigureAwait(false); } protected virtual void TrySendQueueBindCommands() @@ -166,7 +166,7 @@ namespace Volo.Abp.RabbitMQ var consumer = new EventingBasicConsumer(channel); consumer.Received += async (model, basicDeliverEventArgs) => { - await HandleIncomingMessage(channel, basicDeliverEventArgs); + await HandleIncomingMessage(channel, basicDeliverEventArgs).ConfigureAwait(false); }; channel.BasicConsume( @@ -189,7 +189,7 @@ namespace Volo.Abp.RabbitMQ { foreach (var callback in Callbacks) { - await callback(channel, basicDeliverEventArgs); + await callback(channel, basicDeliverEventArgs).ConfigureAwait(false); } channel.BasicAck(basicDeliverEventArgs.DeliveryTag, multiple: false); diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProvider.cs index 6f5372a4cf..7694ca219f 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProvider.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.Settings //TODO: How to implement setting.IsInherited? - var value = await GetOrNullValueFromProvidersAsync(providers, setting); + var value = await GetOrNullValueFromProvidersAsync(providers, setting).ConfigureAwait(false); if (setting.IsEncrypted) { value = SettingEncryptionService.Decrypt(setting, value); @@ -52,7 +52,7 @@ namespace Volo.Abp.Settings { foreach (var setting in settingDefinitions) { - var value = await provider.GetOrNullAsync(setting); + var value = await provider.GetOrNullAsync(setting).ConfigureAwait(false); if (value != null) { if (setting.IsEncrypted) @@ -74,7 +74,7 @@ namespace Volo.Abp.Settings { foreach (var provider in providers) { - var value = await provider.GetOrNullAsync(setting); + var value = await provider.GetOrNullAsync(setting).ConfigureAwait(false); if (value != null) { return value; diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProviderExtensions.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProviderExtensions.cs index fb67c4ae77..eb7e3c341c 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProviderExtensions.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProviderExtensions.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.Settings Check.NotNull(name, nameof(name)); return string.Equals( - await settingProvider.GetOrNullAsync(name), + await settingProvider.GetOrNullAsync(name).ConfigureAwait(false), "true", StringComparison.OrdinalIgnoreCase ); @@ -24,7 +24,7 @@ namespace Volo.Abp.Settings Check.NotNull(settingProvider, nameof(settingProvider)); Check.NotNull(name, nameof(name)); - var value = await settingProvider.GetOrNullAsync(name); + var value = await settingProvider.GetOrNullAsync(name).ConfigureAwait(false); return value?.To() ?? defaultValue; } } diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs index eab23b7258..408f70aac9 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Settings public override async Task GetOrNullAsync(SettingDefinition setting) { - return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentTenant.Id?.ToString()); + return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentTenant.Id?.ToString()).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs index 01125f3201..a3df714c00 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.Settings return null; } - return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentUser.Id.ToString()); + return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentUser.Id.ToString()).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.TestBase/Volo/Abp/AbpIntegratedTest.cs b/framework/src/Volo.Abp.TestBase/Volo/Abp/Testing/AbpIntegratedTest.cs similarity index 96% rename from framework/src/Volo.Abp.TestBase/Volo/Abp/AbpIntegratedTest.cs rename to framework/src/Volo.Abp.TestBase/Volo/Abp/Testing/AbpIntegratedTest.cs index 587d0d52db..96043f8220 100644 --- a/framework/src/Volo.Abp.TestBase/Volo/Abp/AbpIntegratedTest.cs +++ b/framework/src/Volo.Abp.TestBase/Volo/Abp/Testing/AbpIntegratedTest.cs @@ -2,10 +2,8 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Modularity; -namespace Volo.Abp +namespace Volo.Abp.Testing { - //TODO: Move to "Testing" namespace - public abstract class AbpIntegratedTest : AbpTestBaseWithServiceProvider, IDisposable where TStartupModule : IAbpModule { diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuManager.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuManager.cs index 5c33866aa2..7ca2baa6b0 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuManager.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuManager.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.UI.Navigation foreach (var contributor in Options.MenuContributors) { - await contributor.ConfigureMenuAsync(context); + await contributor.ConfigureMenuAsync(context).ConfigureAwait(false); } } diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs index ffa31e66a2..fed4235087 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs @@ -33,7 +33,7 @@ namespace Volo.Abp.UI.Navigation.Urls appName, urlName ) - ); +.ConfigureAwait(false)).ConfigureAwait(false); } protected virtual Task GetConfiguredUrl(string appName, string urlName) @@ -89,7 +89,7 @@ namespace Volo.Abp.UI.Navigation.Urls if (CurrentTenant.Id.HasValue) { - url = url.Replace(tenantNamePlaceHolder, await GetCurrentTenantNameAsync()); + url = url.Replace(tenantNamePlaceHolder, await GetCurrentTenantNameAsync().ConfigureAwait(false)); } else { @@ -103,7 +103,7 @@ namespace Volo.Abp.UI.Navigation.Urls { if (CurrentTenant.Id.HasValue && CurrentTenant.Name.IsNullOrEmpty()) { - var tenantConfiguration = await TenantStore.FindAsync(CurrentTenant.Id.Value); + var tenantConfiguration = await TenantStore.FindAsync(CurrentTenant.Id.Value).ConfigureAwait(false); return tenantConfiguration.Name; } diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs index e7e86774b5..18010136b2 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs @@ -80,7 +80,7 @@ namespace Volo.Abp.Uow { if (databaseApi is ISupportsSavingChanges) { - await (databaseApi as ISupportsSavingChanges).SaveChangesAsync(cancellationToken); + await (databaseApi as ISupportsSavingChanges).SaveChangesAsync(cancellationToken).ConfigureAwait(false); } } } @@ -107,10 +107,10 @@ namespace Volo.Abp.Uow try { _isCompleting = true; - await SaveChangesAsync(cancellationToken); - await CommitTransactionsAsync(); + await SaveChangesAsync(cancellationToken).ConfigureAwait(false); + await CommitTransactionsAsync().ConfigureAwait(false); IsCompleted = true; - await OnCompletedAsync(); + await OnCompletedAsync().ConfigureAwait(false); } catch (Exception ex) { @@ -128,7 +128,7 @@ namespace Volo.Abp.Uow _isRolledback = true; - await RollbackAllAsync(cancellationToken); + await RollbackAllAsync(cancellationToken).ConfigureAwait(false); } public IDatabaseApi FindDatabaseApi(string key) @@ -194,7 +194,7 @@ namespace Volo.Abp.Uow { foreach (var handler in CompletedHandlers) { - await handler.Invoke(); + await handler.Invoke().ConfigureAwait(false); } } @@ -278,7 +278,7 @@ namespace Volo.Abp.Uow { try { - await (databaseApi as ISupportsRollback).RollbackAsync(cancellationToken); + await (databaseApi as ISupportsRollback).RollbackAsync(cancellationToken).ConfigureAwait(false); } catch { } } @@ -290,7 +290,7 @@ namespace Volo.Abp.Uow { try { - await (transactionApi as ISupportsRollback).RollbackAsync(cancellationToken); + await (transactionApi as ISupportsRollback).RollbackAsync(cancellationToken).ConfigureAwait(false); } catch { } } @@ -309,7 +309,7 @@ namespace Volo.Abp.Uow { foreach (var transaction in GetAllActiveTransactionApis()) { - await transaction.CommitAsync(); + await transaction.CommitAsync().ConfigureAwait(false); } } diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs index 81bd132a5e..d08c9b943e 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs @@ -22,14 +22,14 @@ namespace Volo.Abp.Uow { if (!UnitOfWorkHelper.IsUnitOfWorkMethod(invocation.Method, out var unitOfWorkAttribute)) { - await invocation.ProceedAsync(); + await invocation.ProceedAsync().ConfigureAwait(false); return; } using (var uow = _unitOfWorkManager.Begin(CreateOptions(invocation, unitOfWorkAttribute))) { - await invocation.ProceedAsync(); - await uow.CompleteAsync(); + await invocation.ProceedAsync().ConfigureAwait(false); + await uow.CompleteAsync().ConfigureAwait(false); } } diff --git a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj index 9e1e81b1d9..86017b9628 100644 --- a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj +++ b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj @@ -19,7 +19,6 @@ - diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs index b4ce642471..24581c54d9 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.Validation public override async Task InterceptAsync(IAbpMethodInvocation invocation) { Validate(invocation); - await invocation.ProceedAsync(); + await invocation.ProceedAsync().ConfigureAwait(false); } protected virtual void Validate(IAbpMethodInvocation invocation) diff --git a/framework/src/Volo.Abp.VirtualFileSystem/Microsoft/Extensions/FileProviders/AbpFileInfoExtensions.cs b/framework/src/Volo.Abp.VirtualFileSystem/Microsoft/Extensions/FileProviders/AbpFileInfoExtensions.cs index 7d3505d616..9186e4d9e2 100644 --- a/framework/src/Volo.Abp.VirtualFileSystem/Microsoft/Extensions/FileProviders/AbpFileInfoExtensions.cs +++ b/framework/src/Volo.Abp.VirtualFileSystem/Microsoft/Extensions/FileProviders/AbpFileInfoExtensions.cs @@ -56,7 +56,7 @@ namespace Microsoft.Extensions.FileProviders using (var stream = fileInfo.CreateReadStream()) { - return await stream.GetAllBytesAsync(); + return await stream.GetAllBytesAsync().ConfigureAwait(false); } } diff --git a/framework/test/SimpleConsoleDemo/Program.cs b/framework/test/SimpleConsoleDemo/Program.cs index 82e6d0a660..3ac0c8b23b 100644 --- a/framework/test/SimpleConsoleDemo/Program.cs +++ b/framework/test/SimpleConsoleDemo/Program.cs @@ -10,7 +10,7 @@ namespace SimpleConsoleDemo { class Program { - static async Task Main(string[] args) + static void Main(string[] args) { using (var application = AbpApplicationFactory.Create(options => { @@ -42,7 +42,6 @@ namespace SimpleConsoleDemo writer.Write(); } - Console.WriteLine(); Console.WriteLine("Press ENTER to exit!"); Console.ReadLine(); diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/AppModule.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/AppModule.cs index 44e2e38380..8ec04b23a6 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/AppModule.cs +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/AppModule.cs @@ -41,7 +41,7 @@ namespace Volo.Abp.AspNetCore.App }; var result = jsonSerializer.Serialize(dictionary, camelCase: false); - await ctx.Response.WriteAsync(result); + await ctx.Response.WriteAsync(result).ConfigureAwait(false); }); } } diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs index e2ac111f5d..437240971d 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs @@ -46,14 +46,14 @@ namespace Volo.Abp.AspNetCore.MultiTenancy [Fact] public async Task Should_Use_Host_If_Tenant_Is_Not_Specified() { - var result = await GetResponseAsObjectAsync>("http://abp.io"); + var result = await GetResponseAsObjectAsync>("http://abp.io").ConfigureAwait(false); result["TenantId"].ShouldBe(""); } [Fact] public async Task Should_Use_Domain_If_Specified() { - var result = await GetResponseAsObjectAsync>("http://acme.abp.io"); + var result = await GetResponseAsObjectAsync>("http://acme.abp.io").ConfigureAwait(false); result["TenantId"].ShouldBe(_testTenantId.ToString()); } @@ -62,7 +62,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { Client.DefaultRequestHeaders.Add(_options.TenantKey, Guid.NewGuid().ToString()); - var result = await GetResponseAsObjectAsync>("http://acme.abp.io"); + var result = await GetResponseAsObjectAsync>("http://acme.abp.io").ConfigureAwait(false); result["TenantId"].ShouldBe(_testTenantId.ToString()); } } diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs index 37365089af..64f7ed2892 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs @@ -42,7 +42,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy [Fact] public async Task Should_Use_Host_If_Tenant_Is_Not_Specified() { - var result = await GetResponseAsObjectAsync>("http://abp.io"); + var result = await GetResponseAsObjectAsync>("http://abp.io").ConfigureAwait(false); result["TenantId"].ShouldBe(""); } @@ -50,7 +50,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy public async Task Should_Use_QueryString_Tenant_Id_If_Specified() { - var result = await GetResponseAsObjectAsync>($"http://abp.io?{_options.TenantKey}={_testTenantName}"); + var result = await GetResponseAsObjectAsync>($"http://abp.io?{_options.TenantKey}={_testTenantName}").ConfigureAwait(false); result["TenantId"].ShouldBe(_testTenantId.ToString()); } @@ -59,7 +59,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { Client.DefaultRequestHeaders.Add(_options.TenantKey, _testTenantId.ToString()); - var result = await GetResponseAsObjectAsync>("http://abp.io"); + var result = await GetResponseAsObjectAsync>("http://abp.io").ConfigureAwait(false); result["TenantId"].ShouldBe(_testTenantId.ToString()); } @@ -68,7 +68,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { Client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(_options.TenantKey, _testTenantId.ToString()).ToString()); - var result = await GetResponseAsObjectAsync>("http://abp.io"); + var result = await GetResponseAsObjectAsync>("http://abp.io").ConfigureAwait(false); result["TenantId"].ShouldBe(_testTenantId.ToString()); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs index 97055d1e9a..5e74ec4bfa 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs @@ -8,10 +8,10 @@ using Volo.Abp.AspNetCore.Mvc.Localization.Resource; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Autofac; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.MemoryDb; using Volo.Abp.Modularity; using Volo.Abp.TestApp; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.AspNetCore.Mvc diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs index 44b206e462..f141cf89c1 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring [Fact] public async Task GetAsync() { - var model = await GetResponseAsObjectAsync("/api/abp/api-definition"); + var model = await GetResponseAsObjectAsync("/api/abp/api-definition").ConfigureAwait(false); model.ShouldNotBeNull(); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationBuilder_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationBuilder_Tests.cs index c5f53e4721..590aa1a142 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationBuilder_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationBuilder_Tests.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations { var applicationConfigurationBuilder = GetRequiredService(); - var config = await applicationConfigurationBuilder.GetAsync(); + var config = await applicationConfigurationBuilder.GetAsync().ConfigureAwait(false); config.Auth.ShouldNotBeNull(); config.Localization.ShouldNotBeNull(); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/AuthTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/AuthTestController_Tests.cs index 8caf59d0c0..2937fd6759 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/AuthTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/AuthTestController_Tests.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization [Fact] public async Task Should_Call_Anonymous_Method_Without_Authentication() { - var result = await GetResponseAsStringAsync("/AuthTest/AnonymousTest"); + var result = await GetResponseAsStringAsync("/AuthTest/AnonymousTest").ConfigureAwait(false); result.ShouldBe("OK"); } @@ -41,7 +41,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization new Claim(AbpClaimTypes.UserId, AuthTestController.FakeUserId.ToString()) }); - var result = await GetResponseAsStringAsync("/AuthTest/SimpleAuthorizationTest"); + var result = await GetResponseAsStringAsync("/AuthTest/SimpleAuthorizationTest").ConfigureAwait(false); result.ShouldBe("OK"); } @@ -54,7 +54,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization new Claim("MyCustomClaimType", "42") }); - var result = await GetResponseAsStringAsync("/AuthTest/CustomPolicyTest"); + var result = await GetResponseAsStringAsync("/AuthTest/CustomPolicyTest").ConfigureAwait(false); result.ShouldBe("OK"); } @@ -70,7 +70,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization //TODO: We can get a real exception if we properly configure authentication schemas for this project await Assert.ThrowsAsync(async () => await GetResponseAsStringAsync("/AuthTest/CustomPolicyTest") - ); +.ConfigureAwait(false)).ConfigureAwait(false); } [Fact] @@ -81,7 +81,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization new Claim(AbpClaimTypes.UserId, AuthTestController.FakeUserId.ToString()) }); - var result = await GetResponseAsStringAsync("/AuthTest/PermissionTest"); + var result = await GetResponseAsStringAsync("/AuthTest/PermissionTest").ConfigureAwait(false); result.ShouldBe("OK"); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs index b9caa1d7cb..1952ef22b9 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization }); } - await next(context); + await next(context).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs index 5243307116..1d11103c6f 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling [Fact] public async Task Should_Return_RemoteServiceErrorResponse_For_UserFriendlyException_For_Void_Return_Value() { - var result = await GetResponseAsObjectAsync("/api/exception-test/UserFriendlyException1", HttpStatusCode.Forbidden); + var result = await GetResponseAsObjectAsync("/api/exception-test/UserFriendlyException1", HttpStatusCode.Forbidden).ConfigureAwait(false); result.Error.ShouldNotBeNull(); result.Error.Message.ShouldBe("This is a sample exception!"); } @@ -23,7 +23,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling async () => await GetResponseAsObjectAsync( "/api/exception-test/UserFriendlyException2" ) - ); +.ConfigureAwait(false)).ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Features/FeatureTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Features/FeatureTestController_Tests.cs index 637dbe3d2b..52ff323be6 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Features/FeatureTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Features/FeatureTestController_Tests.cs @@ -10,8 +10,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Features public async Task Should_Allow_Enabled_Features() { await GetResponseAsStringAsync( - "/api/feature-test/allowed-feature" - ); + "/api/feature-test/allowed-feature", HttpStatusCode.NoContent + ).ConfigureAwait(false); } [Fact] @@ -20,7 +20,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Features await GetResponseAsStringAsync( "/api/feature-test/not-allowed-feature", HttpStatusCode.Unauthorized - ); + ).ConfigureAwait(false); } [Fact] @@ -28,7 +28,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Features { await GetResponseAsStringAsync( "/api/feature-test/no-feature" - ); + ).ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs index 3e365cde3e..eeb47ea0a3 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Json { var time = await GetResponseAsStringAsync( "/api/json-result-test/json-result-action" - ); + ).ConfigureAwait(false); time.ShouldContain("2019*01*01"); } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs index 16057c3f07..2f5ad74df9 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs @@ -27,22 +27,22 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization [Fact] public async Task Should_Get_Same_Text_If_Not_Defined_In_Razor_View() { - var result = await GetResponseAsStringAsync("/LocalizationTest/HelloJohn"); + var result = await GetResponseAsStringAsync("/LocalizationTest/HelloJohn").ConfigureAwait(false); result.ShouldBe("Hello John."); } [Fact] public async Task Should_Localize_Display_Attribute() { - using (AbpCultureHelper.Use("en")) + using (CultureHelper.Use("en")) { - var result = await GetResponseAsStringAsync("/LocalizationTest/PersonForm"); + var result = await GetResponseAsStringAsync("/LocalizationTest/PersonForm").ConfigureAwait(false); result.ShouldContain(""); } - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { - var result = await GetResponseAsStringAsync("/LocalizationTest/PersonForm"); + var result = await GetResponseAsStringAsync("/LocalizationTest/PersonForm").ConfigureAwait(false); result.ShouldContain(""); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs index 632a02194f..45f8410eee 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs @@ -21,10 +21,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding [Fact] public async Task DateTimeKind_Test() { - var response = await Client.GetAsync("/api/model-Binding-test/DateTimeKind?input=2010-01-01T00:00:00Z"); + var response = await Client.GetAsync("/api/model-Binding-test/DateTimeKind?input=2010-01-01T00:00:00Z").ConfigureAwait(false); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync(); + var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); resultAsString.ShouldBe(DateTimeKind.ToString().ToLower()); } @@ -32,10 +32,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding public async Task NullableDateTimeKind_Test() { var response = - await Client.GetAsync("/api/model-Binding-test/NullableDateTimeKind?input=2010-01-01T00:00:00Z"); + await Client.GetAsync("/api/model-Binding-test/NullableDateTimeKind?input=2010-01-01T00:00:00Z").ConfigureAwait(false); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync(); + var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); resultAsString.ShouldBe(DateTimeKind.ToString().ToLower()); } @@ -44,10 +44,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding { var response = await Client.GetAsync( - "/api/model-Binding-test/DisableDateTimeNormalizationDateTimeKind?input=2010-01-01T00:00:00Z"); + "/api/model-Binding-test/DisableDateTimeNormalizationDateTimeKind?input=2010-01-01T00:00:00Z").ConfigureAwait(false); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync(); + var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); //Time parameter(2010-01-01T00:00:00Z) with time zone information, so the default Kind is Local. resultAsString.ShouldBe(DateTimeKind.Local.ToString().ToLower()); } @@ -57,10 +57,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding { var response = await Client.GetAsync( - "/api/model-Binding-test/DisableDateTimeNormalizationNullableDateTimeKind?input=2010-01-01T00:00:00Z"); + "/api/model-Binding-test/DisableDateTimeNormalizationNullableDateTimeKind?input=2010-01-01T00:00:00Z").ConfigureAwait(false); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync(); + var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); //Time parameter(2010-01-01T00:00:00Z) with time zone information, so the default Kind is Local. resultAsString.ShouldBe(DateTimeKind.Local.ToString().ToLower()); } @@ -72,10 +72,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding "Time1=2010-01-01T00:00:00Z&" + "Time2=2010-01-01T00:00:00Z&" + "Time3=2010-01-01T00:00:00Z&" + - "InnerModel.Time4=2010-01-01T00:00:00Z"); + "InnerModel.Time4=2010-01-01T00:00:00Z").ConfigureAwait(false); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync(); + var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); //Time parameter(2010-01-01T00:00:00Z) with time zone information, so the default Kind is Local. resultAsString.ShouldBe( $"local_{DateTimeKind.ToString().ToLower()}_{DateTimeKind.ToString().ToLower()}_local"); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs index 96a79d8971..c3c90d02f7 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc [Fact] public async Task GetAll_Test() { - var result = await GetResponseAsObjectAsync>("/api/app/people"); + var result = await GetResponseAsObjectAsync>("/api/app/people").ConfigureAwait(false); result.Items.Count.ShouldBeGreaterThan(0); } @@ -44,7 +44,7 @@ namespace Volo.Abp.AspNetCore.Mvc { var firstPerson = (await _personRepository.GetListAsync()).First(); - var result = await GetResponseAsObjectAsync($"/api/app/people/{firstPerson.Id}"); + var result = await GetResponseAsObjectAsync($"/api/app/people/{firstPerson.Id}").ConfigureAwait(false); result.Name.ShouldBe(firstPerson.Name); } @@ -53,9 +53,9 @@ namespace Volo.Abp.AspNetCore.Mvc { var firstPerson = (await _personRepository.GetListAsync()).First(); - await Client.DeleteAsync($"/api/app/people/{firstPerson.Id}"); + await Client.DeleteAsync($"/api/app/people/{firstPerson.Id}").ConfigureAwait(false); - (await _personRepository.FindAsync(firstPerson.Id)).ShouldBeNull(); + (await _personRepository.FindAsync(firstPerson.Id).ConfigureAwait(false)).ShouldBeNull(); } [Fact] @@ -68,10 +68,10 @@ namespace Volo.Abp.AspNetCore.Mvc var response = await Client.PostAsync( "/api/app/people", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json) - ); + ).ConfigureAwait(false); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync(); + var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); PersonDto resultDto = _jsonSerializer.Deserialize(resultAsString); //Assert @@ -80,7 +80,7 @@ namespace Volo.Abp.AspNetCore.Mvc resultDto.Name.ShouldBe("John"); resultDto.Age.ShouldBe(33); - (await _personRepository.FindAsync(resultDto.Id)).ShouldNotBeNull(); + (await _personRepository.FindAsync(resultDto.Id).ConfigureAwait(false)).ShouldNotBeNull(); } @@ -100,10 +100,10 @@ namespace Volo.Abp.AspNetCore.Mvc var response = await Client.PutAsync( $"/api/app/people/{updateDto.Id}", new StringContent(putData, Encoding.UTF8, MimeTypes.Application.Json) - ); + ).ConfigureAwait(false); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync(); + var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); PersonDto resultDto = _jsonSerializer.Deserialize(resultAsString); //Assert @@ -112,7 +112,7 @@ namespace Volo.Abp.AspNetCore.Mvc resultDto.Name.ShouldBe(firstPerson.Name); resultDto.Age.ShouldBe(firstPersonAge + 1); - var personInDb = (await _personRepository.FindAsync(resultDto.Id)); + var personInDb = (await _personRepository.FindAsync(resultDto.Id).ConfigureAwait(false)); personInDb.ShouldNotBeNull(); personInDb.Name.ShouldBe(firstPerson.Name); personInDb.Age.ShouldBe(firstPersonAge + 1); @@ -133,10 +133,10 @@ namespace Volo.Abp.AspNetCore.Mvc var response = await Client.PostAsync( $"/api/app/people/{personToAddNewPhone.Id}/phones", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json) - ); + ).ConfigureAwait(false); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync(); + var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); var resultDto = _jsonSerializer.Deserialize(resultAsString); //Assert @@ -144,7 +144,7 @@ namespace Volo.Abp.AspNetCore.Mvc resultDto.Type.ShouldBe(PhoneType.Mobile); resultDto.Number.ShouldBe(phoneNumberToAdd); - var personInDb = await _personRepository.FindAsync(personToAddNewPhone.Id); + var personInDb = await _personRepository.FindAsync(personToAddNewPhone.Id).ConfigureAwait(false); personInDb.ShouldNotBeNull(); personInDb.Phones.Any(p => p.Number == phoneNumberToAdd).ShouldBeTrue(); } @@ -154,7 +154,7 @@ namespace Volo.Abp.AspNetCore.Mvc { var douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas"); - var result = await GetResponseAsObjectAsync>($"/api/app/people/{douglas.Id}/phones"); + var result = await GetResponseAsObjectAsync>($"/api/app/people/{douglas.Id}/phones").ConfigureAwait(false); result.Items.Count.ShouldBe(douglas.Phones.Count); } @@ -164,7 +164,7 @@ namespace Volo.Abp.AspNetCore.Mvc var douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas"); var firstPhone = douglas.Phones.First(); - await Client.DeleteAsync($"/api/app/people/{douglas.Id}/phones?number={firstPhone.Number}"); + await Client.DeleteAsync($"/api/app/people/{douglas.Id}/phones?number={firstPhone.Number}").ConfigureAwait(false); douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas"); douglas.Phones.Any(p => p.Number == firstPhone.Number).ShouldBeFalse(); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs index c7dce93b3a..2af719ae4d 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting [Fact] public async Task GetAll() { - var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true"); + var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true").ConfigureAwait(false); script.Length.ShouldBeGreaterThan(0); } @@ -18,10 +18,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting public async Task GetAllWithMinify() { GetRequiredService>().Value.MinifyGeneratedScript = false; - var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript"); + var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript").ConfigureAwait(false); GetRequiredService>().Value.MinifyGeneratedScript = true; - var minifyScript = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true"); + var minifyScript = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true").ConfigureAwait(false); script.Length.ShouldBeGreaterThan(0); minifyScript.Length.ShouldBeGreaterThan(0); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController.cs new file mode 100644 index 0000000000..dc0ae30d71 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController.cs @@ -0,0 +1,51 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace Volo.Abp.AspNetCore.Mvc.Response +{ + [Route("api/NoContent-Test")] + public class NoContentTestController : AbpController + { + [HttpGet] + [Route("TestMethod")] + public void TestMethod() + { + } + + [HttpGet] + [Route("TestMethodWithReturn")] + public string TestMethodWithReturn() + { + return "TestReturn"; + } + + [HttpGet] + [Route("TestCustomHttpStatusCodeMethod")] + public void TestCustomHttpStatusCodeMethod() + { + Response.Redirect("/"); + } + + [HttpGet] + [Route("TestAsyncMethod")] + public async Task TestAsyncMethod() + { + await Task.CompletedTask; + } + + [HttpGet] + [Route("TestAsyncMethodWithReturn")] + public async Task TestAsyncMethodWithReturn() + { + return await Task.FromResult("TestReturn"); + } + + [HttpGet] + [Route("TestAsyncCustomHttpStatusCodeMethod")] + public async Task TestAsyncCustomHttpStatusCodeMethod() + { + Response.Redirect("/"); + await Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController_Tests.cs new file mode 100644 index 0000000000..6c68c13f07 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController_Tests.cs @@ -0,0 +1,58 @@ +using System.Net; +using System.Threading.Tasks; +using Shouldly; +using Xunit; + +namespace Volo.Abp.AspNetCore.Mvc.Response +{ + public class NoContentTestController_Tests : AspNetCoreMvcTestBase + { + [Fact] + public async Task Should_Set_No_Content_For_Void_Action() + { + var result = await GetResponseAsync("/api/NoContent-Test/TestMethod", HttpStatusCode.NoContent) + .ConfigureAwait(false); + result.StatusCode.ShouldBe(HttpStatusCode.NoContent); + } + + [Fact] + public async Task Should_Not_Set_No_Content_For_Not_Void_Action() + { + var result = await GetResponseAsync("/api/NoContent-Test/TestMethodWithReturn") + .ConfigureAwait(false); + result.StatusCode.ShouldBe(HttpStatusCode.OK); + } + + [Fact] + public async Task Should_Not_Set_No_Content_For_Custom_Http_Status_Code_Action() + { + var result = await GetResponseAsync("/api/NoContent-Test/TestCustomHttpStatusCodeMethod", HttpStatusCode.Redirect) + .ConfigureAwait(false); + result.StatusCode.ShouldBe(HttpStatusCode.Redirect); + } + + [Fact] + public async Task Should_Set_No_Content_For_Task_Action() + { + var result = await GetResponseAsync("/api/NoContent-Test/TestAsyncMethod", HttpStatusCode.NoContent) + .ConfigureAwait(false); + result.StatusCode.ShouldBe(HttpStatusCode.NoContent); + } + + [Fact] + public async Task Should_Not_Set_No_Content_For_Not_Task_Action() + { + var result = await GetResponseAsync("/api/NoContent-Test/TestAsyncMethodWithReturn") + .ConfigureAwait(false); + result.StatusCode.ShouldBe(HttpStatusCode.OK); + } + + [Fact] + public async Task Should_Not_Set_No_Content_For_Custom_Http_Status_Code_Async_Action() + { + var result = await GetResponseAsync("/api/NoContent-Test/TestAsyncCustomHttpStatusCodeMethod", HttpStatusCode.Redirect) + .ConfigureAwait(false); + result.StatusCode.ShouldBe(HttpStatusCode.Redirect); + } + } +} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/SimpleController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/SimpleController_Tests.cs index cda64b2323..aa111be2f8 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/SimpleController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/SimpleController_Tests.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.AspNetCore.Mvc { var result = await GetResponseAsStringAsync( GetUrl(nameof(SimpleController.Index)) - ); + ).ConfigureAwait(false); result.ShouldBe("Index-Result"); } @@ -23,7 +23,7 @@ namespace Volo.Abp.AspNetCore.Mvc { var result = await GetResponseAsStringAsync( GetUrl(nameof(SimpleController.About)) - ); + ).ConfigureAwait(false); result.Trim().ShouldBe("

    About

    "); } @@ -35,8 +35,8 @@ namespace Volo.Abp.AspNetCore.Mvc { await GetResponseAsStringAsync( GetUrl(nameof(SimpleController.ExceptionOnRazor)) - ); - }); + ).ConfigureAwait(false); + }).ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs index 6400ecb88e..81d1c88bee 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow [Fact] public async Task Should_Rollback_Transaction_For_Handled_Exceptions() { - var result = await GetResponseAsObjectAsync("/api/unitofwork-test/HandledException", HttpStatusCode.Forbidden); + var result = await GetResponseAsObjectAsync("/api/unitofwork-test/HandledException", HttpStatusCode.Forbidden).ConfigureAwait(false); result.Error.ShouldNotBeNull(); result.Error.Message.ShouldBe("This is a sample exception!"); } @@ -22,11 +22,11 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow [Fact] public async Task Should_Gracefully_Handle_Exceptions_On_Complete() { - var response = await GetResponseAsync("/api/unitofwork-test/ExceptionOnComplete", HttpStatusCode.Forbidden); + var response = await GetResponseAsync("/api/unitofwork-test/ExceptionOnComplete", HttpStatusCode.Forbidden).ConfigureAwait(false); response.Headers.GetValues(AbpHttpConsts.AbpErrorFormat).FirstOrDefault().ShouldBe("true"); - var resultAsString = await response.Content.ReadAsStringAsync(); + var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); var result = ServiceProvider.GetRequiredService().Deserialize(resultAsString); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Tests.cs index abd666e3f5..192d1f0e06 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Tests.cs @@ -9,13 +9,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow [Fact] public async Task Get_Actions_Should_Not_Be_Transactional() { - await GetResponseAsStringAsync("/api/unitofwork-test/ActionRequiresUow"); + await GetResponseAsStringAsync("/api/unitofwork-test/ActionRequiresUow").ConfigureAwait(false); } [Fact] public async Task Non_Get_Actions_Should_Be_Transactional() { - var result = await Client.PostAsync("/api/unitofwork-test/ActionRequiresUowPost", null); + var result = await Client.PostAsync("/api/unitofwork-test/ActionRequiresUowPost", null).ConfigureAwait(false); result.IsSuccessStatusCode.ShouldBeTrue(); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs index 5177868843..9d5cbfa012 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs @@ -12,23 +12,23 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation [Fact] public async Task Should_Validate_Object_Result_Success() { - var result = await GetResponseAsStringAsync("/api/validation-test/object-result-action?value1=hello"); + var result = await GetResponseAsStringAsync("/api/validation-test/object-result-action?value1=hello").ConfigureAwait(false); result.ShouldBe("hello"); } [Fact] public async Task Should_Validate_Object_Result_Failing() { - var result = await GetResponseAsObjectAsync("/api/validation-test/object-result-action?value1=a", HttpStatusCode.BadRequest); //value1 has min length of 2 chars. + var result = await GetResponseAsObjectAsync("/api/validation-test/object-result-action?value1=a", HttpStatusCode.BadRequest).ConfigureAwait(false); //value1 has min length of 2 chars. result.Error.ValidationErrors.Length.ShouldBeGreaterThan(0); } [Fact] public async Task Should_Return_Localized_Validation_Errors() { - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { - var result = await GetResponseAsObjectAsync("/api/validation-test/object-result-action?value1=a", HttpStatusCode.BadRequest); //value1 has min length of 2 chars. + var result = await GetResponseAsObjectAsync("/api/validation-test/object-result-action?value1=a", HttpStatusCode.BadRequest).ConfigureAwait(false); //value1 has min length of 2 chars. result.Error.ValidationErrors.Length.ShouldBeGreaterThan(0); result.Error.ValidationErrors[0].Message.ShouldBe("Değer Bir alanı en az '2' uzunluğunda bir metin ya da dizi olmalıdır."); } @@ -37,14 +37,14 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation [Fact] public async Task Should_Not_Validate_Action_Result_Success() { - var result = await GetResponseAsStringAsync("/api/validation-test/action-result-action?value1=hello"); + var result = await GetResponseAsStringAsync("/api/validation-test/action-result-action?value1=hello").ConfigureAwait(false); result.ShouldBe("ModelState.IsValid: true"); } [Fact] public async Task Should_Not_Validate_Action_Result_Failing() { - var result = await GetResponseAsStringAsync("/api/validation-test/action-result-action"); //Missed the value1 + var result = await GetResponseAsStringAsync("/api/validation-test/action-result-action").ConfigureAwait(false); //Missed the value1 result.ShouldBe("ModelState.IsValid: false"); } @@ -52,7 +52,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation public async Task Should_Return_Custom_Validate_Errors() { var result = await GetResponseAsObjectAsync( - "/api/validation-test/object-result-action-with-custom_validate?value1=abc", HttpStatusCode.BadRequest); //value1 should be hello. + "/api/validation-test/object-result-action-with-custom_validate?value1=abc", HttpStatusCode.BadRequest).ConfigureAwait(false); //value1 should be hello. result.Error.ValidationErrors.Length.ShouldBeGreaterThan(0); result.Error.ValidationErrors.ShouldContain(x => x.Message == "Value1 should be hello"); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/Components/Card_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/Components/Card_Tests.cs index 9fcac03459..89d9028fc4 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/Components/Card_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/Components/Card_Tests.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Components [Fact(Skip = "This test project is not completed yet")] public async Task Index() { - var result = await GetResponseAsStringAsync("/Components/Cards"); + var result = await GetResponseAsStringAsync("/Components/Cards").ConfigureAwait(false); result.ShouldNotBeNullOrEmpty(); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/HelloController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/HelloController_Tests.cs index 0dc4057bde..a5db492a39 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/HelloController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/HelloController_Tests.cs @@ -18,19 +18,19 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test [Fact] public async Task GetAsync() { - (await _helloController.GetAsync()).ShouldBe("Get-2.0"); + (await _helloController.GetAsync().ConfigureAwait(false)).ShouldBe("Get-2.0"); } [Fact] public async Task PostAsyncV1() { - (await _helloController.PostAsyncV1()).ShouldBe("Post-1.0"); + (await _helloController.PostAsyncV1().ConfigureAwait(false)).ShouldBe("Post-1.0"); } [Fact] public async Task PostAsyncV2() { - (await _helloController.PostAsyncV2()).ShouldBe("Post-2.0"); + (await _helloController.PostAsyncV2().ConfigureAwait(false)).ShouldBe("Post-2.0"); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs index f5b86cf7d7..4db9f235be 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test.v1 [Fact] public async Task GetAsync() { - (await _todoAppService.GetAsync(42)).ShouldBe("Compat-42-1.0"); + (await _todoAppService.GetAsync(42).ConfigureAwait(false)).ShouldBe("Compat-42-1.0"); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs index d6b681aa2e..2bfecc2664 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test.v2 [Fact] public async Task GetAsync() { - (await _todoAppService.GetAsync(42)).ShouldBe("42-2.0"); + (await _todoAppService.GetAsync(42).ConfigureAwait(false)).ShouldBe("42-2.0"); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs index dd5edff807..2c647d0556 100644 --- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs +++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs @@ -26,15 +26,15 @@ namespace Volo.Abp.AspNetCore protected virtual async Task GetResponseAsObjectAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK) { - var strResponse = await GetResponseAsStringAsync(url, expectedStatusCode); + var strResponse = await GetResponseAsStringAsync(url, expectedStatusCode).ConfigureAwait(false); return JsonConvert.DeserializeObject(strResponse, SharedJsonSerializerSettings); } protected virtual async Task GetResponseAsStringAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK) { - using (var response = await GetResponseAsync(url, expectedStatusCode)) + using (var response = await GetResponseAsync(url, expectedStatusCode).ConfigureAwait(false)) { - return await response.Content.ReadAsStringAsync(); + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); } } @@ -43,7 +43,7 @@ namespace Volo.Abp.AspNetCore using (var requestMessage = new HttpRequestMessage(HttpMethod.Get, url)) { requestMessage.Headers.Add("Accept-Language", CultureInfo.CurrentUICulture.Name); - var response = await Client.SendAsync(requestMessage); + var response = await Client.SendAsync(requestMessage).ConfigureAwait(false); response.StatusCode.ShouldBe(expectedStatusCode); return response; } diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/VirtualFileSystem/VirtualFileSystem_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/VirtualFileSystem/VirtualFileSystem_Tests.cs index 142d44baec..88399bd9a7 100644 --- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/VirtualFileSystem/VirtualFileSystem_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/VirtualFileSystem/VirtualFileSystem_Tests.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem { var result = await GetResponseAsStringAsync( "/SampleFiles/test1.js" - ); + ).ConfigureAwait(false); result.ShouldBe("test1.js-content"); } diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AuditingInterceptor_Tests.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AuditingInterceptor_Tests.cs index 23eba6c53b..516310b781 100644 --- a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AuditingInterceptor_Tests.cs +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AuditingInterceptor_Tests.cs @@ -5,6 +5,7 @@ using NSubstitute; using Volo.Abp.Autofac; using Volo.Abp.DependencyInjection; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Auditing @@ -37,8 +38,8 @@ namespace Volo.Abp.Auditing using (var scope = _auditingManager.BeginScope()) { - await myAuditedObject1.DoItAsync(new InputObject { Value1 = "forty-two", Value2 = 42 }); - await scope.SaveAsync(); + await myAuditedObject1.DoItAsync(new InputObject { Value1 = "forty-two", Value2 = 42 }).ConfigureAwait(false); + await scope.SaveAsync().ConfigureAwait(false); } #pragma warning disable 4014 diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AuthorizationTestBase.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AuthorizationTestBase.cs index e30565bcf2..8ab051d97e 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AuthorizationTestBase.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AuthorizationTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.Authorization +using Volo.Abp.Testing; + +namespace Volo.Abp.Authorization { public class AuthorizationTestBase : AbpIntegratedTest { diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs index 104d75c11b..2950c7c92a 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs @@ -22,8 +22,8 @@ namespace Volo.Abp.Authorization { await Assert.ThrowsAsync(async () => { - await _myAuthorizedService1.ProtectedByClass(); - }); + await _myAuthorizedService1.ProtectedByClass().ConfigureAwait(false); + }).ConfigureAwait(false); } [Fact] @@ -31,20 +31,20 @@ namespace Volo.Abp.Authorization { await Assert.ThrowsAsync(async () => { - await _myAuthorizedService1.ProtectedByClassAsync(); - }); + await _myAuthorizedService1.ProtectedByClassAsync().ConfigureAwait(false); + }).ConfigureAwait(false); } [Fact] public async Task Should_Allow_To_Call_Anonymous_Method() { - (await _myAuthorizedService1.Anonymous()).ShouldBe(42); + (await _myAuthorizedService1.Anonymous().ConfigureAwait(false)).ShouldBe(42); } [Fact] public async Task Should_Allow_To_Call_Anonymous_Method_Async() { - (await _myAuthorizedService1.AnonymousAsync()).ShouldBe(42); + (await _myAuthorizedService1.AnonymousAsync().ConfigureAwait(false)).ShouldBe(42); } [Fact] diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs index b1b2a4c43f..6d64ed80dd 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.Authorization.TestServices [AllowAnonymous] public virtual async Task AnonymousAsync() { - await Task.Delay(10); + await Task.Delay(10).ConfigureAwait(false); return 42; } @@ -27,7 +27,7 @@ namespace Volo.Abp.Authorization.TestServices public virtual async Task ProtectedByClassAsync() { - await Task.Delay(10); + await Task.Delay(10).ConfigureAwait(false); return 42; } } diff --git a/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AbpAutoMapperModule_Basic_Tests.cs b/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AbpAutoMapperModule_Basic_Tests.cs index 436c0402d8..3ac2246dcc 100644 --- a/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AbpAutoMapperModule_Basic_Tests.cs +++ b/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AbpAutoMapperModule_Basic_Tests.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.AutoMapper.SampleClasses; using Volo.Abp.ObjectMapping; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.AutoMapper diff --git a/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AbpAutoMapperModule_Specific_ObjectMapper_Tests.cs b/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AbpAutoMapperModule_Specific_ObjectMapper_Tests.cs index cfc846f3b7..1c3b0bf1be 100644 --- a/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AbpAutoMapperModule_Specific_ObjectMapper_Tests.cs +++ b/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AbpAutoMapperModule_Specific_ObjectMapper_Tests.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.AutoMapper.SampleClasses; using Volo.Abp.ObjectMapping; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.AutoMapper diff --git a/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AutoMapper_ConfigurationValidation_Tests.cs b/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AutoMapper_ConfigurationValidation_Tests.cs index 7504bd7209..50daf2cc0b 100644 --- a/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AutoMapper_ConfigurationValidation_Tests.cs +++ b/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AutoMapper_ConfigurationValidation_Tests.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; using IObjectMapper = Volo.Abp.ObjectMapping.IObjectMapper; diff --git a/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/ObjectMapperExtensions_Tests.cs b/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/ObjectMapperExtensions_Tests.cs index 3958041817..737731fd22 100644 --- a/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/ObjectMapperExtensions_Tests.cs +++ b/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/ObjectMapperExtensions_Tests.cs @@ -3,6 +3,7 @@ using Shouldly; using System; using Volo.Abp.AutoMapper.SampleClasses; using Volo.Abp.ObjectMapping; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.AutoMapper diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobExecuter_Tests.cs b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobExecuter_Tests.cs index 81c76f2559..50d90d0196 100644 --- a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobExecuter_Tests.cs +++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobExecuter_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.BackgroundJobs //Act - _backgroundJobExecuter.Execute( + await _backgroundJobExecuter.ExecuteAsync( new JobExecutionContext( ServiceProvider, typeof(MyJob), @@ -46,7 +46,7 @@ namespace Volo.Abp.BackgroundJobs //Act - _backgroundJobExecuter.Execute( + await _backgroundJobExecuter.ExecuteAsync( new JobExecutionContext( ServiceProvider, typeof(MyAsyncJob), diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobManager_Tests.cs b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobManager_Tests.cs index 3a84e38df1..2cd76620ff 100644 --- a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobManager_Tests.cs +++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobManager_Tests.cs @@ -19,17 +19,17 @@ namespace Volo.Abp.BackgroundJobs [Fact] public async Task Should_Store_Jobs() { - var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyJobArgs("42")); + var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyJobArgs("42")).ConfigureAwait(false); jobIdAsString.ShouldNotBe(default); - (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString))).ShouldNotBeNull(); + (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString)).ConfigureAwait(false)).ShouldNotBeNull(); } [Fact] public async Task Should_Store_Async_Jobs() { - var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyAsyncJobArgs("42")); + var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyAsyncJobArgs("42")).ConfigureAwait(false); jobIdAsString.ShouldNotBe(default); - (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString))).ShouldNotBeNull(); + (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString)).ConfigureAwait(false)).ShouldNotBeNull(); } } } diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsTestBase.cs b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsTestBase.cs index 6351320242..c2aedce98a 100644 --- a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsTestBase.cs +++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.BackgroundJobs +using Volo.Abp.Testing; + +namespace Volo.Abp.BackgroundJobs { public abstract class BackgroundJobsTestBase : AbpIntegratedTest { diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs index adb0b01bfc..d3afb3addf 100644 --- a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs +++ b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs @@ -3,6 +3,7 @@ using Shouldly; using System; using System.Reflection; using System.Threading.Tasks; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Caching @@ -25,7 +26,7 @@ namespace Volo.Abp.Caching var cacheKey = Guid.NewGuid().ToString(); //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey); + var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); GetDefaultCachingOptions(personCache).SlidingExpiration.ShouldBe(TimeSpan.FromMinutes(20)); diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs index 927448463a..50a4a76763 100644 --- a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs +++ b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Shouldly; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Caching @@ -16,28 +17,28 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey); + var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem); + await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); //Get (it should be available now - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey); + await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); } [Fact] - public async Task GetOrAddAsync() + public void GetOrAdd() { var personCache = GetRequiredService>(); @@ -48,8 +49,8 @@ namespace Volo.Abp.Caching bool factoryExecuted = false; - var cacheItem = await personCache.GetOrAddAsync(cacheKey, - async () => + var cacheItem = personCache.GetOrAdd(cacheKey, + () => { factoryExecuted = true; return new PersonCacheItem(personName); @@ -62,8 +63,8 @@ namespace Volo.Abp.Caching factoryExecuted = false; - cacheItem = await personCache.GetOrAddAsync(cacheKey, - async () => + cacheItem = personCache.GetOrAdd(cacheKey, + () => { factoryExecuted = true; return new PersonCacheItem(personName); @@ -84,41 +85,41 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey); + var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); - var cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + var cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem1.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem); + await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); //Get (it should be available now, but otherPersonCache not exists now. - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem1.ShouldBeNull(); //set other person cache cacheItem1 = new Sail.Testing.Caching.PersonCacheItem(personName); - await otherPersonCache.SetAsync(cacheKey, cacheItem1); + await otherPersonCache.SetAsync(cacheKey, cacheItem1).ConfigureAwait(false); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem1.ShouldNotBeNull(); cacheItem1.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey); + await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem1.ShouldNotBeNull(); } @@ -132,23 +133,23 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey); + var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem); + await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); //Get (it should be available now - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey); + await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); } @@ -164,8 +165,8 @@ namespace Volo.Abp.Caching bool factoryExecuted = false; - var cacheItem = await personCache.GetOrAddAsync(cacheKey, - async () => + var cacheItem = personCache.GetOrAdd(cacheKey, + () => { factoryExecuted = true; return new PersonCacheItem(personName); @@ -183,7 +184,7 @@ namespace Volo.Abp.Caching { factoryExecuted = true; return new PersonCacheItem(personName); - }); + }).ConfigureAwait(false); factoryExecuted.ShouldBeFalse(); cacheItem.Name.ShouldBe(personName); @@ -200,41 +201,41 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey); + var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); - var cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + var cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem1.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem); + await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); //Get (it should be available now, but otherPersonCache not exists now. - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem1.ShouldBeNull(); //set other person cache cacheItem1 = new Sail.Testing.Caching.PersonCacheItem(personName); - await otherPersonCache.SetAsync(cacheKey, cacheItem1); + await otherPersonCache.SetAsync(cacheKey, cacheItem1).ConfigureAwait(false); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem1.ShouldNotBeNull(); cacheItem1.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey); + await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem1.ShouldNotBeNull(); } @@ -248,23 +249,23 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey); + var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem); + await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); //Get (it should be available now - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey); + await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey); + cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); cacheItem.ShouldBeNull(); } @@ -278,34 +279,34 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem1 = await personCache.GetAsync(cache1Key); - var cacheItem2 = await personCache.GetAsync(cache2Key); + var cacheItem1 = await personCache.GetAsync(cache1Key).ConfigureAwait(false); + var cacheItem2 = await personCache.GetAsync(cache2Key).ConfigureAwait(false); cacheItem1.ShouldBeNull(); cacheItem2.ShouldBeNull(); //Set cacheItem1 = new PersonCacheItem(personName); cacheItem2 = new PersonCacheItem(personName); - await personCache.SetAsync(cache1Key, cacheItem1); - await personCache.SetAsync(cache2Key, cacheItem2); + await personCache.SetAsync(cache1Key, cacheItem1).ConfigureAwait(false); + await personCache.SetAsync(cache2Key, cacheItem2).ConfigureAwait(false); //Get (it should be available now - cacheItem1 = await personCache.GetAsync(cache1Key); + cacheItem1 = await personCache.GetAsync(cache1Key).ConfigureAwait(false); cacheItem1.ShouldNotBeNull(); cacheItem1.Name.ShouldBe(personName); - cacheItem2 = await personCache.GetAsync(cache2Key); + cacheItem2 = await personCache.GetAsync(cache2Key).ConfigureAwait(false); cacheItem2.ShouldNotBeNull(); cacheItem2.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cache1Key); - await personCache.RemoveAsync(cache2Key); + await personCache.RemoveAsync(cache1Key).ConfigureAwait(false); + await personCache.RemoveAsync(cache2Key).ConfigureAwait(false); //Get (not exists since removed) - cacheItem1 = await personCache.GetAsync(cache1Key); + cacheItem1 = await personCache.GetAsync(cache1Key).ConfigureAwait(false); cacheItem1.ShouldBeNull(); - cacheItem2 = await personCache.GetAsync(cache2Key); + cacheItem2 = await personCache.GetAsync(cache2Key).ConfigureAwait(false); cacheItem2.ShouldBeNull(); } diff --git a/framework/test/Volo.Abp.Cli.Core.Tests/Volo/Abp/Cli/AbpCliTestBase.cs b/framework/test/Volo.Abp.Cli.Core.Tests/Volo/Abp/Cli/AbpCliTestBase.cs index 6f6393b7ae..dd93bde1ca 100644 --- a/framework/test/Volo.Abp.Cli.Core.Tests/Volo/Abp/Cli/AbpCliTestBase.cs +++ b/framework/test/Volo.Abp.Cli.Core.Tests/Volo/Abp/Cli/AbpCliTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.Cli +using Volo.Abp.Testing; + +namespace Volo.Abp.Cli { public class AbpCliTestBase : AbpIntegratedTest { diff --git a/framework/test/Volo.Abp.Core.Tests/Microsoft/Extensions/DependencyInjection/DependencyInjection_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Microsoft/Extensions/DependencyInjection/DependencyInjection_Tests.cs index 64057659b6..680cb607f7 100644 --- a/framework/test/Volo.Abp.Core.Tests/Microsoft/Extensions/DependencyInjection/DependencyInjection_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Microsoft/Extensions/DependencyInjection/DependencyInjection_Tests.cs @@ -4,6 +4,7 @@ using Shouldly; using Volo.Abp; using Volo.Abp.DependencyInjection; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; namespace Microsoft.Extensions.DependencyInjection diff --git a/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs b/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs index 0720a492aa..23d961dfa7 100644 --- a/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs @@ -11,7 +11,7 @@ namespace System public StringExtensions_Tests() { - _cultureScope = AbpCultureHelper.Use("en-US"); + _cultureScope = CultureHelper.Use("en-US"); } [Fact] @@ -31,7 +31,7 @@ namespace System [Fact] public void EnsureEndsWith_CultureSpecific_Test() { - using (AbpCultureHelper.Use("tr-TR")) + using (CultureHelper.Use("tr-TR")) { "Kırmızı".EnsureEndsWith('I', StringComparison.CurrentCultureIgnoreCase).ShouldBe("Kırmızı"); } @@ -59,7 +59,7 @@ namespace System [Fact] public void ToPascalCase_CurrentCulture_Test() { - using (AbpCultureHelper.Use("tr-TR")) + using (CultureHelper.Use("tr-TR")) { "istanbul".ToPascalCase(true).ShouldBe("İstanbul"); } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs index c6e9f03927..781a128191 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.DynamicProxy @@ -38,11 +39,11 @@ namespace Volo.Abp.DynamicProxy { //Arrange - var target = ServiceProvider.GetService(); - - //Act - - await target.DoItAsync(); + var target = ServiceProvider.GetService(); + + //Act + + await target.DoItAsync().ConfigureAwait(false); //Assert @@ -65,7 +66,7 @@ namespace Volo.Abp.DynamicProxy //Act - var result = await target.GetValueAsync(); + var result = await target.GetValueAsync().ConfigureAwait(false); //Assert @@ -89,9 +90,9 @@ namespace Volo.Abp.DynamicProxy //Act & Assert - (await target.GetValueAsync(42)).ShouldBe(42); //First run, not cached yet - (await target.GetValueAsync(43)).ShouldBe(42); //First run, cached previous value - (await target.GetValueAsync(44)).ShouldBe(42); //First run, cached previous value + (await target.GetValueAsync(42).ConfigureAwait(false)).ShouldBe(42); //First run, not cached yet + (await target.GetValueAsync(43).ConfigureAwait(false)).ShouldBe(42); //First run, cached previous value + (await target.GetValueAsync(44).ConfigureAwait(false)).ShouldBe(42); //First run, cached previous value } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/CachedTestObject.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/CachedTestObject.cs index db06b78b6a..8c7a797c7b 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/CachedTestObject.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/CachedTestObject.cs @@ -12,8 +12,8 @@ namespace Volo.Abp.DynamicProxy } public virtual async Task GetValueAsync(int v) - { - await Task.Delay(5); + { + await Task.Delay(5).ConfigureAwait(false); return v; } } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs index 9427298e62..41438d1543 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs @@ -6,12 +6,12 @@ namespace Volo.Abp.DynamicProxy public class SimpleAsyncInterceptor : AbpInterceptor { public override async Task InterceptAsync(IAbpMethodInvocation invocation) - { - await Task.Delay(5); + { + await Task.Delay(5).ConfigureAwait(false); (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_InterceptAsync_BeforeInvocation"); - await invocation.ProceedAsync(); + await invocation.ProceedAsync().ConfigureAwait(false); (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_InterceptAsync_AfterInvocation"); - await Task.Delay(5); + await Task.Delay(5).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs index d1f23ea34c..e683e074d8 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs @@ -22,9 +22,9 @@ namespace Volo.Abp.DynamicProxy public virtual async Task GetValueAsync() { Logs.Add("EnterGetValueAsync"); - await Task.Delay(5); + await Task.Delay(5).ConfigureAwait(false); Logs.Add("MiddleGetValueAsync"); - await Task.Delay(5); + await Task.Delay(5).ConfigureAwait(false); Logs.Add("ExitGetValueAsync"); return 42; } @@ -32,9 +32,9 @@ namespace Volo.Abp.DynamicProxy public virtual async Task DoItAsync() { Logs.Add("EnterDoItAsync"); - await Task.Delay(5); + await Task.Delay(5).ConfigureAwait(false); Logs.Add("MiddleDoItAsync"); - await Task.Delay(5); + await Task.Delay(5).ConfigureAwait(false); Logs.Add("ExitDoItAsync"); } } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs index e5e4d39790..06c3d096fe 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs @@ -19,9 +19,9 @@ namespace Volo.Abp.DynamicProxy { invocation.ReturnValue = _cache[invocation.Method]; return; - } - - await invocation.ProceedAsync(); + } + + await invocation.ProceedAsync().ConfigureAwait(false); _cache[invocation.Method] = invocation.ReturnValue; } } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Threading/AsyncHelper_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Threading/AsyncHelper_Tests.cs index 1b7b7eacd2..53a4516560 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Threading/AsyncHelper_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Threading/AsyncHelper_Tests.cs @@ -41,12 +41,12 @@ namespace Volo.Abp.Threading private static async Task MyTaskWithoutReturnValueAsync() { - await Task.Delay(1); + await Task.Delay(1).ConfigureAwait(false); } private static async Task MyTaskWithReturnValueAsync(int aNumber) { - await Task.Delay(1); + await Task.Delay(1).ConfigureAwait(false); return aNumber; } diff --git a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/DapperTestBase.cs b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/DapperTestBase.cs index 3fa387cec2..2221bfd3e8 100644 --- a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/DapperTestBase.cs +++ b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/DapperTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.Dapper +using Volo.Abp.Testing; + +namespace Volo.Abp.Dapper { public abstract class DapperTestBase : AbpIntegratedTest { diff --git a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository.cs b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository.cs index 3621f9301e..f7a01649de 100644 --- a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository.cs +++ b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository.cs @@ -17,14 +17,14 @@ namespace Volo.Abp.Dapper.Repositories public virtual async Task> GetAllPersonNames() { - return (await DbConnection.QueryAsync("select Name from People", transaction: DbTransaction)) + return (await DbConnection.QueryAsync("select Name from People", transaction: DbTransaction).ConfigureAwait(false)) .ToList(); } public virtual async Task UpdatePersonNames(string name) { - return await DbConnection.ExecuteAsync("update People set Name = @NewName", new {NewName = name}, - DbTransaction); + return await DbConnection.ExecuteAsync("update People set Name = @NewName", new { NewName = name }, + DbTransaction).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository_Tests.cs b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository_Tests.cs index 28734c1fd0..cf085b2298 100644 --- a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository_Tests.cs +++ b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository_Tests.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.Dapper.Repositories [Fact] public async Task GetAllPersonNames_Test() { - var allNames = await GetRequiredService().GetAllPersonNames(); + var allNames = await GetRequiredService().GetAllPersonNames().ConfigureAwait(false); allNames.ShouldNotBeEmpty(); allNames.ShouldContain(x => x == "Douglas"); allNames.ShouldContain(x => x == "John-Deleted"); @@ -23,9 +23,9 @@ namespace Volo.Abp.Dapper.Repositories public async Task UpdatePersonNames_Test() { var personDapperRepository = GetRequiredService(); - await personDapperRepository.UpdatePersonNames("test"); + await personDapperRepository.UpdatePersonNames("test").ConfigureAwait(false); - var allNames = await personDapperRepository.GetAllPersonNames(); + var allNames = await personDapperRepository.GetAllPersonNames().ConfigureAwait(false); allNames.ShouldNotBeEmpty(); allNames.ShouldAllBe(x => x == "test"); } @@ -41,11 +41,11 @@ namespace Volo.Abp.Dapper.Repositories IsTransactional = true })) { - await personDapperRepository.UpdatePersonNames("test"); - await uow.RollbackAsync(); + await personDapperRepository.UpdatePersonNames("test").ConfigureAwait(false); + await uow.RollbackAsync().ConfigureAwait(false); } - var allNames = await personDapperRepository.GetAllPersonNames(); + var allNames = await personDapperRepository.GetAllPersonNames().ConfigureAwait(false); allNames.ShouldAllBe(x => x != "test"); } } diff --git a/framework/test/Volo.Abp.Data.Tests/Volo/Abp/Data/ConnectionStringResolver_Tests.cs b/framework/test/Volo.Abp.Data.Tests/Volo/Abp/Data/ConnectionStringResolver_Tests.cs index 4f4dabf36a..d13c89671e 100644 --- a/framework/test/Volo.Abp.Data.Tests/Volo/Abp/Data/ConnectionStringResolver_Tests.cs +++ b/framework/test/Volo.Abp.Data.Tests/Volo/Abp/Data/ConnectionStringResolver_Tests.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Data diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateRender_Tests.cs b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateRender_Tests.cs index 403aaad0bd..8c02b765e0 100644 --- a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateRender_Tests.cs +++ b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateRender_Tests.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Shouldly; using Volo.Abp.Emailing.Templates; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Emailing @@ -43,7 +44,7 @@ namespace Volo.Abp.Emailing } }; - var result = await _templateRender.RenderAsync(template, model); + var result = await _templateRender.RenderAsync(template, model).ConfigureAwait(false); result.ShouldBe("Hello john@abp.io 1:iphone,2:ipad,"); } diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateStore_Tests.cs b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateStore_Tests.cs index 1011232e57..90aa9563ea 100644 --- a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateStore_Tests.cs +++ b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateStore_Tests.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Shouldly; using Volo.Abp.Emailing.Templates; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Emailing @@ -23,21 +24,21 @@ namespace Volo.Abp.Emailing [Fact] public async Task Should_Get_Registered_Template() { - var template = await _emailTemplateProvider.GetAsync("template1", "tr"); + var template = await _emailTemplateProvider.GetAsync("template1", "tr").ConfigureAwait(false); template.Content.ShouldContain("Lütfen aşağıdaki bağlantıya tıklayarak e-posta adresinizi onaylayın."); } [Fact] public async Task Should_Get_Default_Culture_Template() { - var template = await _emailTemplateProvider.GetAsync("template1", "zh-Hans"); + var template = await _emailTemplateProvider.GetAsync("template1", "zh-Hans").ConfigureAwait(false); template.Content.ShouldContain("Please confirm your email address by clicking the link below."); } [Fact] public async Task Should_Get_Registered_Template_With_Layout() { - var template = await _emailTemplateProvider.GetAsync("template2", "en"); + var template = await _emailTemplateProvider.GetAsync("template2", "en").ConfigureAwait(false); template.Content.ShouldContain($"{Environment.NewLine} " + "Please confirm your email address by clicking the link below."); } @@ -46,7 +47,7 @@ namespace Volo.Abp.Emailing [Fact] public async Task Should_Get_Registered_Template_With_Localize() { - var template = await _emailTemplateProvider.GetAsync("template3", "tr"); + var template = await _emailTemplateProvider.GetAsync("template3", "tr").ConfigureAwait(false); template.Content.ShouldContain("Merhaba Abp"); } } diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs index c65cd8d7f4..1f69263f5c 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs @@ -19,12 +19,12 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext public async Task BuildAsync() { - await _bookRepository.InsertAsync( + await _bookRepository.InsertAsync( new BookInSecondDbContext( _guidGenerator.Create(), "TestBook1" ) - ); + ).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs index 7bc4af2e31..5ee320742c 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs @@ -31,7 +31,7 @@ namespace Volo.Abp.EntityFrameworkCore (_dummyRepository.GetDbContext() is IThirdDbContext).ShouldBeTrue(); (_dummyRepository.GetDbContext() is TestAppDbContext).ShouldBeTrue(); - await _unitOfWorkManager.Current.CompleteAsync(); + await _unitOfWorkManager.Current.CompleteAsync().ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/EntityFrameworkCoreTestBase.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/EntityFrameworkCoreTestBase.cs index 87bd7cfc28..f40cfcdddf 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/EntityFrameworkCoreTestBase.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/EntityFrameworkCoreTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.EntityFrameworkCore +using Volo.Abp.Testing; + +namespace Volo.Abp.EntityFrameworkCore { public abstract class EntityFrameworkCoreTestBase : AbpIntegratedTest { diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Repository_Queryable_Tests.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Repository_Queryable_Tests.cs index a5b8aa0577..d178ff7965 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Repository_Queryable_Tests.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Repository_Queryable_Tests.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.EntityFrameworkCore.Repositories { _bookRepository.Any().ShouldBeTrue(); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] @@ -40,7 +40,7 @@ namespace Volo.Abp.EntityFrameworkCore.Repositories { _phoneInSecondDbContextRepository.Any().ShouldBeTrue(); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] @@ -52,7 +52,7 @@ namespace Volo.Abp.EntityFrameworkCore.Repositories person.Name.ShouldBe("Douglas"); person.Phones.Count.ShouldBe(2); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Transactions/Transaction_Tests.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Transactions/Transaction_Tests.cs index 7d89da1a08..db4a376ae4 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Transactions/Transaction_Tests.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Transactions/Transaction_Tests.cs @@ -34,16 +34,16 @@ namespace Volo.Abp.EntityFrameworkCore.Transactions { await WithUnitOfWorkAsync(new AbpUnitOfWorkOptions { IsTransactional = true }, async () => { - await _personRepository.InsertAsync(new Person(personId, "Adam", 42)); + await _personRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); throw new Exception(exceptionMessage); - }); + }).ConfigureAwait(false); } catch (Exception e) when (e.Message == exceptionMessage) { } - var person = await _personRepository.FindAsync(personId); + var person = await _personRepository.FindAsync(personId).ConfigureAwait(false); person.ShouldBeNull(); } @@ -56,12 +56,12 @@ namespace Volo.Abp.EntityFrameworkCore.Transactions { _unitOfWorkManager.Current.ShouldNotBeNull(); - await _personRepository.InsertAsync(new Person(personId, "Adam", 42)); + await _personRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); - await _unitOfWorkManager.Current.RollbackAsync(); - }); + await _unitOfWorkManager.Current.RollbackAsync().ConfigureAwait(false); + }).ConfigureAwait(false); - var person = await _personRepository.FindAsync(personId); + var person = await _personRepository.FindAsync(personId).ConfigureAwait(false); person.ShouldBeNull(); } @@ -79,17 +79,17 @@ namespace Volo.Abp.EntityFrameworkCore.Transactions { _unitOfWorkManager.Current.ShouldNotBeNull(); - await _personRepository.InsertAsync(new Person(personId, "Adam", 42)); - await _bookRepository.InsertAsync(new BookInSecondDbContext(bookId, bookId.ToString())); + await _personRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); + await _bookRepository.InsertAsync(new BookInSecondDbContext(bookId, bookId.ToString())).ConfigureAwait(false); - await _unitOfWorkManager.Current.SaveChangesAsync(); + await _unitOfWorkManager.Current.SaveChangesAsync().ConfigureAwait(false); //Will automatically rollback since not called the Complete! } } - (await _personRepository.FindAsync(personId)).ShouldBeNull(); - (await _bookRepository.FindAsync(bookId)).ShouldBeNull(); + (await _personRepository.FindAsync(personId).ConfigureAwait(false)).ShouldBeNull(); + (await _bookRepository.FindAsync(bookId).ConfigureAwait(false)).ShouldBeNull(); } } } diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/CityRepository.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/CityRepository.cs index 027f54a03a..05becda1d3 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/CityRepository.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/CityRepository.cs @@ -18,13 +18,13 @@ namespace Volo.Abp.TestApp.EntityFrameworkCore public async Task FindByNameAsync(string name) { - return await this.FirstOrDefaultAsync(c => c.Name == name); + return await this.FirstOrDefaultAsync(c => c.Name == name).ConfigureAwait(false); } public async Task> GetPeopleInTheCityAsync(string cityName) { - var city = await FindByNameAsync(cityName); - return await DbContext.People.Where(p => p.CityId == city.Id).ToListAsync(); + var city = await FindByNameAsync(cityName).ConfigureAwait(false); + return await DbContext.People.Where(p => p.CityId == city.Id).ToListAsync().ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/PersonRepository.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/PersonRepository.cs index ab8c1920a7..01b949015a 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/PersonRepository.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/PersonRepository.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.TestApp.EntityFrameworkCore public async Task GetViewAsync(string name) { - return await DbContext.PersonView.Where(x => x.Name == name).FirstOrDefaultAsync(); + return await DbContext.PersonView.Where(x => x.Name == name).FirstOrDefaultAsync().ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBusTestBase.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBusTestBase.cs index d4e8df71aa..59e641d04f 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBusTestBase.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBusTestBase.cs @@ -1,3 +1,5 @@ +using Volo.Abp.Testing; + namespace Volo.Abp.EventBus.Distributed { public abstract class LocalDistributedEventBusTestBase : AbpIntegratedTest diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus_Test.cs index 47649ad3c3..19e61e5afb 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus_Test.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus_Test.cs @@ -10,9 +10,9 @@ namespace Volo.Abp.EventBus.Distributed { DistributedEventBus.Subscribe(); - await DistributedEventBus.PublishAsync(new MySimpleEventData(1)); - await DistributedEventBus.PublishAsync(new MySimpleEventData(2)); - await DistributedEventBus.PublishAsync(new MySimpleEventData(3)); + await DistributedEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); + await DistributedEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); + await DistributedEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); Assert.Equal(3, MySimpleDistributedTransientEventHandler.HandleCount); Assert.Equal(3, MySimpleDistributedTransientEventHandler.DisposeCount); diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/ActionBasedEventHandlerTest.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/ActionBasedEventHandlerTest.cs index 6e6bae2fae..8e41a26eae 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/ActionBasedEventHandlerTest.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/ActionBasedEventHandlerTest.cs @@ -19,10 +19,10 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); Assert.Equal(10, totalData); } @@ -39,10 +39,10 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(1)); - await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(2)); - await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(3)); - await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(4)); + await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(1)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(2)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(3)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(4)).ConfigureAwait(false); Assert.Equal(10, totalData); } @@ -59,13 +59,13 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); registerDisposer.Dispose(); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); Assert.Equal(6, totalData); } @@ -84,13 +84,13 @@ namespace Volo.Abp.EventBus.Local LocalEventBus.Subscribe(action); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); LocalEventBus.Unsubscribe(action); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); Assert.Equal(6, totalData); } @@ -103,15 +103,15 @@ namespace Volo.Abp.EventBus.Local LocalEventBus.Subscribe( async eventData => { - await Task.Delay(20); + await Task.Delay(20).ConfigureAwait(false); Interlocked.Add(ref totalData, eventData.Value); - await Task.Delay(20); + await Task.Delay(20).ConfigureAwait(false); }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); Assert.Equal(10, totalData); } diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBusTestBase.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBusTestBase.cs index b3a55c340b..f3040c1f65 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBusTestBase.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBusTestBase.cs @@ -1,3 +1,5 @@ +using Volo.Abp.Testing; + namespace Volo.Abp.EventBus.Local { public abstract class EventBusTestBase : AbpIntegratedTest diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_DI_Services_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_DI_Services_Test.cs index e66deb0e1c..4ae07d8dc6 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_DI_Services_Test.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_DI_Services_Test.cs @@ -9,10 +9,10 @@ namespace Volo.Abp.EventBus.Local [Fact] public async Task Should_Automatically_Register_EventHandlers_From_Services() { - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); GetRequiredService().TotalData.ShouldBe(10); } diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Test.cs index 446825c697..951a9f841d 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Test.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Test.cs @@ -14,8 +14,8 @@ namespace Volo.Abp.EventBus.Local var appException = await Assert.ThrowsAsync(async () => { - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); - }); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); + }).ConfigureAwait(false); appException.Message.ShouldBe("This exception is intentionally thrown!"); } @@ -31,8 +31,8 @@ namespace Volo.Abp.EventBus.Local var aggrException = await Assert.ThrowsAsync(async () => { - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); - }); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); + }).ConfigureAwait(false); aggrException.InnerExceptions.Count.ShouldBe(2); aggrException.InnerExceptions[0].Message.ShouldBe("This exception is intentionally thrown #1!"); diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_MultipleHandle_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_MultipleHandle_Test.cs index d20692fa01..5880dd3662 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_MultipleHandle_Test.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_MultipleHandle_Test.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.EventBus.Local LocalEventBus.Subscribe>(handler); LocalEventBus.Subscribe>(handler); - await LocalEventBus.PublishAsync(new EntityCreatedEventData(new MyEntity())); + await LocalEventBus.PublishAsync(new EntityCreatedEventData(new MyEntity())).ConfigureAwait(false); handler.EntityCreatedEventCount.ShouldBe(1); handler.EntityChangedEventCount.ShouldBe(1); diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/GenericInheritanceTest.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/GenericInheritanceTest.cs index eeec26b166..316de4a396 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/GenericInheritanceTest.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/GenericInheritanceTest.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new EntityUpdatedEventData(new Person(42))); + await LocalEventBus.PublishAsync(new EntityUpdatedEventData(new Person(42))).ConfigureAwait(false); triggeredEvent.ShouldBe(true); } @@ -39,7 +39,7 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new EntityChangedEventData(new Student(42))); + await LocalEventBus.PublishAsync(new EntityChangedEventData(new Student(42))).ConfigureAwait(false); triggeredEvent.ShouldBe(true); } diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/InheritanceTest.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/InheritanceTest.cs index c3b1dd4283..17474be1d9 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/InheritanceTest.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/InheritanceTest.cs @@ -17,10 +17,10 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); //Should handle directly registered class - await LocalEventBus.PublishAsync(new MySimpleEventData(2)); //Should handle directly registered class - await LocalEventBus.PublishAsync(new MyDerivedEventData(3)); //Should handle derived class too - await LocalEventBus.PublishAsync(new MyDerivedEventData(4)); //Should handle derived class too + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); //Should handle directly registered class + await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); //Should handle directly registered class + await LocalEventBus.PublishAsync(new MyDerivedEventData(3)).ConfigureAwait(false); //Should handle derived class too + await LocalEventBus.PublishAsync(new MyDerivedEventData(4)).ConfigureAwait(false); //Should handle derived class too Assert.Equal(10, totalData); } @@ -37,10 +37,10 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); //Should not handle - await LocalEventBus.PublishAsync(new MySimpleEventData(2)); //Should not handle - await LocalEventBus.PublishAsync(new MyDerivedEventData(3)); //Should handle - await LocalEventBus.PublishAsync(new MyDerivedEventData(4)); //Should handle + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); //Should not handle + await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); //Should not handle + await LocalEventBus.PublishAsync(new MyDerivedEventData(3)).ConfigureAwait(false); //Should handle + await LocalEventBus.PublishAsync(new MyDerivedEventData(4)).ConfigureAwait(false); //Should handle Assert.Equal(7, totalData); } diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/TransientDisposableEventHandlerTest.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/TransientDisposableEventHandlerTest.cs index 5ab7ed51af..bfc731f5bf 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/TransientDisposableEventHandlerTest.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/TransientDisposableEventHandlerTest.cs @@ -10,9 +10,9 @@ namespace Volo.Abp.EventBus.Local { LocalEventBus.Subscribe(); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); Assert.Equal(3, MySimpleTransientEventHandler.HandleCount); Assert.Equal(3, MySimpleTransientEventHandler.DisposeCount); diff --git a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureChecker_Tests.cs b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureChecker_Tests.cs index 7ea01268a0..dc849d9b50 100644 --- a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureChecker_Tests.cs +++ b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureChecker_Tests.cs @@ -20,16 +20,16 @@ namespace Volo.Abp.Features public async Task IsEnabledAsync() { //Tenant is unknown - (await _featureChecker.IsEnabledAsync("BooleanTestFeature1")).ShouldBeFalse(); + (await _featureChecker.IsEnabledAsync("BooleanTestFeature1").ConfigureAwait(false)).ShouldBeFalse(); using (_currentTenant.Change(TestFeatureStore.Tenant1Id)) { - (await _featureChecker.IsEnabledAsync("BooleanTestFeature1")).ShouldBeTrue(); + (await _featureChecker.IsEnabledAsync("BooleanTestFeature1").ConfigureAwait(false)).ShouldBeTrue(); } using (_currentTenant.Change(TestFeatureStore.Tenant2Id)) { - (await _featureChecker.IsEnabledAsync("BooleanTestFeature1")).ShouldBeFalse(); + (await _featureChecker.IsEnabledAsync("BooleanTestFeature1").ConfigureAwait(false)).ShouldBeFalse(); } } @@ -37,16 +37,16 @@ namespace Volo.Abp.Features public async Task GetOrNullAsync() { //Tenant is unknown - (await _featureChecker.GetOrNullAsync("IntegerTestFeature1")).ShouldBe("1"); + (await _featureChecker.GetOrNullAsync("IntegerTestFeature1").ConfigureAwait(false)).ShouldBe("1"); using (_currentTenant.Change(TestFeatureStore.Tenant1Id)) { - (await _featureChecker.GetOrNullAsync("IntegerTestFeature1")).ShouldBe("1"); + (await _featureChecker.GetOrNullAsync("IntegerTestFeature1").ConfigureAwait(false)).ShouldBe("1"); } using (_currentTenant.Change(TestFeatureStore.Tenant2Id)) { - (await _featureChecker.GetOrNullAsync("IntegerTestFeature1")).ShouldBe("34"); + (await _featureChecker.GetOrNullAsync("IntegerTestFeature1").ConfigureAwait(false)).ShouldBe("34"); } } } diff --git a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureInterceptor_Tests.cs b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureInterceptor_Tests.cs index bdc17a1d5f..eb10664239 100644 --- a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureInterceptor_Tests.cs +++ b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureInterceptor_Tests.cs @@ -29,18 +29,18 @@ namespace Volo.Abp.Features { await Assert.ThrowsAsync(async () => { - await _classFeatureTestService.NoAdditionalFeatureAsync(); - }); + await _classFeatureTestService.NoAdditionalFeatureAsync().ConfigureAwait(false); + }).ConfigureAwait(false); await Assert.ThrowsAsync(async () => { - await _classFeatureTestService.Feature2Async(); - }); + await _classFeatureTestService.Feature2Async().ConfigureAwait(false); + }).ConfigureAwait(false); await Assert.ThrowsAsync(async () => { - await _methodFeatureTestService.Feature1Async(); - }); + await _methodFeatureTestService.Feature1Async().ConfigureAwait(false); + }).ConfigureAwait(false); } } @@ -50,9 +50,9 @@ namespace Volo.Abp.Features //Features were enabled for Tenant 1 using (_currentTenant.Change(TestFeatureStore.Tenant1Id)) { - await _classFeatureTestService.NoAdditionalFeatureAsync(); - (await _classFeatureTestService.Feature2Async()).ShouldBe(42); - (await _methodFeatureTestService.Feature1Async()).ShouldBe(42); + await _classFeatureTestService.NoAdditionalFeatureAsync().ConfigureAwait(false); + (await _classFeatureTestService.Feature2Async().ConfigureAwait(false)).ShouldBe(42); + (await _methodFeatureTestService.Feature1Async().ConfigureAwait(false)).ShouldBe(42); } } @@ -64,7 +64,7 @@ namespace Volo.Abp.Features { using (_currentTenant.Change(ParseNullableGuid(tenantIdValue))) { - await _methodFeatureTestService.NonFeatureAsync(); + await _methodFeatureTestService.NonFeatureAsync().ConfigureAwait(false); } } diff --git a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureTestBase.cs b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureTestBase.cs index b12aa9f526..9bde61e1c4 100644 --- a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureTestBase.cs +++ b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.Features +using Volo.Abp.Testing; + +namespace Volo.Abp.Features { public class FeatureTestBase : AbpIntegratedTest { diff --git a/framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs b/framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs index 82541a5aa4..ba7a424ee7 100644 --- a/framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs +++ b/framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs @@ -6,6 +6,7 @@ using Shouldly; using Volo.Abp.Autofac; using Volo.Abp.DependencyInjection; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Volo.Abp.Validation; using Xunit; @@ -39,7 +40,7 @@ namespace Volo.Abp.FluentValidation { MyStringValue3 = "ccc" } - }); + }).ConfigureAwait(false); asyncOutput.ShouldBe("aaabbbccc"); } @@ -64,7 +65,7 @@ namespace Volo.Abp.FluentValidation } } ) - ); +.ConfigureAwait(false)).ConfigureAwait(false); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyStringValue")); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyMethodInput2.MyStringValue2")); @@ -82,7 +83,7 @@ namespace Volo.Abp.FluentValidation { MyStringValue3 = "c" } - })); + }).ConfigureAwait(false)).ConfigureAwait(false); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyStringValue")); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyMethodInput2.MyStringValue2")); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyMethodInput3.MyStringValue3")); @@ -94,7 +95,7 @@ namespace Volo.Abp.FluentValidation var output = await _myAppService.NotValidateMyMethod(new MyMethodInput4 { MyStringValue4 = "444" - }); + }).ConfigureAwait(false); output.ShouldBe("444"); } diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs index 0c75fc68ff..80a68e5a18 100644 --- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.Http.DynamicProxying { var firstPerson = (await _personRepository.GetListAsync()).First(); - var person = await _peopleAppService.GetAsync(firstPerson.Id); + var person = await _peopleAppService.GetAsync(firstPerson.Id).ConfigureAwait(false); person.ShouldNotBeNull(); person.Id.ShouldBe(firstPerson.Id); person.Name.ShouldBe(firstPerson.Name); @@ -38,7 +38,7 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task GetList() { - var people = await _peopleAppService.GetListAsync(new PagedAndSortedResultRequestDto()); + var people = await _peopleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false); people.TotalCount.ShouldBeGreaterThan(0); people.Items.Count.ShouldBe((int) people.TotalCount); } @@ -48,7 +48,7 @@ namespace Volo.Abp.Http.DynamicProxying { var firstPerson = (await _personRepository.GetListAsync()).First(); - await _peopleAppService.DeleteAsync(firstPerson.Id); + await _peopleAppService.DeleteAsync(firstPerson.Id).ConfigureAwait(false); firstPerson = (await _personRepository.GetListAsync()).FirstOrDefault(p => p.Id == firstPerson.Id); firstPerson.ShouldBeNull(); @@ -59,12 +59,12 @@ namespace Volo.Abp.Http.DynamicProxying { var uniquePersonName = Guid.NewGuid().ToString(); - var person = await _peopleAppService.CreateAsync(new PersonDto - { - Name = uniquePersonName, - Age = 42 - } - ); + var person = await _peopleAppService.CreateAsync(new PersonDto + { + Name = uniquePersonName, + Age = 42 + } + ).ConfigureAwait(false); person.ShouldNotBeNull(); person.Id.ShouldNotBe(Guid.Empty); @@ -89,7 +89,7 @@ namespace Volo.Abp.Http.DynamicProxying Name = uniquePersonName, Age = firstPerson.Age } - ); + ).ConfigureAwait(false); person.ShouldNotBeNull(); person.Id.ShouldBe(firstPerson.Id); @@ -108,8 +108,8 @@ namespace Volo.Abp.Http.DynamicProxying { await Assert.ThrowsAnyAsync(async () => { - await _peopleAppService.GetWithAuthorized(); - }); + await _peopleAppService.GetWithAuthorized().ConfigureAwait(false); + }).ConfigureAwait(false); } [Fact] @@ -128,7 +128,7 @@ namespace Volo.Abp.Http.DynamicProxying } } } - ); + ).ConfigureAwait(false); result.Value1.ShouldBe("value one"); result.Inner1.Value2.ShouldBe("value two"); diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_Tests.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_Tests.cs index cabbac6775..fdf422d585 100644 --- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_Tests.cs +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_Tests.cs @@ -20,41 +20,41 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task IncrementValueAsync() { - (await _controller.IncrementValueAsync(42)).ShouldBe(43); + (await _controller.IncrementValueAsync(42).ConfigureAwait(false)).ShouldBe(43); } [Fact] public async Task GetException1Async() { - var exception = await Assert.ThrowsAsync(async () => await _controller.GetException1Async()); + var exception = await Assert.ThrowsAsync(async () => await _controller.GetException1Async().ConfigureAwait(false)).ConfigureAwait(false); exception.Error.Message.ShouldBe("This is an error message!"); } [Fact] public async Task PostValueWithHeaderAndQueryStringAsync() { - var result = await _controller.PostValueWithHeaderAndQueryStringAsync("myheader", "myqs"); + var result = await _controller.PostValueWithHeaderAndQueryStringAsync("myheader", "myqs").ConfigureAwait(false); result.ShouldBe("myheader#myqs"); } [Fact] public async Task PostValueWithBodyAsync() { - var result = await _controller.PostValueWithBodyAsync("mybody"); + var result = await _controller.PostValueWithBodyAsync("mybody").ConfigureAwait(false); result.ShouldBe("mybody"); } [Fact] public async Task PutValueWithBodyAsync() { - var result = await _controller.PutValueWithBodyAsync("mybody"); + var result = await _controller.PutValueWithBodyAsync("mybody").ConfigureAwait(false); result.ShouldBe("mybody"); } [Fact] public async Task PostObjectWithBodyAsync() { - var result = await _controller.PostObjectWithBodyAsync(new Car{Year = 1976, Model = "Ford"}); + var result = await _controller.PostObjectWithBodyAsync(new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); result.Year.ShouldBe(1976); result.Model.ShouldBe("Ford"); } @@ -62,7 +62,7 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task PostObjectWithQueryAsync() { - var result = await _controller.PostObjectWithQueryAsync(new Car{Year = 1976, Model = "Ford"}); + var result = await _controller.PostObjectWithQueryAsync(new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); result.Year.ShouldBe(1976); result.Model.ShouldBe("Ford"); } @@ -70,7 +70,7 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task GetObjectWithUrlAsync() { - var result = await _controller.GetObjectWithUrlAsync(new Car{Year = 1976, Model = "Ford"}); + var result = await _controller.GetObjectWithUrlAsync(new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); result.Year.ShouldBe(1976); result.Model.ShouldBe("Ford"); } @@ -78,7 +78,7 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task GetObjectandIdAsync() { - var result = await _controller.GetObjectandIdAsync(42, new Car{Year = 1976, Model = "Ford"}); + var result = await _controller.GetObjectandIdAsync(42, new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); result.Year.ShouldBe(42); result.Model.ShouldBe("Ford"); } @@ -86,7 +86,7 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task GetObjectAndIdWithQueryAsync() { - var result = await _controller.GetObjectAndIdWithQueryAsync(42, new Car{Year = 1976, Model = "Ford"}); + var result = await _controller.GetObjectAndIdWithQueryAsync(42, new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); result.Year.ShouldBe(42); result.Model.ShouldBe("Ford"); } @@ -94,28 +94,28 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task PatchValueWithBodyAsync() { - var result = await _controller.PatchValueWithBodyAsync("mybody"); + var result = await _controller.PatchValueWithBodyAsync("mybody").ConfigureAwait(false); result.ShouldBe("mybody"); } [Fact] public async Task PutValueWithHeaderAndQueryStringAsync() { - var result = await _controller.PutValueWithHeaderAndQueryStringAsync("myheader", "myqs"); + var result = await _controller.PutValueWithHeaderAndQueryStringAsync("myheader", "myqs").ConfigureAwait(false); result.ShouldBe("myheader#myqs"); } [Fact] public async Task PatchValueWithHeaderAndQueryStringAsync() { - var result = await _controller.PatchValueWithHeaderAndQueryStringAsync("myheader", "myqs"); + var result = await _controller.PatchValueWithHeaderAndQueryStringAsync("myheader", "myqs").ConfigureAwait(false); result.ShouldBe("myheader#myqs"); } [Fact] public async Task DeleteByIdAsync() { - (await _controller.DeleteByIdAsync(42)).ShouldBe(43); + (await _controller.DeleteByIdAsync(42).ConfigureAwait(false)).ShouldBe(43); } } diff --git a/framework/test/Volo.Abp.Ldap.Tests/Volo/Abp/Ldap/Authenticate_Tests.cs b/framework/test/Volo.Abp.Ldap.Tests/Volo/Abp/Ldap/Authenticate_Tests.cs index c59dc0d9e1..bf11262a99 100644 --- a/framework/test/Volo.Abp.Ldap.Tests/Volo/Abp/Ldap/Authenticate_Tests.cs +++ b/framework/test/Volo.Abp.Ldap.Tests/Volo/Abp/Ldap/Authenticate_Tests.cs @@ -1,6 +1,7 @@ using System; using Shouldly; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Ldap diff --git a/framework/test/Volo.Abp.Ldap.Tests/Volo/Abp/Ldap/LdapManager_Tests.cs b/framework/test/Volo.Abp.Ldap.Tests/Volo/Abp/Ldap/LdapManager_Tests.cs index 01906c8f18..3e83d26543 100644 --- a/framework/test/Volo.Abp.Ldap.Tests/Volo/Abp/Ldap/LdapManager_Tests.cs +++ b/framework/test/Volo.Abp.Ldap.Tests/Volo/Abp/Ldap/LdapManager_Tests.cs @@ -1,6 +1,7 @@ using System; using Shouldly; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Ldap diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs index 46f34e054d..5608ca0a80 100644 --- a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs +++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs @@ -7,6 +7,7 @@ using Volo.Abp.Localization.TestResources.Base.CountryNames; using Volo.Abp.Localization.TestResources.Base.Validation; using Volo.Abp.Localization.TestResources.Source; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Volo.Abp.VirtualFileSystem; using Xunit; @@ -50,24 +51,24 @@ namespace Volo.Abp.Localization [Fact] public void Should_Get_Localized_Text_If_Defined_In_Current_Culture() { - using (AbpCultureHelper.Use("en")) + using (CultureHelper.Use("en")) { _localizer["Car"].Value.ShouldBe("Car"); _localizer["CarPlural"].Value.ShouldBe("Cars"); } - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { _localizer["Car"].Value.ShouldBe("Araba"); _localizer["CarPlural"].Value.ShouldBe("Araba"); } - using (AbpCultureHelper.Use("it")) + using (CultureHelper.Use("it")) { _localizer["Car"].Value.ShouldBe("Auto"); } - using (AbpCultureHelper.Use("es")) + using (CultureHelper.Use("es")) { _localizer["Car"].Value.ShouldBe("Auto"); } @@ -77,22 +78,22 @@ namespace Volo.Abp.Localization [Fact] public void Should_Get_Extension_Texts() { - using (AbpCultureHelper.Use("en")) + using (CultureHelper.Use("en")) { _localizer["SeeYou"].Value.ShouldBe("See you"); } - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { _localizer["SeeYou"].Value.ShouldBe("See you"); //Not defined in tr, getting from default lang } - using (AbpCultureHelper.Use("it")) + using (CultureHelper.Use("it")) { _localizer["SeeYou"].Value.ShouldBe("Ci vediamo"); } - using (AbpCultureHelper.Use("es")) + using (CultureHelper.Use("es")) { _localizer["SeeYou"].Value.ShouldBe("Nos vemos"); } @@ -102,7 +103,7 @@ namespace Volo.Abp.Localization [Fact] public void Should_Get_From_Inherited_Texts() { - using (AbpCultureHelper.Use("en")) + using (CultureHelper.Use("en")) { _localizer["USA"].Value.ShouldBe("United States of America"); //Inherited from CountryNames/en.json _localizer["ThisFieldIsRequired"].Value.ShouldBe("This field is required"); //Inherited from Validation/en.json @@ -110,12 +111,12 @@ namespace Volo.Abp.Localization _localizer.GetAllStrings().ShouldContain(ls => ls.Name == "USA"); } - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { _localizer["USA"].Value.ShouldBe("Amerika Birleşik Devletleri"); //Inherited from CountryNames/tr.json } - using (AbpCultureHelper.Use("es")) + using (CultureHelper.Use("es")) { _localizer["USA"].Value.ShouldBe("Estados unidos de América"); //Inherited from CountryNames/es.json _localizer["ThisFieldIsRequired"].Value.ShouldBe("El campo no puede estar vacío"); //Inherited from Validation/es.json @@ -128,12 +129,12 @@ namespace Volo.Abp.Localization [Fact] public void Should_Override_Inherited_Text() { - using (AbpCultureHelper.Use("en")) + using (CultureHelper.Use("en")) { _localizer["MaxLenghtErrorMessage", 42].Value.ShouldBe("This field's length can be maximum of '42' chars"); //Overriden in Source/en.json } - using (AbpCultureHelper.Use("es")) + using (CultureHelper.Use("es")) { _localizer["MaxLenghtErrorMessage", 42].Value.ShouldBe("El campo puede tener un máximo de '42' caracteres"); //Overriden in Source/es.json } @@ -144,21 +145,38 @@ namespace Volo.Abp.Localization [Fact] public void Should_Get_Localized_Text_If_Defined_In_Requested_Culture() { - _localizer.WithCulture(CultureInfo.GetCultureInfo("en"))["Car"].Value.ShouldBe("Car"); - _localizer.WithCulture(CultureInfo.GetCultureInfo("en"))["CarPlural"].Value.ShouldBe("Cars"); - - _localizer.WithCulture(CultureInfo.GetCultureInfo("tr"))["Car"].Value.ShouldBe("Araba"); - _localizer.WithCulture(CultureInfo.GetCultureInfo("tr"))["CarPlural"].Value.ShouldBe("Araba"); + using (CultureHelper.Use(CultureInfo.GetCultureInfo("en"))) + { + _localizer["Car"].Value.ShouldBe("Car"); + } + using (CultureHelper.Use(CultureInfo.GetCultureInfo("en"))) + { + _localizer["CarPlural"].Value.ShouldBe("Cars"); + } - _localizer.WithCulture(CultureInfo.GetCultureInfo("es"))["Car"].Value.ShouldBe("Auto"); - _localizer.WithCulture(CultureInfo.GetCultureInfo("es"))["CarPlural"].Value.ShouldBe("Autos"); + using (CultureHelper.Use(CultureInfo.GetCultureInfo("tr"))) + { + _localizer["Car"].Value.ShouldBe("Araba"); + } + using (CultureHelper.Use(CultureInfo.GetCultureInfo("tr"))) + { + _localizer["CarPlural"].Value.ShouldBe("Araba"); + } + using (CultureHelper.Use(CultureInfo.GetCultureInfo("es"))) + { + _localizer["Car"].Value.ShouldBe("Auto"); + } + using (CultureHelper.Use(CultureInfo.GetCultureInfo("es"))) + { + _localizer["CarPlural"].Value.ShouldBe("Autos"); + } } [Fact] public void GetAllStrings_With_Parents() { - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { var localizedStrings = _localizer.GetAllStrings(true).ToList(); @@ -175,7 +193,7 @@ namespace Volo.Abp.Localization ); } - using (AbpCultureHelper.Use("es")) + using (CultureHelper.Use("es")) { var localizedStrings = _localizer.GetAllStrings(true).ToList(); @@ -197,7 +215,7 @@ namespace Volo.Abp.Localization [Fact] public void GetAllStrings_Without_Parents() { - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { var localizedStrings = _localizer.GetAllStrings(false).ToList(); @@ -212,7 +230,7 @@ namespace Volo.Abp.Localization ); } - using (AbpCultureHelper.Use("es")) + using (CultureHelper.Use("es")) { var localizedStrings = _localizer.GetAllStrings(false).ToList(); @@ -232,7 +250,7 @@ namespace Volo.Abp.Localization [Fact] public void GetAllStrings_With_Inheritance() { - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { var localizedStrings = _localizer .GetAllStrings(true, includeBaseLocalizers: true) @@ -261,7 +279,7 @@ namespace Volo.Abp.Localization [Fact] public void GetAllStrings_Without_Inheritance() { - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { var localizedStrings = _localizer .GetAllStrings(true, includeBaseLocalizers: false) diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TemplateLocalizer_Tests.cs b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TemplateLocalizer_Tests.cs index 3ba7a2937b..4b31554637 100644 --- a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TemplateLocalizer_Tests.cs +++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TemplateLocalizer_Tests.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Localization; using Shouldly; using Volo.Abp.Localization.TestResources.Source; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Volo.Abp.VirtualFileSystem; using Xunit; @@ -22,7 +23,7 @@ namespace Volo.Abp.Localization [Fact] public void Should_Localize() { - using (AbpCultureHelper.Use("en")) + using (CultureHelper.Use("en")) { _templateLocalizer.Localize(_testResource, "

    {{#L:CarPlural}} {{#L:Universe}}

    ") .ShouldBe("

    Cars Universe

    "); @@ -32,7 +33,7 @@ namespace Volo.Abp.Localization [Fact] public void Should_Work_Even_If_No_Text_To_Localize() { - using (AbpCultureHelper.Use("en")) + using (CultureHelper.Use("en")) { _templateLocalizer.Localize(_testResource, "

    test

    ") .ShouldBe("

    test

    "); diff --git a/framework/test/Volo.Abp.MailKit.Tests/Volo/Abp/MailKit/MailKitSmtpEmailSender_Tests.cs b/framework/test/Volo.Abp.MailKit.Tests/Volo/Abp/MailKit/MailKitSmtpEmailSender_Tests.cs index de9acb3a0e..e323b1150e 100644 --- a/framework/test/Volo.Abp.MailKit.Tests/Volo/Abp/MailKit/MailKitSmtpEmailSender_Tests.cs +++ b/framework/test/Volo.Abp.MailKit.Tests/Volo/Abp/MailKit/MailKitSmtpEmailSender_Tests.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using NSubstitute; using Volo.Abp.BackgroundJobs; using Volo.Abp.Emailing.Smtp; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.MailKit @@ -17,7 +18,7 @@ namespace Volo.Abp.MailKit var mailMessage = new MailMessage("from_mail_address@asd.com", "to_mail_address@asd.com", "subject", "body") { IsBodyHtml = true }; - await mailSender.SendAsync(mailMessage); + await mailSender.SendAsync(mailMessage).ConfigureAwait(false); } //[Fact] @@ -29,7 +30,7 @@ namespace Volo.Abp.MailKit IsBodyHtml = true }; - await mailSender.SendAsync(mailMessage); + await mailSender.SendAsync(mailMessage).ConfigureAwait(false); } private static MailKitSmtpEmailSender CreateMailKitEmailSender() diff --git a/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/MemoryDbTestBase.cs b/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/MemoryDbTestBase.cs index 8d818bb32c..c539f66ca1 100644 --- a/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/MemoryDbTestBase.cs +++ b/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/MemoryDbTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.MemoryDb +using Volo.Abp.Testing; + +namespace Volo.Abp.MemoryDb { public abstract class MemoryDbTestBase : AbpIntegratedTest { diff --git a/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/TestApp/MemoryDb/CityRepository.cs b/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/TestApp/MemoryDb/CityRepository.cs index b6d43dc875..c83a28871f 100644 --- a/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/TestApp/MemoryDb/CityRepository.cs +++ b/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/TestApp/MemoryDb/CityRepository.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.TestApp.MemoryDb public async Task> GetPeopleInTheCityAsync(string cityName) { - var city = await FindByNameAsync(cityName); + var city = await FindByNameAsync(cityName).ConfigureAwait(false); return Database.Collection().Where(p => p.CityId == city.Id).ToList(); } diff --git a/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/CssMinifier_Tests.cs b/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/CssMinifier_Tests.cs index c71be3450b..59bc8cd425 100644 --- a/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/CssMinifier_Tests.cs +++ b/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/CssMinifier_Tests.cs @@ -1,5 +1,6 @@ using Shouldly; using Volo.Abp.Minify.Styles; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Minify.NUglify diff --git a/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/HtmlMinifier_Tests.cs b/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/HtmlMinifier_Tests.cs index 88da207d0c..bba7707be7 100644 --- a/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/HtmlMinifier_Tests.cs +++ b/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/HtmlMinifier_Tests.cs @@ -1,5 +1,6 @@ using Shouldly; using Volo.Abp.Minify.Html; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Minify.NUglify diff --git a/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/JavascriptMinifier_Tests.cs b/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/JavascriptMinifier_Tests.cs index 7ebcd65fc3..6526d0b483 100644 --- a/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/JavascriptMinifier_Tests.cs +++ b/framework/test/Volo.Abp.Minify.Tests/Volo/Abp/Minify/NUglify/JavascriptMinifier_Tests.cs @@ -1,5 +1,6 @@ using Shouldly; using Volo.Abp.Minify.Scripts; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Minify.NUglify diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/MongoDbTestBase.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/MongoDbTestBase.cs index 22cae9b7d6..53e101647a 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/MongoDbTestBase.cs +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/MongoDbTestBase.cs @@ -1,3 +1,5 @@ +using Volo.Abp.Testing; + namespace Volo.Abp.MongoDB { public abstract class MongoDbTestBase : AbpIntegratedTest diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs index efa64b3617..7458f85417 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs @@ -19,20 +19,20 @@ namespace Volo.Abp.MongoDB.Repositories PersonRepository.FirstOrDefault(p => p.Name == "Douglas").ShouldNotBeNull(); PersonRepository.Count().ShouldBeGreaterThan(0); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] public async Task UpdateAsync() { - var person = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + var person = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); person.ChangeName("Douglas-Updated"); person.Phones.Add(new Phone(person.Id, "6667778899", PhoneType.Office)); - await PersonRepository.UpdateAsync(person); + await PersonRepository.UpdateAsync(person).ConfigureAwait(false); - person = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + person = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); person.ShouldNotBeNull(); person.Name.ShouldBe("Douglas-Updated"); person.Phones.Count.ShouldBe(3); @@ -45,9 +45,9 @@ namespace Volo.Abp.MongoDB.Repositories var person = new Person(Guid.NewGuid(), "New Person", 35); person.Phones.Add(new Phone(person.Id, "1234567890")); - await PersonRepository.InsertAsync(person); + await PersonRepository.InsertAsync(person).ConfigureAwait(false); - person = await PersonRepository.FindAsync(person.Id); + person = await PersonRepository.FindAsync(person.Id).ConfigureAwait(false); person.ShouldNotBeNull(); person.Name.ShouldBe("New Person"); person.Phones.Count.ShouldBe(1); diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/TestApp/MongoDb/CityRepository.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/TestApp/MongoDb/CityRepository.cs index bb31883010..27381a14da 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/TestApp/MongoDb/CityRepository.cs +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/TestApp/MongoDb/CityRepository.cs @@ -19,13 +19,13 @@ namespace Volo.Abp.TestApp.MongoDB public async Task FindByNameAsync(string name) { - return await (await Collection.FindAsync(c => c.Name == name)).FirstOrDefaultAsync(); + return await (await Collection.FindAsync(c => c.Name == name).ConfigureAwait(false)).FirstOrDefaultAsync().ConfigureAwait(false); } public async Task> GetPeopleInTheCityAsync(string cityName) { - var city = await FindByNameAsync(cityName); - return await DbContext.People.AsQueryable().Where(p => p.CityId == city.Id).ToListAsync(); + var city = await FindByNameAsync(cityName).ConfigureAwait(false); + return await DbContext.People.AsQueryable().Where(p => p.CityId == city.Id).ToListAsync().ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.MultiTenancy.Tests/Volo/Abp/MultiTenancy/MultiTenancyTestBase.cs b/framework/test/Volo.Abp.MultiTenancy.Tests/Volo/Abp/MultiTenancy/MultiTenancyTestBase.cs index 7480ae01c2..a0b2d663bc 100644 --- a/framework/test/Volo.Abp.MultiTenancy.Tests/Volo/Abp/MultiTenancy/MultiTenancyTestBase.cs +++ b/framework/test/Volo.Abp.MultiTenancy.Tests/Volo/Abp/MultiTenancy/MultiTenancyTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.MultiTenancy +using Volo.Abp.Testing; + +namespace Volo.Abp.MultiTenancy { public class MultiTenancyTestBase : AbpIntegratedTest { diff --git a/framework/test/Volo.Abp.ObjectMapping.Tests/Volo/Abp/ObjectMapping/AbpObjectMappingTestBase.cs b/framework/test/Volo.Abp.ObjectMapping.Tests/Volo/Abp/ObjectMapping/AbpObjectMappingTestBase.cs index 9ba65b5a10..334bb99669 100644 --- a/framework/test/Volo.Abp.ObjectMapping.Tests/Volo/Abp/ObjectMapping/AbpObjectMappingTestBase.cs +++ b/framework/test/Volo.Abp.ObjectMapping.Tests/Volo/Abp/ObjectMapping/AbpObjectMappingTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.ObjectMapping +using Volo.Abp.Testing; + +namespace Volo.Abp.ObjectMapping { public abstract class AbpObjectMappingTestBase : AbpIntegratedTest { diff --git a/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Encryption/StringEncryptionService_Tests.cs b/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Encryption/StringEncryptionService_Tests.cs index 455e0863bb..53127bbe76 100644 --- a/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Encryption/StringEncryptionService_Tests.cs +++ b/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Encryption/StringEncryptionService_Tests.cs @@ -1,4 +1,5 @@ using Shouldly; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Security.Encryption diff --git a/framework/test/Volo.Abp.Serialization.Tests/Volo/Abp/Serialization/ObjectSerializer_Tests.cs b/framework/test/Volo.Abp.Serialization.Tests/Volo/Abp/Serialization/ObjectSerializer_Tests.cs index e2519a89d3..59dc8ce6c8 100644 --- a/framework/test/Volo.Abp.Serialization.Tests/Volo/Abp/Serialization/ObjectSerializer_Tests.cs +++ b/framework/test/Volo.Abp.Serialization.Tests/Volo/Abp/Serialization/ObjectSerializer_Tests.cs @@ -1,5 +1,6 @@ using Shouldly; using Volo.Abp.Serialization.Objects; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Serialization diff --git a/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingProvider_Tests.cs b/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingProvider_Tests.cs index c3c22f76f9..47df3f6db1 100644 --- a/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingProvider_Tests.cs +++ b/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingProvider_Tests.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Shouldly; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Settings @@ -21,14 +22,14 @@ namespace Volo.Abp.Settings [Fact] public async Task Should_Get_Null_If_No_Value_Provided_And_No_Default_Value() { - (await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithoutDefaultValue)) + (await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithoutDefaultValue).ConfigureAwait(false)) .ShouldBeNull(); } [Fact] public async Task Should_Get_Default_Value_If_No_Value_Provided_And_There_Is_A_Default_Value() { - (await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithDefaultValue)) + (await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithDefaultValue).ConfigureAwait(false)) .ShouldBe("default-value"); } } diff --git a/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs b/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs index 0da6d4c8dc..fc38b437b8 100644 --- a/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs +++ b/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs @@ -31,17 +31,17 @@ namespace Volo.Abp.TestApp.Application [Fact] public async Task GetList() { - var people = await _peopleAppService.GetListAsync(new PagedAndSortedResultRequestDto()); + var people = await _peopleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false); people.Items.Count.ShouldBeGreaterThan(0); } [Fact] public async Task Create() { - var personDto = await _peopleAppService.CreateAsync(new PersonDto()); + var personDto = await _peopleAppService.CreateAsync(new PersonDto()).ConfigureAwait(false); var repository = ServiceProvider.GetService>(); - var person = await repository.FindAsync(personDto.Id); + var person = await repository.FindAsync(personDto.Id).ConfigureAwait(false); person.ShouldNotBeNull(); person.TenantId.ShouldBeNull(); @@ -52,10 +52,10 @@ namespace Volo.Abp.TestApp.Application { _fakeCurrentTenant.Id.Returns(TestDataBuilder.TenantId1); - var personDto = await _peopleAppService.CreateAsync(new PersonDto()); + var personDto = await _peopleAppService.CreateAsync(new PersonDto()).ConfigureAwait(false); var repository = ServiceProvider.GetService>(); - var person = await repository.FindAsync(personDto.Id); + var person = await repository.FindAsync(personDto.Id).ConfigureAwait(false); person.ShouldNotBeNull(); person.TenantId.ShouldNotBeNull(); diff --git a/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/TestAppTestBase.cs b/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/TestAppTestBase.cs index 589b42a21c..2903ec905a 100644 --- a/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/TestAppTestBase.cs +++ b/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/TestAppTestBase.cs @@ -1,3 +1,5 @@ +using Volo.Abp.Testing; + namespace Volo.Abp.TestApp { public class TestAppTestBase : AbpIntegratedTest diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs index 522f8d9794..6d5c2136f3 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.TestApp.Application public async Task> GetPhones(Guid id, GetPersonPhonesFilter filter) { - var phones = (await GetEntityByIdAsync(id)).Phones + var phones = (await GetEntityByIdAsync(id).ConfigureAwait(false)).Phones .WhereIf(filter.Type.HasValue, p => p.Type == filter.Type) .ToList(); @@ -32,19 +32,19 @@ namespace Volo.Abp.TestApp.Application public async Task AddPhone(Guid id, PhoneDto phoneDto) { - var person = await GetEntityByIdAsync(id); + var person = await GetEntityByIdAsync(id).ConfigureAwait(false); var phone = new Phone(person.Id, phoneDto.Number, phoneDto.Type); person.Phones.Add(phone); - await Repository.UpdateAsync(person); + await Repository.UpdateAsync(person).ConfigureAwait(false); return ObjectMapper.Map(phone); } public async Task RemovePhone(Guid id, string number) { - var person = await GetEntityByIdAsync(id); + var person = await GetEntityByIdAsync(id).ConfigureAwait(false); person.Phones.RemoveAll(p => p.Number == number); - await Repository.UpdateAsync(person); + await Repository.UpdateAsync(person).ConfigureAwait(false); } [Authorize] diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs index a11ba60639..7e2be35de0 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs @@ -32,9 +32,9 @@ namespace Volo.Abp.TestApp public async Task BuildAsync() { - await AddCities(); - await AddPeople(); - await AddEntitiesWithPks(); + await AddCities().ConfigureAwait(false); + await AddPeople().ConfigureAwait(false); + await AddEntitiesWithPks().ConfigureAwait(false); } private async Task AddCities() @@ -44,17 +44,17 @@ namespace Volo.Abp.TestApp istanbul.Districts.Add(new District(istanbul.Id, "Mecidiyeköy", 2222321)); istanbul.Districts.Add(new District(istanbul.Id, "Uskudar", 726172)); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Tokyo")); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Madrid")); - await _cityRepository.InsertAsync(new City(LondonCityId, "London") {ExtraProperties = { { "Population", 10_470_000 } } }); - await _cityRepository.InsertAsync(istanbul); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Paris")); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Washington")); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Sao Paulo")); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Berlin")); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Amsterdam")); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Beijing")); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Rome")); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Tokyo")).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Madrid")).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(LondonCityId, "London") { ExtraProperties = { { "Population", 10_470_000 } } }).ConfigureAwait(false); + await _cityRepository.InsertAsync(istanbul).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Paris")).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Washington")).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Sao Paulo")).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Berlin")).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Amsterdam")).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Beijing")).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Rome")).ConfigureAwait(false); } private async Task AddPeople() @@ -63,20 +63,20 @@ namespace Volo.Abp.TestApp douglas.Phones.Add(new Phone(douglas.Id, "123456789")); douglas.Phones.Add(new Phone(douglas.Id, "123456780", PhoneType.Home)); - await _personRepository.InsertAsync(douglas); + await _personRepository.InsertAsync(douglas).ConfigureAwait(false); - await _personRepository.InsertAsync(new Person(UserJohnDeletedId, "John-Deleted", 33) { IsDeleted = true }); + await _personRepository.InsertAsync(new Person(UserJohnDeletedId, "John-Deleted", 33) { IsDeleted = true }).ConfigureAwait(false); var tenant1Person1 = new Person(Guid.NewGuid(), TenantId1 + "-Person1", 42, TenantId1); var tenant1Person2 = new Person(Guid.NewGuid(), TenantId1 + "-Person2", 43, TenantId1); - await _personRepository.InsertAsync(tenant1Person1); - await _personRepository.InsertAsync(tenant1Person2); + await _personRepository.InsertAsync(tenant1Person1).ConfigureAwait(false); + await _personRepository.InsertAsync(tenant1Person2).ConfigureAwait(false); } private async Task AddEntitiesWithPks() { - await _entityWithIntPksRepository.InsertAsync(new EntityWithIntPk("Entity1")); + await _entityWithIntPksRepository.InsertAsync(new EntityWithIntPk("Entity1")).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/AbpDateTimeValueConverter_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/AbpDateTimeValueConverter_Tests.cs index e36225e53c..782f61830a 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/AbpDateTimeValueConverter_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/AbpDateTimeValueConverter_Tests.cs @@ -28,9 +28,9 @@ namespace Volo.Abp.TestApp.Testing { Birthday = DateTime.Parse("2020-01-01 00:00:00"), LastActive = DateTime.Parse("2020-01-01 00:00:00"), - }, true); + }, true).ConfigureAwait(false); - var person = await _personRepository.GetAsync(personId); + var person = await _personRepository.GetAsync(personId).ConfigureAwait(false); person.ShouldNotBeNull(); person.CreationTime.Kind.ShouldBe(DateTimeKind.Utc); @@ -53,9 +53,9 @@ namespace Volo.Abp.TestApp.Testing { Birthday = DateTime.Parse("2020-01-01 00:00:00"), LastActive = DateTime.Parse("2020-01-01 00:00:00"), - }, true); + }, true).ConfigureAwait(false); - var person = await _personRepository.GetViewAsync(personName); + var person = await _personRepository.GetViewAsync(personName).ConfigureAwait(false); person.ShouldNotBeNull(); person.CreationTime.Kind.ShouldBe(DateTimeKind.Utc); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Auditing_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Auditing_Tests.cs index 41ef7ce076..dcbfdaf045 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Auditing_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Auditing_Tests.cs @@ -49,9 +49,9 @@ namespace Volo.Abp.TestApp.Testing var personId = Guid.NewGuid(); - await PersonRepository.InsertAsync(new Person(personId, "Adam", 42)); + await PersonRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); - var person = await PersonRepository.FindAsync(personId); + var person = await PersonRepository.FindAsync(personId).ConfigureAwait(false); person.ShouldNotBeNull(); person.CreationTime.ShouldBeLessThanOrEqualTo(Clock.Now); @@ -68,14 +68,14 @@ namespace Volo.Abp.TestApp.Testing CurrentUserId = Guid.Parse(currentUserId); } - var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); douglas.LastModificationTime.ShouldBeNull(); douglas.Age++; - await PersonRepository.UpdateAsync(douglas); + await PersonRepository.UpdateAsync(douglas).ConfigureAwait(false); - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); douglas.ShouldNotBeNull(); douglas.LastModificationTime.ShouldNotBeNull(); @@ -93,17 +93,17 @@ namespace Volo.Abp.TestApp.Testing CurrentUserId = Guid.Parse(currentUserId); } - var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); - await PersonRepository.DeleteAsync(douglas); + await PersonRepository.DeleteAsync(douglas).ConfigureAwait(false); - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); douglas.ShouldBeNull(); using (DataFilter.Disable()) { - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); douglas.ShouldNotBeNull(); douglas.DeletionTime.ShouldNotBeNull(); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs index 2c5a5d89ab..1f7c927251 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs @@ -20,37 +20,37 @@ namespace Volo.Abp.TestApp.Testing public async Task Should_Not_Allow_To_Update_If_The_Entity_Has_Changed() { //Got an entity from database, changed its value, but not updated in the database yet - var london1 = await CityRepository.FindByNameAsync("London"); + var london1 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); london1.Name = "London-1"; //Another user has changed it just before I update - var london2 = await CityRepository.FindByNameAsync("London"); + var london2 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); london2.Name = "London-2"; - await CityRepository.UpdateAsync(london2); + await CityRepository.UpdateAsync(london2).ConfigureAwait(false); //And updating my old entity throws exception! await Assert.ThrowsAsync(async () => { - await CityRepository.UpdateAsync(london1); - }); + await CityRepository.UpdateAsync(london1).ConfigureAwait(false); + }).ConfigureAwait(false); } [Fact] public async Task Should_Not_Allow_To_Delete_If_The_Entity_Has_Changed() { //Got an entity from database, but not deleted in the database yet - var london1 = await CityRepository.FindByNameAsync("London"); + var london1 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); //Another user has changed it just before I delete - var london2 = await CityRepository.FindByNameAsync("London"); + var london2 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); london2.Name = "London-updated"; - await CityRepository.UpdateAsync(london2); + await CityRepository.UpdateAsync(london2).ConfigureAwait(false); //And deleting my old entity throws exception! await Assert.ThrowsAsync(async () => { - await CityRepository.DeleteAsync(london1); - }); + await CityRepository.DeleteAsync(london1).ConfigureAwait(false); + }).ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/DomainEvents_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/DomainEvents_Tests.cs index 3ca7eaf8e4..2c6982de6a 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/DomainEvents_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/DomainEvents_Tests.cs @@ -55,8 +55,8 @@ namespace Volo.Abp.TestApp.Testing { var dougles = PersonRepository.Single(b => b.Name == "Douglas"); dougles.ChangeName("Douglas-Changed"); - await PersonRepository.UpdateAsync(dougles); - }); + await PersonRepository.UpdateAsync(dougles).ConfigureAwait(false); + }).ConfigureAwait(false); //Assert diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs index fe4e0862f3..bc38257683 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs @@ -75,9 +75,9 @@ namespace Volo.Abp.TestApp.Testing return Task.CompletedTask; }); - await PersonRepository.InsertAsync(new Person(Guid.NewGuid(), personName, 15)); + await PersonRepository.InsertAsync(new Person(Guid.NewGuid(), personName, 15)).ConfigureAwait(false); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } creatingEventTriggered.ShouldBeTrue(); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs index 67eff13572..a52ddbee3a 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Get_An_Extra_Property() { - var london = await CityRepository.FindByNameAsync("London"); + var london = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); london.HasProperty("Population").ShouldBeTrue(); london.GetProperty("Population").ShouldBe(10_470_000); } @@ -28,11 +28,11 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Add_An_Extra_Property() { - var london = await CityRepository.FindByNameAsync("London"); + var london = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); london.SetProperty("AreaAsKm", 1572); - await CityRepository.UpdateAsync(london); + await CityRepository.UpdateAsync(london).ConfigureAwait(false); - var london2 = await CityRepository.FindByNameAsync("London"); + var london2 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); london2.HasProperty("AreaAsKm").ShouldBeTrue(); london2.GetProperty("AreaAsKm").ShouldBe(1572); } @@ -40,12 +40,12 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Update_An_Existing_Extra_Property() { - var london = await CityRepository.FindByNameAsync("London"); + var london = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); london.ExtraProperties["Population"] = 11_000_042; - await CityRepository.UpdateAsync(london); + await CityRepository.UpdateAsync(london).ConfigureAwait(false); - var london2 = await CityRepository.FindByNameAsync("London"); + var london2 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); london2.HasProperty("Population").ShouldBeTrue(); london2.GetProperty("Population").ShouldBe(11_000_042); } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Creation_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Creation_Tests.cs index c648fc66d4..af910aefba 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Creation_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Creation_Tests.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; using Microsoft.Extensions.DependencyInjection; using NSubstitute; using Shouldly; -using Volo.Abp.Data; using Volo.Abp.Domain.Repositories; using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy; @@ -45,9 +42,9 @@ namespace Volo.Abp.TestApp.Testing Id = personId, Name = "Person1", Age = 21 - }); + }).ConfigureAwait(false); - var person = await _personRepository.FindAsync(personId); + var person = await _personRepository.FindAsync(personId).ConfigureAwait(false); person.ShouldNotBeNull(); person.TenantId.ShouldNotBeNull(); @@ -66,9 +63,9 @@ namespace Volo.Abp.TestApp.Testing Id = personId, Name = "Person1", Age = 21 - }); + }).ConfigureAwait(false); - var person = await _personRepository.FindAsync(personId); + var person = await _personRepository.FindAsync(personId).ConfigureAwait(false); person.ShouldNotBeNull(); person.TenantId.ShouldBeNull(); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Filter_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Filter_Tests.cs index da3e33ffea..10ce8e1605 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Filter_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Filter_Tests.cs @@ -63,7 +63,7 @@ namespace Volo.Abp.TestApp.Testing people.Count.ShouldBe(0); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] @@ -85,7 +85,7 @@ namespace Volo.Abp.TestApp.Testing people.Count.ShouldBe(1); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs index 07e6211c09..7571c4fecd 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task GetAsync() { - var person = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + var person = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); person.Name.ShouldBe("Douglas"); person.Phones.Count.ShouldBe(2); } @@ -31,29 +31,29 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task FindAsync_Should_Return_Null_For_Not_Found_Entity() { - var person = await PersonRepository.FindAsync(Guid.NewGuid()); + var person = await PersonRepository.FindAsync(Guid.NewGuid()).ConfigureAwait(false); person.ShouldBeNull(); } [Fact] public async Task DeleteAsync() { - await PersonRepository.DeleteAsync(TestDataBuilder.UserDouglasId); + await PersonRepository.DeleteAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); - (await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId)).ShouldBeNull(); + (await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task Should_Access_To_Other_Collections_In_Same_Context_In_A_Custom_Method() { - var people = await CityRepository.GetPeopleInTheCityAsync("London"); + var people = await CityRepository.GetPeopleInTheCityAsync("London").ConfigureAwait(false); people.Count.ShouldBeGreaterThan(0); } [Fact] public async Task Custom_Repository_Method() { - var city = await CityRepository.FindByNameAsync("Istanbul"); + var city = await CityRepository.FindByNameAsync("Istanbul").ConfigureAwait(false); city.ShouldNotBeNull(); city.Name.ShouldBe("Istanbul"); } @@ -63,9 +63,9 @@ namespace Volo.Abp.TestApp.Testing { var personId = Guid.NewGuid(); - await PersonRepository.InsertAsync(new Person(personId, "Adam", 42)); + await PersonRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); - var person = await PersonRepository.FindAsync(personId); + var person = await PersonRepository.FindAsync(personId).ConfigureAwait(false); person.ShouldNotBeNull(); } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests_With_Int_Pk.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests_With_Int_Pk.cs index f873fe4265..0c3bc5e290 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests_With_Int_Pk.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests_With_Int_Pk.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.TestApp.Testing entity.ShouldNotBeNull(); entity.Name.ShouldBe("Entity1"); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] @@ -35,10 +35,10 @@ namespace Volo.Abp.TestApp.Testing { await WithUnitOfWorkAsync(async () => { - var entity = await EntityWithIntPkRepository.GetAsync(1); + var entity = await EntityWithIntPkRepository.GetAsync(1).ConfigureAwait(false); entity.ShouldNotBeNull(); entity.Name.ShouldBe("Entity1"); - }); + }).ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Queryable_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Queryable_Tests.cs index 6078236380..0e7bf2f7df 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Queryable_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Queryable_Tests.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.TestApp.Testing { PersonRepository.Any().ShouldBeTrue(); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] @@ -38,7 +38,7 @@ namespace Volo.Abp.TestApp.Testing var person = PersonRepository.Single(p => p.Id == TestDataBuilder.UserDouglasId); person.Name.ShouldBe("Douglas"); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] @@ -50,7 +50,7 @@ namespace Volo.Abp.TestApp.Testing person.Name.ShouldBe("Douglas"); person.Phones.Count.ShouldBe(2); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] @@ -62,7 +62,7 @@ namespace Volo.Abp.TestApp.Testing person.Name.ShouldBe("Douglas"); person.Phones.Count.ShouldBe(2); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Specifications_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Specifications_Tests.cs index c26134b27c..49880535f2 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Specifications_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Specifications_Tests.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.TestApp.Testing { CityRepository.Count(new CitySpecification().ToExpression()).ShouldBe(1); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Filter_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Filter_Tests.cs index f3ac8c301f..6daba040a4 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Filter_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Filter_Tests.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.TestApp.Testing var person = PersonRepository.FirstOrDefault(p => p.Name == "John-Deleted"); person.ShouldBeNull(); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] @@ -38,9 +38,9 @@ namespace Volo.Abp.TestApp.Testing { await WithUnitOfWorkAsync(async () => { - var person = await PersonRepository.FindAsync(TestDataBuilder.UserJohnDeletedId); + var person = await PersonRepository.FindAsync(TestDataBuilder.UserJohnDeletedId).ConfigureAwait(false); person.ShouldBeNull(); - }); + }).ConfigureAwait(false); } [Fact] @@ -52,7 +52,7 @@ namespace Volo.Abp.TestApp.Testing people.Count.ShouldBe(1); people.Any(p => p.Name == "Douglas").ShouldBeTrue(); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } [Fact] @@ -92,7 +92,7 @@ namespace Volo.Abp.TestApp.Testing people.Any(p => p.IsDeleted).ShouldBeFalse(); return Task.CompletedTask; - }); + }).ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs index 0059a39a11..e1f4bc56a7 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs @@ -24,15 +24,15 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Cancel_Deletion_For_Soft_Delete_Entities() { - var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); - await PersonRepository.DeleteAsync(douglas); + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + await PersonRepository.DeleteAsync(douglas).ConfigureAwait(false); - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); douglas.ShouldBeNull(); using (DataFilter.Disable()) { - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); douglas.ShouldNotBeNull(); douglas.IsDeleted.ShouldBeTrue(); douglas.DeletionTime.ShouldNotBeNull(); @@ -42,18 +42,18 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Handle_Deletion_On_Update_For_Soft_Delete_Entities() { - var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); douglas.Age = 42; douglas.IsDeleted = true; - await PersonRepository.UpdateAsync(douglas); + await PersonRepository.UpdateAsync(douglas).ConfigureAwait(false); - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); douglas.ShouldBeNull(); using (DataFilter.Disable()) { - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); douglas.ShouldNotBeNull(); douglas.IsDeleted.ShouldBeTrue(); douglas.DeletionTime.ShouldNotBeNull(); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/TestAppTestBase.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/TestAppTestBase.cs index 9f7ef1b34b..3f80bfb74b 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/TestAppTestBase.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/TestAppTestBase.cs @@ -2,6 +2,7 @@ using System; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Volo.Abp.Uow; namespace Volo.Abp.TestApp.Testing @@ -29,9 +30,9 @@ namespace Volo.Abp.TestApp.Testing using (var uow = uowManager.Begin(options)) { - await action(); + await action().ConfigureAwait(false); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } } @@ -49,8 +50,8 @@ namespace Volo.Abp.TestApp.Testing using (var uow = uowManager.Begin(options)) { - var result = await func(); - await uow.CompleteAsync(); + var result = await func().ConfigureAwait(false); + await uow.CompleteAsync().ConfigureAwait(false); return result; } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Uow_Completed_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Uow_Completed_Tests.cs index 1b169bbe97..a101e64ea6 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Uow_Completed_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Uow_Completed_Tests.cs @@ -25,15 +25,15 @@ namespace Volo.Abp.TestApp.Testing using (var uow = _unitOfWorkManager.Begin()) { //Perform an arbitrary database operation - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), Guid.NewGuid().ToString())); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), Guid.NewGuid().ToString())).ConfigureAwait(false); uow.OnCompleted(async () => { //Perform another database operation inside the OnCompleted handler - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), Guid.NewGuid().ToString())); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), Guid.NewGuid().ToString())).ConfigureAwait(false); }); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } } diff --git a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo/Abp/Ui/Navigation/MenuManager_Tests.cs b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo/Abp/Ui/Navigation/MenuManager_Tests.cs index 5fed48c828..1f5190a9eb 100644 --- a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo/Abp/Ui/Navigation/MenuManager_Tests.cs +++ b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo/Abp/Ui/Navigation/MenuManager_Tests.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.Modularity; -using Volo.Abp.UI.Navigation; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.UI.Navigation @@ -19,7 +19,7 @@ namespace Volo.Abp.UI.Navigation [Fact] public async Task Should_Get_Menu() { - var mainMenu = await _menuManager.GetAsync(StandardMenus.Main); + var mainMenu = await _menuManager.GetAsync(StandardMenus.Main).ConfigureAwait(false); mainMenu.Name.ShouldBe(StandardMenus.Main); mainMenu.DisplayName.ShouldBe("Main Menu"); diff --git a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Ambient_Scope_Tests.cs b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Ambient_Scope_Tests.cs index c4b43bebe1..6b1bc2f98d 100644 --- a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Ambient_Scope_Tests.cs +++ b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Ambient_Scope_Tests.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Shouldly; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Uow @@ -29,13 +30,13 @@ namespace Volo.Abp.Uow _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.Id.ShouldBe(uow1.Id); - await uow2.CompleteAsync(); + await uow2.CompleteAsync().ConfigureAwait(false); } _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.ShouldBe(uow1); - await uow1.CompleteAsync(); + await uow1.CompleteAsync().ConfigureAwait(false); } _unitOfWorkManager.Current.ShouldBeNull(); @@ -55,7 +56,7 @@ namespace Volo.Abp.Uow _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.Id.ShouldNotBe(uow1.Id); - await uow2.CompleteAsync(); + await uow2.CompleteAsync().ConfigureAwait(false); } _unitOfWorkManager.Current.ShouldBeNull(); @@ -65,7 +66,7 @@ namespace Volo.Abp.Uow _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.Id.ShouldBe(uow1.Id); - await uow1.CompleteAsync(); + await uow1.CompleteAsync().ConfigureAwait(false); } _unitOfWorkManager.Current.ShouldBeNull(); diff --git a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Events_Tests.cs b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Events_Tests.cs index 0da84a04a9..7d9a176076 100644 --- a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Events_Tests.cs +++ b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Events_Tests.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Shouldly; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Uow @@ -23,10 +24,15 @@ namespace Volo.Abp.Uow using (var uow = _unitOfWorkManager.Begin()) { - uow.OnCompleted(async () => completed = true); + uow.OnCompleted(() => + { + completed = true; + return Task.CompletedTask; + }); + uow.Disposed += (sender, args) => disposed = true; - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); completed.ShouldBeTrue(); } @@ -47,7 +53,7 @@ namespace Volo.Abp.Uow childUow.OnCompleted(async () => completed = true); uow.Disposed += (sender, args) => disposed = true; - await childUow.CompleteAsync(); + await childUow.CompleteAsync().ConfigureAwait(false); completed.ShouldBeFalse(); //Parent has not been completed yet! disposed.ShouldBeFalse(); @@ -56,7 +62,7 @@ namespace Volo.Abp.Uow completed.ShouldBeFalse(); //Parent has not been completed yet! disposed.ShouldBeFalse(); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); completed.ShouldBeTrue(); //It's completed now! disposed.ShouldBeFalse(); //But not disposed yet! @@ -123,11 +129,11 @@ namespace Volo.Abp.Uow uow.Failed += (sender, args) => { failed = true; args.IsRolledback.ShouldBeTrue(); }; uow.Disposed += (sender, args) => disposed = true; - await uow.RollbackAsync(); + await uow.RollbackAsync().ConfigureAwait(false); if (callComplete) { - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } diff --git a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Nested_Tests.cs b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Nested_Tests.cs index e322a25682..efa4a7540e 100644 --- a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Nested_Tests.cs +++ b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Nested_Tests.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Shouldly; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Uow @@ -29,13 +30,13 @@ namespace Volo.Abp.Uow _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.Id.ShouldNotBe(uow1.Id); - await uow2.CompleteAsync(); + await uow2.CompleteAsync().ConfigureAwait(false); } _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.ShouldBe(uow1); - await uow1.CompleteAsync(); + await uow1.CompleteAsync().ConfigureAwait(false); } _unitOfWorkManager.Current.ShouldBeNull(); diff --git a/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs b/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs index 2028ea60ca..78848591e7 100644 --- a/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs +++ b/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs @@ -9,6 +9,7 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Autofac; using Volo.Abp.DependencyInjection; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.Validation @@ -30,15 +31,15 @@ namespace Volo.Abp.Validation [Fact] public async Task Should_Work_Proper_With_Right_Inputs() { - var output = await _myAppService.MyMethod(new MyMethodInput { MyStringValue = "test" }); + var output = await _myAppService.MyMethod(new MyMethodInput { MyStringValue = "test" }).ConfigureAwait(false); output.Result.ShouldBe(42); } [Fact] public async Task Should_Not_Work_With_Wrong_Inputs() { - await Assert.ThrowsAsync(async () => await _myAppService.MyMethod(new MyMethodInput())); //MyStringValue is not supplied! - await Assert.ThrowsAsync(async () => await _myAppService.MyMethod(new MyMethodInput { MyStringValue = "a" })); //MyStringValue's min length should be 3! + await Assert.ThrowsAsync(async () => await _myAppService.MyMethod(new MyMethodInput()).ConfigureAwait(false)).ConfigureAwait(false); //MyStringValue is not supplied! + await Assert.ThrowsAsync(async () => await _myAppService.MyMethod(new MyMethodInput { MyStringValue = "a" }).ConfigureAwait(false)).ConfigureAwait(false); //MyStringValue's min length should be 3! } [Fact] @@ -49,7 +50,7 @@ namespace Volo.Abp.Validation MyStringValue2 = "test 1", Input1 = new MyMethodInput { MyStringValue = "test 2" }, DateTimeValue = DateTime.Now - }); + }).ConfigureAwait(false); output.Result.ShouldBe(42); } @@ -62,7 +63,7 @@ namespace Volo.Abp.Validation { MyStringValue2 = "test 1", Input1 = new MyMethodInput() //MyStringValue is not set - })); + }).ConfigureAwait(false)).ConfigureAwait(false); } [Fact] @@ -72,7 +73,7 @@ namespace Volo.Abp.Validation await _myAppService.MyMethod2(new MyMethod2Input //Input1 is not set { MyStringValue2 = "test 1" - })); + }).ConfigureAwait(false)).ConfigureAwait(false); } [Fact] @@ -87,7 +88,7 @@ namespace Volo.Abp.Validation { new MyClassInList {ValueInList = null} } - })); + }).ConfigureAwait(false)).ConfigureAwait(false); } [Fact] @@ -102,27 +103,27 @@ namespace Volo.Abp.Validation { new MyClassInList {ValueInList = null} } - })); + }).ConfigureAwait(false)).ConfigureAwait(false); } [Fact] public async Task Should_Not_Work_If_Array_Is_Null() { await Assert.ThrowsAsync(async () => - await _myAppService.MyMethod4(new MyMethod4Input()) //ArrayItems is null! - ); + await _myAppService.MyMethod4(new MyMethod4Input()) //ArrayItems is null! +.ConfigureAwait(false)).ConfigureAwait(false); } [Fact] public async Task Should_Work_If_Array_Is_Null_But_DisabledValidation_For_Method() { - await _myAppService.MyMethod4_2(new MyMethod4Input()); + await _myAppService.MyMethod4_2(new MyMethod4Input()).ConfigureAwait(false); } [Fact] public async Task Should_Work_If_Array_Is_Null_But_DisabledValidation_For_Property() { - await _myAppService.MyMethod5(new MyMethod5Input()); + await _myAppService.MyMethod5(new MyMethod5Input()).ConfigureAwait(false); } [Fact] @@ -133,8 +134,8 @@ namespace Volo.Abp.Validation await _myAppService.MyMethod6(new MyMethod6Input { MyStringValue = "test value" //MyIntValue has not set! - }); - }); + }).ConfigureAwait(false); + }).ConfigureAwait(false); } //TODO: Create a Volo.Abp.Ddd.Application.Contracts.Tests project and move this to there and remove Volo.Abp.Ddd.Application.Contracts dependency from this project. @@ -146,8 +147,8 @@ namespace Volo.Abp.Validation await _myAppService.MyMethodWithLimitedResult(new LimitedResultRequestDto { MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount + 1 - }); - }); + }).ConfigureAwait(false); + }).ConfigureAwait(false); exception.ValidationErrors.ShouldContain(e => e.MemberNames.Contains(nameof(LimitedResultRequestDto.MaxResultCount))); } @@ -157,20 +158,20 @@ namespace Volo.Abp.Validation { await _myAppService.MyMethodWithLimitedResult(new LimitedResultRequestDto { - MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount -1 - }); + MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount - 1 + }).ConfigureAwait(false); } [Fact] public async Task Should_Stop_Recursive_Validation_In_A_Constant_Depth() { - (await _myAppService.MyMethod8(new MyClassWithRecursiveReference { Value = "42" })).Result.ShouldBe(42); + (await _myAppService.MyMethod8(new MyClassWithRecursiveReference { Value = "42" }).ConfigureAwait(false)).Result.ShouldBe(42); } [Fact] public async Task Should_Allow_Null_For_Nullable_Enums() { - await _myAppService.MyMethodWithNullableEnum(null); + await _myAppService.MyMethodWithNullableEnum(null).ConfigureAwait(false); } [Fact] diff --git a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/DynamicFileProvider_Tests.cs b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/DynamicFileProvider_Tests.cs index 45aaa88fd4..3b44387da5 100644 --- a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/DynamicFileProvider_Tests.cs +++ b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/DynamicFileProvider_Tests.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Primitives; using Shouldly; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.VirtualFileSystem diff --git a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/VirtualFileProvider_Tests.cs b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/VirtualFileProvider_Tests.cs index e6464f6bd4..3d69b87b56 100644 --- a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/VirtualFileProvider_Tests.cs +++ b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/VirtualFileProvider_Tests.cs @@ -4,6 +4,7 @@ using System.Text; using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.Modularity; +using Volo.Abp.Testing; using Xunit; namespace Volo.Abp.VirtualFileSystem diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AbpAccountApplicationContractsModule.cs b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AbpAccountApplicationContractsModule.cs index 1d3ced4cdb..ee1b6c7957 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AbpAccountApplicationContractsModule.cs +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AbpAccountApplicationContractsModule.cs @@ -2,8 +2,8 @@ using Volo.Abp.Identity; using Volo.Abp.Localization; using Volo.Abp.Localization.ExceptionHandling; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.Account diff --git a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingNames.cs b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Settings/AccountSettingNames.cs similarity index 84% rename from modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingNames.cs rename to modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Settings/AccountSettingNames.cs index a167be0ce8..d2596fd33d 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingNames.cs +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Settings/AccountSettingNames.cs @@ -1,4 +1,4 @@ -namespace Volo.Abp.Account.Web.Settings +namespace Volo.Abp.Account.Settings { public class AccountSettingNames { diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs index eba47666a4..9935078fe1 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs @@ -1,7 +1,9 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; +using Volo.Abp.Account.Settings; using Volo.Abp.Application.Services; using Volo.Abp.Identity; +using Volo.Abp.Settings; namespace Volo.Abp.Account { @@ -17,11 +19,21 @@ namespace Volo.Abp.Account public virtual async Task RegisterAsync(RegisterDto input) { + await CheckSelfRegistrationAsync().ConfigureAwait(false); + var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id); - (await UserManager.CreateAsync(user, input.Password)).CheckErrors(); + (await UserManager.CreateAsync(user, input.Password).ConfigureAwait(false)).CheckErrors(); return ObjectMapper.Map(user); } + + protected virtual async Task CheckSelfRegistrationAsync() + { + if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled).ConfigureAwait(false)) + { + throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]); + } + } } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs similarity index 96% rename from modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs rename to modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs index 53c2df6fbd..034b2b1a01 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs @@ -2,7 +2,7 @@ using Volo.Abp.Localization; using Volo.Abp.Settings; -namespace Volo.Abp.Account.Web.Settings +namespace Volo.Abp.Account.Settings { public class AccountSettingDefinitionProvider : SettingDefinitionProvider { diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs index f1abf44750..2fa2aa5778 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs @@ -12,7 +12,7 @@ using System.Linq; using System.Security.Claims; using System.Security.Principal; using System.Threading.Tasks; -using Volo.Abp.Account.Web.Settings; +using Volo.Abp.Account.Settings; using Volo.Abp.DependencyInjection; using Volo.Abp.MultiTenancy; using Volo.Abp.Settings; @@ -46,7 +46,7 @@ namespace Volo.Abp.Account.Web.Pages.Account { LoginInput = new LoginInputModel(); - var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl); + var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false); if (context != null) { @@ -68,7 +68,7 @@ namespace Volo.Abp.Account.Web.Pages.Account return Page(); } - var schemes = await _schemeProvider.GetAllSchemesAsync(); + var schemes = await _schemeProvider.GetAllSchemesAsync().ConfigureAwait(false); var providers = schemes .Where(x => x.DisplayName != null || x.Name.Equals(_accountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase)) @@ -79,10 +79,10 @@ namespace Volo.Abp.Account.Web.Pages.Account }) .ToList(); - EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); + EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false); if (context?.ClientId != null) { - var client = await ClientStore.FindEnabledClientByIdAsync(context.ClientId); + var client = await ClientStore.FindEnabledClientByIdAsync(context.ClientId).ConfigureAwait(false); if (client != null) { EnableLocalLogin = client.EnableLocalLogin; @@ -98,7 +98,7 @@ namespace Volo.Abp.Account.Web.Pages.Account if (IsExternalLoginOnly) { - return await base.OnPostExternalLogin(providers.First().AuthenticationScheme); + return await base.OnPostExternalLogin(providers.First().AuthenticationScheme).ConfigureAwait(false); } return Page(); @@ -107,31 +107,31 @@ namespace Volo.Abp.Account.Web.Pages.Account [UnitOfWork] //TODO: Will be removed when we implement action filter public override async Task OnPostAsync(string action) { - EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); + EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false); if (action == "Cancel") { - var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl); + var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false); if (context == null) { return Redirect("~/"); } - await Interaction.GrantConsentAsync(context, ConsentResponse.Denied); + await Interaction.GrantConsentAsync(context, ConsentResponse.Denied).ConfigureAwait(false); return Redirect(ReturnUrl); } ValidateModel(); - await ReplaceEmailToUsernameOfInputIfNeeds(); + await ReplaceEmailToUsernameOfInputIfNeeds().ConfigureAwait(false); var result = await SignInManager.PasswordSignInAsync( LoginInput.UserNameOrEmailAddress, LoginInput.Password, LoginInput.RememberMe, true - ); + ).ConfigureAwait(false); if (result.RequiresTwoFactor) { @@ -162,11 +162,11 @@ namespace Volo.Abp.Account.Web.Pages.Account } //TODO: Find a way of getting user's id from the logged in user and do not query it again like that! - var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress) ?? - await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress); + var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false) ?? + await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false); Debug.Assert(user != null, nameof(user) + " != null"); - await IdentityServerEvents.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)); //TODO: Use user's name once implemented + await IdentityServerEvents.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)).ConfigureAwait(false); //TODO: Use user's name once implemented return RedirectSafely(ReturnUrl, ReturnUrlHash); } @@ -176,15 +176,15 @@ namespace Volo.Abp.Account.Web.Pages.Account { if (_accountOptions.WindowsAuthenticationSchemeName == provider) { - return await ProcessWindowsLoginAsync(); + return await ProcessWindowsLoginAsync().ConfigureAwait(false); } - return await base.OnPostExternalLogin(provider); + return await base.OnPostExternalLogin(provider).ConfigureAwait(false); } private async Task ProcessWindowsLoginAsync() { - var result = await HttpContext.AuthenticateAsync(_accountOptions.WindowsAuthenticationSchemeName); + var result = await HttpContext.AuthenticateAsync(_accountOptions.WindowsAuthenticationSchemeName).ConfigureAwait(false); if (!(result?.Principal is WindowsPrincipal windowsPrincipal)) { return Challenge(_accountOptions.WindowsAuthenticationSchemeName); @@ -219,7 +219,7 @@ namespace Volo.Abp.Account.Web.Pages.Account IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme, new ClaimsPrincipal(identity), props - ); + ).ConfigureAwait(false); return RedirectSafely(props.RedirectUri); } diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs index 3fb68feaca..e34f6e98f1 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs @@ -44,19 +44,19 @@ namespace Volo.Abp.Account.Web.Pages public virtual async Task OnGet() { - var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); + var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false); if (request == null) { throw new ApplicationException($"No consent request matching request: {ReturnUrl}"); } - var client = await _clientStore.FindEnabledClientByIdAsync(request.ClientId); + var client = await _clientStore.FindEnabledClientByIdAsync(request.ClientId).ConfigureAwait(false); if (client == null) { throw new ApplicationException($"Invalid client id: {request.ClientId}"); } - var resources = await _resourceStore.FindEnabledResourcesByScopeAsync(request.ScopesRequested); + var resources = await _resourceStore.FindEnabledResourcesByScopeAsync(request.ScopesRequested).ConfigureAwait(false); if (resources == null || (!resources.IdentityResources.Any() && !resources.ApiResources.Any())) { throw new ApplicationException($"No scopes matching: {request.ScopesRequested.Aggregate((x, y) => x + ", " + y)}"); @@ -78,7 +78,7 @@ namespace Volo.Abp.Account.Web.Pages public virtual async Task OnPost(string userDecision) { - var result = await ProcessConsentAsync(); + var result = await ProcessConsentAsync().ConfigureAwait(false); if (result.IsRedirect) { @@ -122,13 +122,13 @@ namespace Volo.Abp.Account.Web.Pages if (grantedConsent != null) { - var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); + var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false); if (request == null) { return result; } - await _interaction.GrantConsentAsync(request, grantedConsent); + await _interaction.GrantConsentAsync(request, grantedConsent).ConfigureAwait(false); result.RedirectUri = ReturnUrl; //TODO: ReturnUrlHash? } diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs index 05f37067d4..12960920c8 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs @@ -34,14 +34,14 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers { ValidateLoginInfo(login); - await ReplaceEmailToUsernameOfInputIfNeeds(login); + await ReplaceEmailToUsernameOfInputIfNeeds(login).ConfigureAwait(false); return GetAbpLoginResult(await _signInManager.PasswordSignInAsync( login.UserNameOrEmailAddress, login.Password, login.RememberMe, true - )); + ).ConfigureAwait(false)); } [HttpPost] @@ -50,16 +50,16 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers { ValidateLoginInfo(login); - await ReplaceEmailToUsernameOfInputIfNeeds(login); + await ReplaceEmailToUsernameOfInputIfNeeds(login).ConfigureAwait(false); - var identityUser = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress); + var identityUser = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress).ConfigureAwait(false); if (identityUser == null) { return new AbpLoginResult(LoginResultType.InvalidUserNameOrPassword); } - return GetAbpLoginResult(await _signInManager.CheckPasswordSignInAsync(identityUser, login.Password, true)); + return GetAbpLoginResult(await _signInManager.CheckPasswordSignInAsync(identityUser, login.Password, true).ConfigureAwait(false)); } protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(UserLoginInfo login) @@ -69,13 +69,13 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers return; } - var userByUsername = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress); + var userByUsername = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress).ConfigureAwait(false); if (userByUsername != null) { return; } - var userByEmail = await _userManager.FindByEmailAsync(login.UserNameOrEmailAddress); + var userByEmail = await _userManager.FindByEmailAsync(login.UserNameOrEmailAddress).ConfigureAwait(false); if (userByEmail == null) { return; diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs index eb7d1cbc84..878f2aa2d5 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers //todo@alper: this method can be moved to AccountController like "account/logout" public async Task Index(string returnUrl = null) { - await _signInManager.SignOutAsync(); + await _signInManager.SignOutAsync().ConfigureAwait(false); if (returnUrl != null) { diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml index cba1fec431..94ef0e45a2 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml @@ -1,5 +1,5 @@ @page -@using Volo.Abp.Account.Web.Settings +@using Volo.Abp.Account.Settings @model Volo.Abp.Account.Web.Pages.Account.LoginModel @inherits Volo.Abp.Account.Web.Pages.Account.AccountPage @inject Volo.Abp.Settings.ISettingProvider SettingProvider diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs index e7e625416a..9e4427a2b6 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs @@ -10,7 +10,7 @@ using System.Diagnostics; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; -using Volo.Abp.Account.Web.Settings; +using Volo.Abp.Account.Settings; using Volo.Abp.Identity; using Volo.Abp.Security.Claims; using Volo.Abp.Settings; @@ -62,7 +62,7 @@ namespace Volo.Abp.Account.Web.Pages.Account { LoginInput = new LoginInputModel(); - var schemes = await _schemeProvider.GetAllSchemesAsync(); + var schemes = await _schemeProvider.GetAllSchemesAsync().ConfigureAwait(false); var providers = schemes .Where(x => x.DisplayName != null || x.Name.Equals(_accountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase)) @@ -73,7 +73,7 @@ namespace Volo.Abp.Account.Web.Pages.Account }) .ToList(); - EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); + EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false); ExternalProviders = providers.ToArray(); @@ -89,18 +89,18 @@ namespace Volo.Abp.Account.Web.Pages.Account [UnitOfWork] //TODO: Will be removed when we implement action filter public virtual async Task OnPostAsync(string action) { - EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); + EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false); ValidateModel(); - await ReplaceEmailToUsernameOfInputIfNeeds(); + await ReplaceEmailToUsernameOfInputIfNeeds().ConfigureAwait(false); var result = await SignInManager.PasswordSignInAsync( LoginInput.UserNameOrEmailAddress, LoginInput.Password, LoginInput.RememberMe, true - ); + ).ConfigureAwait(false); if (result.RequiresTwoFactor) { @@ -131,8 +131,8 @@ namespace Volo.Abp.Account.Web.Pages.Account } //TODO: Find a way of getting user's id from the logged in user and do not query it again like that! - var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress) ?? - await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress); + var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false) ?? + await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false); Debug.Assert(user != null, nameof(user) + " != null"); @@ -163,7 +163,7 @@ namespace Volo.Abp.Account.Web.Pages.Account return RedirectToPage("./Login"); } - var loginInfo = await SignInManager.GetExternalLoginInfoAsync(); + var loginInfo = await SignInManager.GetExternalLoginInfoAsync().ConfigureAwait(false); if (loginInfo == null) { Logger.LogWarning("External login info is not available"); @@ -175,7 +175,7 @@ namespace Volo.Abp.Account.Web.Pages.Account loginInfo.ProviderKey, isPersistent: false, bypassTwoFactor: true - ); + ).ConfigureAwait(false); if (result.IsLockedOut) { @@ -190,15 +190,15 @@ namespace Volo.Abp.Account.Web.Pages.Account //TODO: Handle other cases for result! // Get the information about the user from the external login provider - var info = await SignInManager.GetExternalLoginInfoAsync(); + var info = await SignInManager.GetExternalLoginInfoAsync().ConfigureAwait(false); if (info == null) { throw new ApplicationException("Error loading external login information during confirmation."); } - var user = await CreateExternalUserAsync(info); + var user = await CreateExternalUserAsync(info).ConfigureAwait(false); - await SignInManager.SignInAsync(user, false); + await SignInManager.SignInAsync(user, false).ConfigureAwait(false); return RedirectSafely(returnUrl, returnUrlHash); } @@ -208,9 +208,9 @@ namespace Volo.Abp.Account.Web.Pages.Account var user = new IdentityUser(GuidGenerator.Create(), emailAddress, emailAddress, CurrentTenant.Id); - CheckIdentityErrors(await UserManager.CreateAsync(user)); - CheckIdentityErrors(await UserManager.SetEmailAsync(user, emailAddress)); - CheckIdentityErrors(await UserManager.AddLoginAsync(user, info)); + CheckIdentityErrors(await UserManager.CreateAsync(user).ConfigureAwait(false)); + CheckIdentityErrors(await UserManager.SetEmailAsync(user, emailAddress).ConfigureAwait(false)); + CheckIdentityErrors(await UserManager.AddLoginAsync(user, info).ConfigureAwait(false)); return user; } @@ -222,13 +222,13 @@ namespace Volo.Abp.Account.Web.Pages.Account return; } - var userByUsername = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress); + var userByUsername = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false); if (userByUsername != null) { return; } - var userByEmail = await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress); + var userByEmail = await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false); if (userByEmail == null) { return; diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs index 9fba470929..7c94f747cd 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Account.Web.Pages.Account public async Task OnGetAsync() { - var user = await _profileAppService.GetAsync(); + var user = await _profileAppService.GetAsync().ConfigureAwait(false); PersonalSettingsInfoModel = ObjectMapper.Map(user); } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs index 1a16cecc2a..4d95613fe1 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Account.Web.Settings; +using Volo.Abp.Account.Settings; using Volo.Abp.Settings; using Volo.Abp.Uow; using IdentityUser = Volo.Abp.Identity.IdentityUser; @@ -22,7 +22,7 @@ namespace Volo.Abp.Account.Web.Pages.Account public virtual async Task OnGet() { - await CheckSelfRegistrationAsync(); + await CheckSelfRegistrationAsync().ConfigureAwait(false); } [UnitOfWork] //TODO: Will be removed when we implement action filter @@ -30,22 +30,22 @@ namespace Volo.Abp.Account.Web.Pages.Account { ValidateModel(); - await CheckSelfRegistrationAsync(); + await CheckSelfRegistrationAsync().ConfigureAwait(false); var user = new IdentityUser(GuidGenerator.Create(), Input.UserName, Input.EmailAddress, CurrentTenant.Id); - (await UserManager.CreateAsync(user, Input.Password)).CheckErrors(); - - await UserManager.SetEmailAsync(user, Input.EmailAddress); + (await UserManager.CreateAsync(user, Input.Password).ConfigureAwait(false)).CheckErrors(); + + await UserManager.SetEmailAsync(user, Input.EmailAddress).ConfigureAwait(false); - await SignInManager.SignInAsync(user, isPersistent: false); + await SignInManager.SignInAsync(user, isPersistent: false).ConfigureAwait(false); return Redirect(ReturnUrl ?? "/"); //TODO: How to ensure safety? IdentityServer requires it however it should be checked somehow! } protected virtual async Task CheckSelfRegistrationAsync() { - if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled)) + if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled).ConfigureAwait(false)) { throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]); } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs index 5923d8972c..ab8abd4853 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.Account.Web.Pages.Account public async Task OnGetAsync() { - var user = await SignInManager.GetTwoFactorAuthenticationUserAsync(); + var user = await SignInManager.GetTwoFactorAuthenticationUserAsync().ConfigureAwait(false); if (user == null) { return RedirectToPage("./Login"); diff --git a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo.Abp.Account.Application.Tests.csproj b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo.Abp.Account.Application.Tests.csproj index e8d3f84ead..2055dfc4ef 100644 --- a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo.Abp.Account.Application.Tests.csproj +++ b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo.Abp.Account.Application.Tests.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 + diff --git a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AbpAccountApplicationTestBase.cs b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AbpAccountApplicationTestBase.cs index 38f1506a76..99a2eed68e 100644 --- a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AbpAccountApplicationTestBase.cs +++ b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AbpAccountApplicationTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.Account +using Volo.Abp.Testing; + +namespace Volo.Abp.Account { public class AbpAccountApplicationTestBase : AbpIntegratedTest { diff --git a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs index 634cbfc253..14d257993c 100644 --- a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs +++ b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs @@ -4,7 +4,7 @@ using Shouldly; using Volo.Abp.Identity; using Xunit; -namespace Volo.Abp.Account.Pro.Application.Tests.Volo.Abp.Account +namespace Volo.Abp.Account { public class AccountAppService_Tests : AbpAccountApplicationTestBase { @@ -12,8 +12,7 @@ namespace Volo.Abp.Account.Pro.Application.Tests.Volo.Abp.Account private readonly IIdentityUserRepository _identityUserRepository; private readonly ILookupNormalizer _lookupNormalizer; private readonly IdentityUserManager _userManager; - - + public AccountAppService_Tests() { _accountAppService = GetRequiredService(); @@ -33,16 +32,16 @@ namespace Volo.Abp.Account.Pro.Application.Tests.Volo.Abp.Account AppName = "MVC" }; - await _accountAppService.RegisterAsync(registerDto); + await _accountAppService.RegisterAsync(registerDto).ConfigureAwait(false); var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.NormalizeName("bob.lee")); + _lookupNormalizer.NormalizeName("bob.lee")).ConfigureAwait(false); user.ShouldNotBeNull(); user.UserName.ShouldBe("bob.lee"); user.Email.ShouldBe("bob.lee@abp.io"); - (await _userManager.CheckPasswordAsync(user, "P@ssW0rd")).ShouldBeTrue(); + (await _userManager.CheckPasswordAsync(user, "P@ssW0rd").ConfigureAwait(false)).ShouldBeTrue(); } } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo.Abp.AuditLogging.Domain.Shared.csproj b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo.Abp.AuditLogging.Domain.Shared.csproj index b1d7f04bbf..44c36fd1d1 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo.Abp.AuditLogging.Domain.Shared.csproj +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo.Abp.AuditLogging.Domain.Shared.csproj @@ -8,7 +8,6 @@ - diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AbpAuditLoggingDomainSharedModule.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AbpAuditLoggingDomainSharedModule.cs index efa043efd1..ca0209a620 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AbpAuditLoggingDomainSharedModule.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AbpAuditLoggingDomainSharedModule.cs @@ -1,5 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AuditLogging.Localization; +using Volo.Abp.AuditLogging.Localization; using Volo.Abp.Localization; using Volo.Abp.Modularity; diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs index 0fc757b5e9..6674233de6 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs @@ -37,13 +37,13 @@ namespace Volo.Abp.AuditLogging { if (!Options.HideErrors) { - await SaveLogAsync(auditInfo); + await SaveLogAsync(auditInfo).ConfigureAwait(false); return; } try { - await SaveLogAsync(auditInfo); + await SaveLogAsync(auditInfo).ConfigureAwait(false); } catch (Exception ex) { @@ -55,8 +55,8 @@ namespace Volo.Abp.AuditLogging { using (var uow = _unitOfWorkManager.Begin(true)) { - await _auditLogRepository.InsertAsync(new AuditLog(_guidGenerator, auditInfo)); - await uow.SaveChangesAsync(); + await _auditLogRepository.InsertAsync(new AuditLog(_guidGenerator, auditInfo)).ConfigureAwait(false); + await uow.SaveChangesAsync().ConfigureAwait(false); } } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs index 094f946777..0b68932224 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs @@ -54,7 +54,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore var auditLogs = await query.OrderBy(sorting ?? "executionTime desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); return auditLogs; } @@ -87,7 +87,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore httpStatusCode ); - var totalCount = await query.LongCountAsync(GetCancellationToken(cancellationToken)); + var totalCount = await query.LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); return totalCount; } @@ -129,7 +129,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore .OrderBy(t => t.ExecutionTime) .GroupBy(t => new { t.ExecutionTime.Date }) .Select(g => new { Day = g.Min(t => t.ExecutionTime), avgExecutionTime = g.Average(t => t.ExecutionDuration) }) - .ToListAsync(); + .ToListAsync().ConfigureAwait(false); return result.ToDictionary(element => element.Day.ClearTime(), element => element.avgExecutionTime); } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs index 8beeff86a3..51ae55d86a 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs @@ -55,7 +55,7 @@ namespace Volo.Abp.AuditLogging.MongoDB return await query.OrderBy(sorting ?? "executionTime desc").As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task GetCountAsync( @@ -87,7 +87,7 @@ namespace Volo.Abp.AuditLogging.MongoDB ); var count = await query.As>() - .LongCountAsync(GetCancellationToken(cancellationToken)); + .LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); return count; } @@ -134,7 +134,7 @@ namespace Volo.Abp.AuditLogging.MongoDB t.ExecutionTime.Day }) .Select(g => new { Day = g.Min(t => t.ExecutionTime), avgExecutionTime = g.Average(t => t.ExecutionDuration) }) - .ToListAsync(); + .ToListAsync().ConfigureAwait(false); return result.ToDictionary(element => element.Day.ClearTime(), element => element.avgExecutionTime); } diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs index 54092ea248..e1878bdcc8 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Net; -using System.Text; using System.Threading.Tasks; using Shouldly; using Volo.Abp.Auditing; @@ -119,11 +117,11 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)).ConfigureAwait(false); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)).ConfigureAwait(false); //Assert - var logs = await AuditLogRepository.GetListAsync(); + var logs = await AuditLogRepository.GetListAsync().ConfigureAwait(false); logs.ShouldNotBeNull(); logs.ShouldContain(x => x.UserId == userId); logs.ShouldContain(x => x.UserId == userId2); @@ -223,11 +221,11 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)).ConfigureAwait(false); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)).ConfigureAwait(false); //Assert - var logs = await AuditLogRepository.GetCountAsync(); + var logs = await AuditLogRepository.GetCountAsync().ConfigureAwait(false); logs.ShouldBe(2); } @@ -325,12 +323,12 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)).ConfigureAwait(false); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)).ConfigureAwait(false); //Assert var date = DateTime.Parse("2020-01-01"); - var results = await AuditLogRepository.GetAverageExecutionDurationPerDayAsync(date, date); + var results = await AuditLogRepository.GetAverageExecutionDurationPerDayAsync(date, date).ConfigureAwait(false); results.Count.ShouldBe(1); results.Values.First().ShouldBe(50); // (45 + 55) / 2 } diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLoggingTestBase.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLoggingTestBase.cs index 6cbe6bd126..f7378f74dc 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLoggingTestBase.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLoggingTestBase.cs @@ -1,4 +1,5 @@ using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace Volo.Abp.AuditLogging { diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs index 05dc829440..9744930c09 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs @@ -64,7 +64,7 @@ namespace Volo.Abp.AuditLogging }; //Act - await _auditingStore.SaveAsync(auditLog); + await _auditingStore.SaveAsync(auditLog).ConfigureAwait(false); //Assert @@ -170,14 +170,14 @@ namespace Volo.Abp.AuditLogging } }; - await _auditingStore.SaveAsync(log1); - await _auditingStore.SaveAsync(log2); + await _auditingStore.SaveAsync(log1).ConfigureAwait(false); + await _auditingStore.SaveAsync(log2).ConfigureAwait(false); - var allLogsCount = await _auditLogRepository.GetCountAsync(); + var allLogsCount = await _auditLogRepository.GetCountAsync().ConfigureAwait(false); - var onlyLog1QueryResult = await _auditLogRepository.GetListAsync(includeDetails: true, userName: "Douglas"); + var onlyLog1QueryResult = await _auditLogRepository.GetListAsync(includeDetails: true, userName: "Douglas").ConfigureAwait(false); - var onlyLog2QueryResult = await _auditLogRepository.GetListAsync(includeDetails: true, httpStatusCode: HttpStatusCode.BadGateway); + var onlyLog2QueryResult = await _auditLogRepository.GetListAsync(includeDetails: true, httpStatusCode: HttpStatusCode.BadGateway).ConfigureAwait(false); allLogsCount.ShouldBe(2); diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs index 6e92bc6f7f..04c885be20 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs @@ -59,12 +59,12 @@ namespace Volo.Abp.AuditLogging } ); - await scope.SaveAsync(); + await scope.SaveAsync().ConfigureAwait(false); } //Assert - var auditLogs = await _auditLogRepository.GetListAsync(applicationName: applicationName, includeDetails: true); + var auditLogs = await _auditLogRepository.GetListAsync(applicationName: applicationName, includeDetails: true).ConfigureAwait(false); auditLogs.Count.ShouldBe(1); var auditLog = auditLogs.First(); auditLog.EntityChanges.ShouldNotBeNull(); diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Jobs/SampleJobCreator.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Jobs/SampleJobCreator.cs index b131c5943d..3c05c4abd3 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Jobs/SampleJobCreator.cs +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Jobs/SampleJobCreator.cs @@ -20,10 +20,10 @@ namespace Volo.Abp.BackgroundJobs.DemoApp.Shared.Jobs public async Task CreateJobsAsync() { - await _backgroundJobManager.EnqueueAsync(new WriteToConsoleGreenJobArgs { Value = "test 1 (green)" }); - await _backgroundJobManager.EnqueueAsync(new WriteToConsoleGreenJobArgs { Value = "test 2 (green)" }); - await _backgroundJobManager.EnqueueAsync(new WriteToConsoleYellowJobArgs { Value = "test 1 (yellow)" }); - await _backgroundJobManager.EnqueueAsync(new WriteToConsoleYellowJobArgs { Value = "test 2 (yellow)" }); + await _backgroundJobManager.EnqueueAsync(new WriteToConsoleGreenJobArgs { Value = "test 1 (green)" }).ConfigureAwait(false); + await _backgroundJobManager.EnqueueAsync(new WriteToConsoleGreenJobArgs { Value = "test 2 (green)" }).ConfigureAwait(false); + await _backgroundJobManager.EnqueueAsync(new WriteToConsoleYellowJobArgs { Value = "test 1 (yellow)" }).ConfigureAwait(false); + await _backgroundJobManager.EnqueueAsync(new WriteToConsoleYellowJobArgs { Value = "test 2 (yellow)" }).ConfigureAwait(false); } } } diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs index b8d30b6940..2fe3a0fdda 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs @@ -24,38 +24,38 @@ namespace Volo.Abp.BackgroundJobs { return ObjectMapper.Map( await BackgroundJobRepository.FindAsync(jobId) - ); +.ConfigureAwait(false)); } public virtual async Task InsertAsync(BackgroundJobInfo jobInfo) { await BackgroundJobRepository.InsertAsync( ObjectMapper.Map(jobInfo) - ); + ).ConfigureAwait(false); } public virtual async Task> GetWaitingJobsAsync(int maxResultCount) { return ObjectMapper.Map, List>( await BackgroundJobRepository.GetWaitingListAsync(maxResultCount) - ); +.ConfigureAwait(false)); } public virtual async Task DeleteAsync(Guid jobId) { - await BackgroundJobRepository.DeleteAsync(jobId); + await BackgroundJobRepository.DeleteAsync(jobId).ConfigureAwait(false); } public virtual async Task UpdateAsync(BackgroundJobInfo jobInfo) { - var backgroundJobRecord = await BackgroundJobRepository.FindAsync(jobInfo.Id); + var backgroundJobRecord = await BackgroundJobRepository.FindAsync(jobInfo.Id).ConfigureAwait(false); if (backgroundJobRecord == null) { return; } ObjectMapper.Map(jobInfo, backgroundJobRecord); - await BackgroundJobRepository.UpdateAsync(backgroundJobRecord); + await BackgroundJobRepository.UpdateAsync(backgroundJobRecord).ConfigureAwait(false); } } } diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs index 8c786c9f37..22b8e6ab46 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore public async Task> GetWaitingListAsync(int maxResultCount) { return await GetWaitingListQuery(maxResultCount) - .ToListAsync(); + .ToListAsync().ConfigureAwait(false); } private IQueryable GetWaitingListQuery(int maxResultCount) diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs index 33903c1e9f..cd266eeac4 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.BackgroundJobs.MongoDB public async Task> GetWaitingListAsync(int maxResultCount) { return await GetWaitingListQuery(maxResultCount) - .ToListAsync(); + .ToListAsync().ConfigureAwait(false); } private IMongoQueryable GetWaitingListQuery(int maxResultCount) diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobStore_Tests.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobStore_Tests.cs index caa9a3c445..94b9375d83 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobStore_Tests.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobStore_Tests.cs @@ -26,9 +26,9 @@ namespace Volo.Abp.BackgroundJobs await _backgroundJobStore.InsertAsync( jobInfo - ); + ).ConfigureAwait(false); - var jobInfo2 = await _backgroundJobStore.FindAsync(jobInfo.Id); + var jobInfo2 = await _backgroundJobStore.FindAsync(jobInfo.Id).ConfigureAwait(false); jobInfo2.ShouldNotBeNull(); jobInfo2.Id.ShouldBe(jobInfo.Id); jobInfo2.JobArgs.ShouldBe(jobInfo.JobArgs); diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobRepository_Tests.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobRepository_Tests.cs index 59a2709edd..2187db533e 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobRepository_Tests.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobRepository_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.BackgroundJobs [InlineData(5)] public async Task GetWaitingListAsync(int maxResultCount) { - var backgroundJobs = await _backgroundJobRepository.GetWaitingListAsync(maxResultCount); + var backgroundJobs = await _backgroundJobRepository.GetWaitingListAsync(maxResultCount).ConfigureAwait(false); backgroundJobs.Count.ShouldBeGreaterThan(0); backgroundJobs.Count.ShouldBeLessThanOrEqualTo(maxResultCount); diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestBase.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestBase.cs index ea7b932a79..c87edcd788 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestBase.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestBase.cs @@ -1,5 +1,6 @@ using Volo.Abp; using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace Volo.Abp.BackgroundJobs { diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs index 16bcc667f5..90ec92ea35 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.BackgroundJobs CreationTime = _clock.Now.Subtract(TimeSpan.FromMinutes(2)), TryCount = 0 } - ); + ).ConfigureAwait(false); await _backgroundJobRepository.InsertAsync( new BackgroundJobRecord(_testData.JobId2) @@ -49,7 +49,7 @@ namespace Volo.Abp.BackgroundJobs CreationTime = _clock.Now.Subtract(TimeSpan.FromDays(2)), TryCount = 3 } - ); + ).ConfigureAwait(false); await _backgroundJobRepository.InsertAsync( new BackgroundJobRecord(_testData.JobId3) @@ -63,7 +63,7 @@ namespace Volo.Abp.BackgroundJobs CreationTime = _clock.Now.Subtract(TimeSpan.FromMinutes(90)), TryCount = 2 } - ); + ).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj b/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj index c1bb7c8a85..750481d6a1 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj +++ b/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj @@ -15,6 +15,8 @@ + + diff --git a/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/squire-rte/squire.js b/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/squire-rte/squire.js index 7ce7ef2258..870905984b 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/squire-rte/squire.js +++ b/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/squire-rte/squire.js @@ -1,2 +1,2 @@ -!function(e,t){"use strict";function n(e,t,n){this.root=this.currentNode=e,this.nodeType=t,this.filter=n||ue}function o(e,t){for(var n=e.length;n--;)if(!t(e[n]))return!1;return!0}function i(e){return e.nodeType===M&&!!pe[e.nodeName]}function r(e){switch(e.nodeType){case H:return me;case M:case z:if(de&&Ce.has(e))return Ce.get(e);break;default:return ge}var t;return t=o(e.childNodes,a)?fe.test(e.nodeName)?me:ve:Ne,de&&Ce.set(e,t),t}function a(e){return r(e)===me}function s(e){return r(e)===ve}function d(e){return r(e)===Ne}function l(e,t){var o=new n(t,q,s);return o.currentNode=e,o}function c(e,t){return e=l(e,t).previousNode(),e!==t?e:null}function h(e,t){return e=l(e,t).nextNode(),e!==t?e:null}function u(e){return!e.textContent&&!e.querySelector("IMG")}function f(e,t){return!i(e)&&e.nodeType===t.nodeType&&e.nodeName===t.nodeName&&"A"!==e.nodeName&&e.className===t.className&&(!e.style&&!t.style||e.style.cssText===t.style.cssText)}function p(e,t,n){if(e.nodeName!==t)return!1;for(var o in n)if(e.getAttribute(o)!==n[o])return!1;return!0}function g(e,t,n,o){for(;e&&e!==t;){if(p(e,n,o))return e;e=e.parentNode}return null}function m(e,t,n){for(;e&&e!==t;){if(n.test(e.nodeName))return e;e=e.parentNode}return null}function v(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function N(e,t,n){var o,i,r,a,s,d="";return e&&e!==t&&(d=N(e.parentNode,t,n),e.nodeType===M&&(d+=(d?">":"")+e.nodeName,(o=e.id)&&(d+="#"+o),(i=e.className.trim())&&(r=i.split(/\s\s*/),r.sort(),d+=".",d+=r.join(".")),(a=e.dir)&&(d+="[dir="+a+"]"),r&&(s=n.classNames,ce.call(r,s.highlight)>-1&&(d+="[backgroundColor="+e.style.backgroundColor.replace(/ /g,"")+"]"),ce.call(r,s.colour)>-1&&(d+="[color="+e.style.color.replace(/ /g,"")+"]"),ce.call(r,s.fontFamily)>-1&&(d+="[fontFamily="+e.style.fontFamily.replace(/ /g,"")+"]"),ce.call(r,s.fontSize)>-1&&(d+="[fontSize="+e.style.fontSize+"]")))),d}function C(e){var t=e.nodeType;return t===M||t===z?e.childNodes.length:e.length||0}function _(e){var t=e.parentNode;return t&&t.removeChild(e),e}function S(e,t){var n=e.parentNode;n&&n.replaceChild(t,e)}function y(e){for(var t=e.ownerDocument.createDocumentFragment(),n=e.childNodes,o=n?n.length:0;o--;)t.appendChild(e.firstChild);return t}function T(e,n,o,i){var r,a,s,d=e.createElement(n);if(o instanceof Array&&(i=o,o=null),o)for(r in o)o[r]!==t&&d.setAttribute(r,o[r]);if(i)for(a=0,s=i.length;as?t.startOffset-=1:t.startOffset===s&&(t.startContainer=o,t.startOffset=C(o))),t.endContainer===e&&(t.endOffset>s?t.endOffset-=1:t.endOffset===s&&(t.endContainer=o,t.endOffset=C(o))),_(n),n.nodeType===H?o.appendData(n.data):d.push(y(n));else if(n.nodeType===M){for(i=d.length;i--;)n.appendChild(d.pop());k(n,t)}}function A(e,t){if(e.nodeType===H&&(e=e.parentNode),e.nodeType===M){var n={startContainer:t.startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset};k(e,n),t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset)}}function L(e){var t=e.nodeName;return"TD"===t||"TH"===t||"TR"===t||"TBODY"===t||"THEAD"===t}function O(e,t,n,o){var i,r,a,s=t;if(!L(e)||!L(t)){for(;(i=s.parentNode)&&i!==o&&i.nodeType===M&&1===i.childNodes.length;)s=i;_(s),a=e.childNodes.length,r=e.lastChild,r&&"BR"===r.nodeName&&(e.removeChild(r),a-=1),e.appendChild(y(t)),n.setStart(e,a),n.collapse(!0),A(e,n),J&&(r=e.lastChild)&&"BR"===r.nodeName&&e.removeChild(r)}}function B(e,t){var n,o,i=e.previousSibling,r=e.firstChild,a=e.ownerDocument,s="LI"===e.nodeName;if((!s||r&&/^[OU]L$/.test(r.nodeName))&&!L(e))if(i&&f(i,e)&&i.isContentEditable&&e.isContentEditable){if(!d(i)){if(!s)return;o=T(a,"DIV"),o.appendChild(y(i)),i.appendChild(o)}_(e),n=!d(e),i.appendChild(y(e)),n&&b(i,t),r&&B(r,t)}else s&&(i=T(a,"DIV"),e.insertBefore(i,r),E(i,t))}function D(e){this.isShiftDown=e.shiftKey}function R(e,t,n){var o,i;if(e||(e={}),t)for(o in t)!n&&o in e||(i=t[o],e[o]=i&&i.constructor===Object?R(e[o],i,n):i);return e}function P(e,t){e.nodeType===W&&(e=e.body);var n,o=e.ownerDocument,i=o.defaultView;this._win=i,this._doc=o,this._root=e,this._events={},this._isFocused=!1,this._lastSelection=null,ae&&this.addEventListener("beforedeactivate",this.getSelection),this._hasZWS=!1,this._lastAnchorNode=null,this._lastFocusNode=null,this._path="",this._willUpdatePath=!1,"onselectionchange"in o?this.addEventListener("selectionchange",this._updatePathOnEvent):(this.addEventListener("keyup",this._updatePathOnEvent),this.addEventListener("mouseup",this._updatePathOnEvent)),this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0,this._isInUndoState=!1,this._ignoreChange=!1,this._ignoreAllChanges=!1,se?(n=new MutationObserver(this._docWasChanged.bind(this)),n.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._mutation=n):this.addEventListener("keyup",this._keyUpDetectChange),this._restoreSelection=!1,this.addEventListener("blur",U),this.addEventListener("mousedown",I),this.addEventListener("touchstart",I),this.addEventListener("focus",w),this._awaitingPaste=!1,this.addEventListener(X?"beforecut":"cut",tt),this.addEventListener("copy",nt),this.addEventListener("keydown",D),this.addEventListener("keyup",D),this.addEventListener(X?"beforepaste":"paste",ot),this.addEventListener("drop",it),this.addEventListener(J?"keypress":"keydown",Ie),this._keyHandlers=Object.create(He),this.setConfig(t),X&&(i.Text.prototype.splitText=function(e){var t=this.ownerDocument.createTextNode(this.data.slice(e)),n=this.nextSibling,o=this.parentNode,i=this.length-e;return n?o.insertBefore(t,n):o.appendChild(t),i&&this.deleteData(e,i),t}),e.setAttribute("contenteditable","true");try{o.execCommand("enableObjectResizing",!1,"false"),o.execCommand("enableInlineTableEditing",!1,"false")}catch(e){}e.__squire__=this,this.setHTML("")}function U(){this._restoreSelection=!0}function I(){this._restoreSelection=!1}function w(){this._restoreSelection&&this.setSelection(this._lastSelection)}function F(e,t,n){var o,i;for(o=t.firstChild;o;o=i){if(i=o.nextSibling,a(o)){if(o.nodeType===H||"BR"===o.nodeName||"IMG"===o.nodeName){n.appendChild(o);continue}}else if(s(o)){n.appendChild(e.createDefaultBlock([F(e,o,e._doc.createDocumentFragment())]));continue}F(e,o,n)}return n}var M=1,H=3,W=9,z=11,q=1,K="​",G=e.defaultView,Z=navigator.userAgent,j=/Android/.test(Z),Q=/iP(?:ad|hone|od)/.test(Z),$=/Mac OS X/.test(Z),V=/Windows NT/.test(Z),Y=/Gecko\//.test(Z),X=/Trident\/[456]\./.test(Z),J=!!G.opera,ee=/Edge\//.test(Z),te=!ee&&/WebKit\//.test(Z),ne=/Trident\/[4567]\./.test(Z),oe=$?"meta-":"ctrl-",ie=X||J,re=X||te,ae=X,se="undefined"!=typeof MutationObserver,de="undefined"!=typeof WeakMap,le=/[^ \t\r\n]/,ce=Array.prototype.indexOf;Object.create||(Object.create=function(e){var t=function(){};return t.prototype=e,new t});var he={1:1,2:2,3:4,8:128,9:256,11:1024},ue=function(){return!0};n.prototype.nextNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.firstChild;!e&&t&&t!==n;)(e=t.nextSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){if(t===n)return null;if(e=t.previousSibling)for(;t=e.lastChild;)e=t;else e=t.parentNode;if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousPONode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.lastChild;!e&&t&&t!==n;)(e=t.previousSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}};var fe=/^(?:#text|A(?:BBR|CRONYM)?|B(?:R|D[IO])?|C(?:ITE|ODE)|D(?:ATA|EL|FN)|EM|FONT|I(?:FRAME|MG|NPUT|NS)?|KBD|Q|R(?:P|T|UBY)|S(?:AMP|MALL|PAN|TR(?:IKE|ONG)|U[BP])?|TIME|U|VAR|WBR)$/,pe={BR:1,HR:1,IFRAME:1,IMG:1,INPUT:1},ge=0,me=1,ve=2,Ne=3,Ce=de?new WeakMap:null,_e=function(e,t){for(var n=e.childNodes;t&&e.nodeType===M;)e=n[t-1],n=e.childNodes,t=n.length;return e},Se=function(e,t){if(e.nodeType===M){var n=e.childNodes;if(t-1,r=e.compareBoundaryPoints(1,o)<1;return!i&&!r}var a=e.compareBoundaryPoints(0,o)<1,s=e.compareBoundaryPoints(2,o)>-1;return a&&s},ke=function(e){for(var t,n=e.startContainer,o=e.startOffset,r=e.endContainer,a=e.endOffset,s=!0;n.nodeType!==H&&(t=n.childNodes[o])&&!i(t);)n=t,o=0;if(a)for(;r.nodeType!==H;){if(!(t=r.childNodes[a-1])||i(t)){if(s&&t&&"BR"===t.nodeName){a-=1,s=!1;continue}break}r=t,a=C(r)}else for(;r.nodeType!==H&&(t=r.firstChild)&&!i(t);)r=t;e.collapsed?(e.setStart(r,a),e.setEnd(n,o)):(e.setStart(n,o),e.setEnd(r,a))},Ae=function(e,t,n,o){var i,r=e.startContainer,a=e.startOffset,s=e.endContainer,d=e.endOffset,l=!0;for(t||(t=e.commonAncestorContainer),n||(n=t);!a&&r!==t&&r!==o;)i=r.parentNode,a=ce.call(i.childNodes,r),r=i;for(;;){if(l&&s.nodeType!==H&&s.childNodes[d]&&"BR"===s.childNodes[d].nodeName&&(d+=1,l=!1),s===n||s===o||d!==C(s))break;i=s.parentNode,d=ce.call(i.childNodes,s)+1,s=i}e.setStart(r,a),e.setEnd(s,d)},Le=function(e,t){var n,o=e.startContainer;return a(o)?n=c(o,t):o!==t&&s(o)?n=o:(n=_e(o,e.startOffset),n=h(n,t)),n&&xe(e,n,!0)?n:null},Oe=function(e,t){var n,o,i=e.endContainer;if(a(i))n=c(i,t);else if(i!==t&&s(i))n=i;else{if(!(n=Se(i,e.endOffset))||!v(t,n))for(n=t;o=n.lastChild;)n=o;n=c(n,t)}return n&&xe(e,n,!0)?n:null},Be=new n(null,4|q,function(e){return e.nodeType===H?le.test(e.data):"IMG"===e.nodeName}),De=function(e,t){var n,o=e.startContainer,i=e.startOffset;if(Be.root=null,o.nodeType===H){if(i)return!1;n=o}else if(n=Se(o,i),n&&!v(t,n)&&(n=null),!n&&(n=_e(o,i),n.nodeType===H&&n.length))return!1;return Be.currentNode=n,Be.root=Le(e,t),!Be.previousNode()},Re=function(e,t){var n,o=e.endContainer,i=e.endOffset;if(Be.root=null,o.nodeType===H){if((n=o.data.length)&&i-1||!Y&&ce.call(i,"text/plain")>-1&&ce.call(i,"text/rtf")<0))return e.preventDefault(),void(!d&&(r=a.getData("text/html"))?this.insertHTML(r,!0):((r=a.getData("text/plain"))||(r=a.getData("text/uri-list")))&&this.insertPlainText(r,!0));this._awaitingPaste=!0;var f=this._doc.body,p=this.getSelection(),g=p.startContainer,m=p.startOffset,v=p.endContainer,N=p.endOffset,C=this.createElement("DIV",{contenteditable:"true",style:"position:fixed; overflow:hidden; top:0; right:100%; width:1px; height:1px;"});f.appendChild(C),p.selectNodeContents(C),this.setSelection(p),setTimeout(function(){try{u._awaitingPaste=!1;for(var e,t,n="",o=C;C=o;)o=C.nextSibling,_(C),e=C.firstChild,e&&e===C.lastChild&&"DIV"===e.nodeName&&(C=e),n+=C.innerHTML;t=u.createRange(g,m,v,N),u.setSelection(t),n&&u.insertHTML(n,!0)}catch(e){u.didError(e)}},0)},it=function(e){for(var t=e.dataTransfer.types,n=t.length,o=!1,i=!1;n--;)switch(t[n]){case"text/plain":o=!0;break;case"text/html":i=!0;break;default:return}(i||o)&&this.saveUndoState()},rt=P.prototype,at=function(e,t,n){var o=n._doc,i=e?DOMPurify.sanitize(e,{ALLOW_UNKNOWN_PROTOCOLS:!0,WHOLE_DOCUMENT:!1,RETURN_DOM:!0,RETURN_DOM_FRAGMENT:!0}):null;return i?o.importNode(i,!0):o.createDocumentFragment()};rt.setConfig=function(e){return e=R({blockTag:"DIV",blockAttributes:null,tagAttributes:{blockquote:null,ul:null,ol:null,li:null,a:null},classNames:{colour:"colour",fontFamily:"font",fontSize:"size",highlight:"highlight"},leafNodeNames:pe,undo:{documentSizeThreshold:-1,undoLimit:-1},isInsertedHTMLSanitized:!0,isSetHTMLSanitized:!0,sanitizeToDOMFragment:"undefined"!=typeof DOMPurify&&DOMPurify.isSupported?at:null,willCutCopy:null},e,!0),e.blockTag=e.blockTag.toUpperCase(),this._config=e,this},rt.createElement=function(e,t,n){return T(this._doc,e,t,n)},rt.createDefaultBlock=function(e){var t=this._config;return E(this.createElement(t.blockTag,t.blockAttributes,e),this._root)},rt.didError=function(e){console.log(e)},rt.getDocument=function(){return this._doc},rt.getRoot=function(){return this._root},rt.modifyDocument=function(e){var t=this._mutation;t&&(t.takeRecords().length&&this._docWasChanged(),t.disconnect()),this._ignoreAllChanges=!0,e(),this._ignoreAllChanges=!1,t&&(t.observe(this._root,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._ignoreChange=!1)};var st={pathChange:1,select:1,input:1,undoStateChange:1};rt.fireEvent=function(e,t){var n,o,i,r=this._events[e];if(/^(?:focus|blur)/.test(e))if(n=this._root===this._doc.activeElement,"focus"===e){if(!n||this._isFocused)return this;this._isFocused=!0}else{if(n||!this._isFocused)return this;this._isFocused=!1}if(r)for(t||(t={}),t.type!==e&&(t.type=e),r=r.slice(),o=r.length;o--;){i=r[o];try{i.handleEvent?i.handleEvent(t):i.call(this,t)}catch(t){t.details="Squire: fireEvent error. Event type: "+e,this.didError(t)}}return this},rt.destroy=function(){var e,t=this._events;for(e in t)this.removeEventListener(e);this._mutation&&this._mutation.disconnect(),delete this._root.__squire__,this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0},rt.handleEvent=function(e){this.fireEvent(e.type,e)},rt.addEventListener=function(e,t){var n=this._events[e],o=this._root;return t?(n||(n=this._events[e]=[],st[e]||("selectionchange"===e&&(o=this._doc),o.addEventListener(e,this,!0))),n.push(t),this):(this.didError({name:"Squire: addEventListener with null or undefined fn",message:"Event type: "+e}),this)},rt.removeEventListener=function(e,t){var n,o=this._events[e],i=this._root;if(o){if(t)for(n=o.length;n--;)o[n]===t&&o.splice(n,1);else o.length=0;o.length||(delete this._events[e],st[e]||("selectionchange"===e&&(i=this._doc),i.removeEventListener(e,this,!0)))}return this},rt.createRange=function(e,t,n,o){if(e instanceof this._win.Range)return e.cloneRange();var i=this._doc.createRange();return i.setStart(e,t),n?i.setEnd(n,o):i.setEnd(e,t),i},rt.getCursorPosition=function(e){if(!e&&!(e=this.getSelection())||!e.getBoundingClientRect)return null;var t,n,o=e.getBoundingClientRect();return o&&!o.top&&(this._ignoreChange=!0,t=this._doc.createElement("SPAN"),t.textContent=K,ye(e,t),o=t.getBoundingClientRect(),n=t.parentNode,n.removeChild(t),A(n,e)),o},rt._moveCursorTo=function(e){var t=this._root,n=this.createRange(t,e?0:t.childNodes.length);return ke(n),this.setSelection(n),this},rt.moveCursorToStart=function(){return this._moveCursorTo(!0)},rt.moveCursorToEnd=function(){return this._moveCursorTo(!1)};var dt=function(e){return e._win.getSelection()||null};rt.setSelection=function(e){if(e)if(this._lastSelection=e,this._isFocused)if(j&&!this._restoreSelection)U.call(this),this.blur(),this.focus();else{Q&&this._win.focus();var t=dt(this);t&&(t.removeAllRanges(),t.addRange(e))}else U.call(this);return this},rt.getSelection=function(){var e,t,n,o,r=dt(this),a=this._root;return this._isFocused&&r&&r.rangeCount&&(e=r.getRangeAt(0).cloneRange(),t=e.startContainer,n=e.endContainer,t&&i(t)&&e.setStartBefore(t),n&&i(n)&&e.setEndBefore(n)),e&&v(a,e.commonAncestorContainer)?this._lastSelection=e:(e=this._lastSelection,o=e.commonAncestorContainer,v(o.ownerDocument,o)||(e=null)),e||(e=this.createRange(a.firstChild,0)),e},rt.getSelectedText=function(){var e=this.getSelection();if(!e||e.collapsed)return"";var t,o=new n(e.commonAncestorContainer,4|q,function(t){return xe(e,t,!0)}),i=e.startContainer,r=e.endContainer,s=o.currentNode=i,d="",l=!1;for(o.filter(s)||(s=o.nextNode());s;)s.nodeType===H?(t=s.data)&&/\S/.test(t)&&(s===r&&(t=t.slice(0,e.endOffset)),s===i&&(t=t.slice(e.startOffset)),d+=t,l=!0):("BR"===s.nodeName||l&&!a(s))&&(d+="\n",l=!1),s=o.nextNode();return d},rt.getPath=function(){return this._path};var lt=function(e,t){for(var o,i,r,s=new n(e,4);i=s.nextNode();)for(;(r=i.data.indexOf(K))>-1&&(!t||i.parentNode!==t);){if(1===i.length){do{o=i.parentNode,o.removeChild(i),i=o,s.currentNode=o}while(a(i)&&!C(i));break}i.deleteData(r,1)}};rt._didAddZWS=function(){this._hasZWS=!0},rt._removeZWS=function(){this._hasZWS&&(lt(this._root),this._hasZWS=!1)},rt._updatePath=function(e,t){if(e){var n,o=e.startContainer,i=e.endContainer;(t||o!==this._lastAnchorNode||i!==this._lastFocusNode)&&(this._lastAnchorNode=o,this._lastFocusNode=i,n=o&&i?o===i?N(i,this._root,this._config):"(selection)":"",this._path!==n&&(this._path=n,this.fireEvent("pathChange",{path:n}))),this.fireEvent(e.collapsed?"cursor":"select",{range:e})}}, -rt._updatePathOnEvent=function(e){var t=this;t._isFocused&&!t._willUpdatePath&&(t._willUpdatePath=!0,setTimeout(function(){t._willUpdatePath=!1,t._updatePath(t.getSelection())},0))},rt.focus=function(){if(ne){try{this._root.setActive()}catch(e){}this.fireEvent("focus")}else this._root.focus();return this},rt.blur=function(){return this._root.blur(),ne&&this.fireEvent("blur"),this};var ct="squire-selection-end";rt._saveRangeToBookmark=function(e){var t,n=this.createElement("INPUT",{id:"squire-selection-start",type:"hidden"}),o=this.createElement("INPUT",{id:ct,type:"hidden"});ye(e,n),e.collapse(!1),ye(e,o),2&n.compareDocumentPosition(o)&&(n.id=ct,o.id="squire-selection-start",t=n,n=o,o=t),e.setStartAfter(n),e.setEndBefore(o)},rt._getRangeAndRemoveBookmark=function(e){var t=this._root,n=t.querySelector("#squire-selection-start"),o=t.querySelector("#"+ct);if(n&&o){var i=n.parentNode,r=o.parentNode,a=ce.call(i.childNodes,n),s=ce.call(r.childNodes,o);i===r&&(s-=1),_(n),_(o),e||(e=this._doc.createRange()),e.setStart(i,a),e.setEnd(r,s),A(i,e),i!==r&&A(r,e),e.collapsed&&(i=e.startContainer,i.nodeType===H&&(r=i.childNodes[e.startOffset],r&&r.nodeType===H||(r=i.childNodes[e.startOffset-1]),r&&r.nodeType===H&&(e.setStart(r,0),e.collapse(!0))))}return e||null},rt._keyUpDetectChange=function(e){var t=e.keyCode;e.ctrlKey||e.metaKey||e.altKey||!(t<16||t>20)||!(t<33||t>45)||this._docWasChanged()},rt._docWasChanged=function(){if(de&&(Ce=new WeakMap),!this._ignoreAllChanges){if(se&&this._ignoreChange)return void(this._ignoreChange=!1);this._isInUndoState&&(this._isInUndoState=!1,this.fireEvent("undoStateChange",{canUndo:!0,canRedo:!1})),this.fireEvent("input")}},rt._recordUndoState=function(e,t){if(!this._isInUndoState||t){var n,o=this._undoIndex,i=this._undoStack,r=this._config.undo,a=r.documentSizeThreshold,s=r.undoLimit;t||(o+=1),o-1&&2*n.length>a&&s>-1&&o>s&&(i.splice(0,o-s),o=s,this._undoStackLength=s),i[o]=n,this._undoIndex=o,this._undoStackLength+=1,this._isInUndoState=!0}},rt.saveUndoState=function(e){return e===t&&(e=this.getSelection()),this._recordUndoState(e,this._isInUndoState),this._getRangeAndRemoveBookmark(e),this},rt.undo=function(){if(0!==this._undoIndex||!this._isInUndoState){this._recordUndoState(this.getSelection(),!1),this._undoIndex-=1,this._setHTML(this._undoStack[this._undoIndex]);var e=this._getRangeAndRemoveBookmark();e&&this.setSelection(e),this._isInUndoState=!0,this.fireEvent("undoStateChange",{canUndo:0!==this._undoIndex,canRedo:!0}),this.fireEvent("input")}return this},rt.redo=function(){var e=this._undoIndex,t=this._undoStackLength;if(e+1c&&h.splitText(c),h===s&&l&&(h=h.splitText(l),d===s&&(d=h,c-=l),s=h,l=0),i=this.createElement(e,t),S(h,i),i.appendChild(h))}while(r.nextNode());d.nodeType!==H&&(h.nodeType===H?(d=h,c=h.length):(d=h.parentNode,c=1)),o=this.createRange(s,l,d,c)}return o},rt._removeFormat=function(e,t,n,o){this._saveRangeToBookmark(n);var i,r=this._doc;n.collapsed&&(re?(i=r.createTextNode(K),this._didAddZWS()):i=r.createTextNode(""),ye(n,i));for(var s=n.commonAncestorContainer;a(s);)s=s.parentNode;var d=n.startContainer,l=n.startOffset,c=n.endContainer,h=n.endOffset,u=[],f=function(e,t){if(!xe(n,e,!1)){var o,i,r=e.nodeType===H;if(!xe(n,e,!0))return void("INPUT"===e.nodeName||r&&!e.data||u.push([t,e]));if(r)e===c&&h!==e.length&&u.push([t,e.splitText(h)]),e===d&&l&&(e.splitText(l),u.push([t,e]));else for(o=e.firstChild;o;o=i)i=o.nextSibling,f(o,t)}},g=Array.prototype.filter.call(s.getElementsByTagName(e),function(o){return xe(n,o,!0)&&p(o,e,t)});return o||g.forEach(function(e){f(e,e)}),u.forEach(function(e){var t=e[0].cloneNode(!1),n=e[1];S(n,t),t.appendChild(n)}),g.forEach(function(e){S(e,y(e))}),this._getRangeAndRemoveBookmark(n),i&&n.collapse(!1),A(s,n),n},rt.changeFormat=function(e,t,n,o){return n||(n=this.getSelection())?(this.saveUndoState(n),t&&(n=this._removeFormat(t.tag.toUpperCase(),t.attributes||{},n,o)),e&&(n=this._addFormat(e.tag.toUpperCase(),e.attributes||{},n)),this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged(),this):this};var ht={DT:"DD",DD:"DT",LI:"LI",PRE:"PRE"},ut=function(e,t,n,o){var i=ht[t.nodeName],r=null,a=x(n,o,t.parentNode,e._root),s=e._config;return i||(i=s.blockTag,r=s.blockAttributes),p(a,i,r)||(t=T(a.ownerDocument,i,r),a.dir&&(t.dir=a.dir),S(a,t),t.appendChild(y(a)),a=t),a};rt.forEachBlock=function(e,t,n){if(!n&&!(n=this.getSelection()))return this;t&&this.saveUndoState(n);var o=this._root,i=Le(n,o),r=Oe(n,o);if(i&&r)do{if(e(i)||i===r)break}while(i=h(i,o));return t&&(this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged()),this},rt.modifyBlocks=function(e,t){if(!t&&!(t=this.getSelection()))return this;this._recordUndoState(t,this._isInUndoState);var n,o=this._root;return Pe(t,o),Ae(t,o,o,o),n=Te(t,o,o),ye(t,e.call(this,n)),t.endOffset]+|\([^\s()<>]+\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))|([\w\-.%+]+@(?:[\w\-]+\.)+[A-Z]{2,}\b)(?:\?[^&?\s]+=[^&?\s]+(?:&[^&?\s]+=[^&?\s]+)*)?/i;var St=function(e,t,o){var i,r,a,s,d,l,c,h=e.ownerDocument,u=new n(e,4,function(e){return!g(e,t,"A")}),f=o.linkRegExp,p=o._config.tagAttributes.a;if(f)for(;i=u.nextNode();)for(r=i.data,a=i.parentNode;s=f.exec(r);)d=s.index,l=d+s[0].length,d&&(c=h.createTextNode(r.slice(0,d)),a.insertBefore(c,i)),c=o.createElement("A",R({href:s[1]?/^(?:ht|f)tps?:/i.test(s[1])?s[1]:"http://"+s[1]:"mailto:"+s[0]},p,!1)),c.textContent=r.slice(d,l),a.insertBefore(c,i),i.data=r=r.slice(l)};rt.insertHTML=function(e,t){var n,o,i,r,a,s,d,l=this._config,c=l.isInsertedHTMLSanitized?l.sanitizeToDOMFragment:null,u=this.getSelection(),f=this._doc;"function"==typeof c?r=c(e,t,this):(t&&(n=e.indexOf("\x3c!--StartFragment--\x3e"),o=e.lastIndexOf("\x3c!--EndFragment--\x3e"),n>-1&&o>-1&&(e=e.slice(n+20,o))),/<\/td>((?!<\/tr>)[\s\S])*$/i.test(e)&&(e=""+e+""),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(e)&&(e=""+e+"
    "),i=this.createElement("DIV"),i.innerHTML=e,r=f.createDocumentFragment(),r.appendChild(y(i))),this.saveUndoState(u);try{for(a=this._root,s=r,d={fragment:r,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},St(r,r,this),$e(r,l),Je(r,a,!1),Ve(r),r.normalize();s=h(s,r);)E(s,a);t&&this.fireEvent("willPaste",d),d.defaultPrevented||(be(u,d.fragment,a),se||this._docWasChanged(),u.collapse(!1),this._ensureBottomLine()),this.setSelection(u),this._updatePath(u,!0),t&&this.focus()}catch(e){this.didError(e)}return this};var yt=function(e){return e.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""")};rt.insertPlainText=function(e,t){var n=this.getSelection();if(n.collapsed&&g(n.startContainer,this._root,"PRE")){var o,i,r=n.startContainer,a=n.startOffset;return r&&r.nodeType===H||(o=this._doc.createTextNode(""),r.insertBefore(o,r.childNodes[a]),r=o,a=0),i={text:e,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},t&&this.fireEvent("willPaste",i),i.defaultPrevented||(e=i.text,r.insertData(a,e),n.setStart(r,a+e.length),n.collapse(!0)),this.setSelection(n),this}var s,d,l,c,h=e.split("\n"),u=this._config,f=u.blockTag,p=u.blockAttributes,m="",v="<"+f;for(s in p)v+=" "+s+'="'+yt(p[s])+'"';for(v+=">",d=0,l=h.length;d")+m;return this.insertHTML(h.join(""),t)};var Tt=function(e,t,n){return function(){return this[e](t,n),this.focus()}};rt.addStyles=function(e){if(e){var t=this._doc.documentElement.firstChild,n=this.createElement("STYLE",{type:"text/css"});n.appendChild(this._doc.createTextNode(e)),t.appendChild(n)}return this},rt.bold=Tt("changeFormat",{tag:"B"}),rt.italic=Tt("changeFormat",{tag:"I"}),rt.underline=Tt("changeFormat",{tag:"U"}),rt.strikethrough=Tt("changeFormat",{tag:"S"}),rt.subscript=Tt("changeFormat",{tag:"SUB"},{tag:"SUP"}),rt.superscript=Tt("changeFormat",{tag:"SUP"},{tag:"SUB"}),rt.removeBold=Tt("changeFormat",null,{tag:"B"}),rt.removeItalic=Tt("changeFormat",null,{tag:"I"}),rt.removeUnderline=Tt("changeFormat",null,{tag:"U"}),rt.removeStrikethrough=Tt("changeFormat",null,{tag:"S"}),rt.removeSubscript=Tt("changeFormat",null,{tag:"SUB"}),rt.removeSuperscript=Tt("changeFormat",null,{tag:"SUP"}),rt.makeLink=function(e,t){var n=this.getSelection();if(n.collapsed){var o=e.indexOf(":")+1;if(o)for(;"/"===e[o];)o+=1;ye(n,this._doc.createTextNode(e.slice(o)))}return t=R(R({href:e},t,!0),this._config.tagAttributes.a,!1),this.changeFormat({tag:"A",attributes:t},{tag:"A"},n),this.focus()},rt.removeLink=function(){return this.changeFormat(null,{tag:"A"},this.getSelection(),!0),this.focus()},rt.setFontFace=function(e){var t=this._config.classNames.fontFamily;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-family: "+e+", sans-serif;"}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setFontSize=function(e){var t=this._config.classNames.fontSize;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-size: "+("number"==typeof e?e+"px":e)}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setTextColour=function(e){var t=this._config.classNames.colour;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"color:"+e}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setHighlightColour=function(e){var t=this._config.classNames.highlight;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"background-color:"+e}}:e,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setTextAlignment=function(e){return this.forEachBlock(function(t){var n=t.className.split(/\s+/).filter(function(e){return!!e&&!/^align/.test(e)}).join(" ");e?(t.className=n+" align-"+e,t.style.textAlign=e):(t.className=n,t.style.textAlign="")},!0),this.focus()},rt.setTextDirection=function(e){return this.forEachBlock(function(t){e?t.dir=e:t.removeAttribute("dir")},!0),this.focus()};var Et=function(e){for(var t,o=this._root,i=this._doc,r=i.createDocumentFragment(),a=l(e,o);t=a.nextNode();){var s,d,c=t.querySelectorAll("BR"),h=[],u=c.length;for(s=0;s-1;)a.appendChild(d.createTextNode(r.slice(0,s))),a.appendChild(d.createElement("BR")),r=r.slice(s+1);i.parentNode.insertBefore(a,i),i.data=r}b(t,l),S(t,y(t))}return e};rt.code=function(){var e=this.getSelection();return e.collapsed||d(e.commonAncestorContainer)?this.modifyBlocks(Et,e):this.changeFormat({tag:"CODE",attributes:this._config.tagAttributes.code},null,e),this.focus()},rt.removeCode=function(){var e=this.getSelection();return g(e.commonAncestorContainer,this._root,"PRE")?this.modifyBlocks(bt,e):this.changeFormat(null,{tag:"CODE"},e),this.focus()},rt.toggleCode=function(){return this.hasFormat("PRE")||this.hasFormat("CODE")?this.removeCode():this.code(),this},rt.removeAllFormatting=function(e){if(!e&&!(e=this.getSelection())||e.collapsed)return this;for(var t=this._root,n=e.commonAncestorContainer;n&&!s(n);)n=n.parentNode;if(n||(Pe(e,t),n=t),n.nodeType===H)return this;this.saveUndoState(e),Ae(e,n,n,t);for(var o,i,r=n.ownerDocument,a=e.startContainer,d=e.startOffset,l=e.endContainer,c=e.endOffset,h=r.createDocumentFragment(),u=r.createDocumentFragment(),f=x(l,c,n,t),p=x(a,d,n,t);p!==f;)o=p.nextSibling,h.appendChild(p),p=o;return F(this,h,u),u.normalize(),p=u.firstChild,o=u.lastChild,i=n.childNodes,p?(n.insertBefore(u,f),d=ce.call(i,p),c=ce.call(i,o)+1):(d=ce.call(i,f),c=d),e.setStart(n,d),e.setEnd(n,c),A(n,e),ke(e),this.setSelection(e),this._updatePath(e,!0),this.focus()},rt.increaseQuoteLevel=Tt("modifyBlocks",ft),rt.decreaseQuoteLevel=Tt("modifyBlocks",pt),rt.makeUnorderedList=Tt("modifyBlocks",vt),rt.makeOrderedList=Tt("modifyBlocks",Nt),rt.removeList=Tt("modifyBlocks",Ct),P.isInline=a,P.isBlock=s,P.isContainer=d,P.getBlockWalker=l,P.getPreviousBlock=c,P.getNextBlock=h,P.areAlike=f,P.hasTagAttributes=p,P.getNearest=g,P.isOrContains=v,P.detach=_,P.replaceWith=S,P.empty=y,P.getNodeBefore=_e,P.getNodeAfter=Se,P.insertNodeInRange=ye,P.extractContentsOfRange=Te,P.deleteContentsOfRange=Ee,P.insertTreeFragmentIntoRange=be,P.isNodeContainedInRange=xe,P.moveRangeBoundariesDownTree=ke,P.moveRangeBoundariesUpTree=Ae,P.getStartBlockOfRange=Le,P.getEndBlockOfRange=Oe,P.contentWalker=Be,P.rangeDoesStartAtBlockBoundary=De,P.rangeDoesEndAtBlockBoundary=Re,P.expandRangeToBlockBoundaries=Pe,P.onPaste=ot,P.addLinks=St,P.splitBlock=ut,P.startSelectionId="squire-selection-start",P.endSelectionId=ct,"object"==typeof exports?module.exports=P:"function"==typeof define&&define.amd?define(function(){return P}):(G.Squire=P,top!==G&&"true"===e.documentElement.getAttribute("data-squireinit")&&(G.editor=new P(e),G.onEditorLoad&&(G.onEditorLoad(G.editor),G.onEditorLoad=null)))}(document); \ No newline at end of file +!function(e,t){"use strict";function n(e,t,n){this.root=this.currentNode=e,this.nodeType=t,this.filter=n||ue}function o(e,t){for(var n=e.length;n--;)if(!t(e[n]))return!1;return!0}function i(e){return e.nodeType===M&&!!pe[e.nodeName]}function r(e){switch(e.nodeType){case H:return me;case M:case z:if(de&&Ce.has(e))return Ce.get(e);break;default:return ge}var t;return t=o(e.childNodes,a)?fe.test(e.nodeName)?me:ve:Ne,de&&Ce.set(e,t),t}function a(e){return r(e)===me}function s(e){return r(e)===ve}function d(e){return r(e)===Ne}function l(e,t){var o=new n(t,q,s);return o.currentNode=e,o}function c(e,t){return e=l(e,t).previousNode(),e!==t?e:null}function h(e,t){return e=l(e,t).nextNode(),e!==t?e:null}function u(e){return!e.textContent&&!e.querySelector("IMG")}function f(e,t){return!i(e)&&e.nodeType===t.nodeType&&e.nodeName===t.nodeName&&"A"!==e.nodeName&&e.className===t.className&&(!e.style&&!t.style||e.style.cssText===t.style.cssText)}function p(e,t,n){if(e.nodeName!==t)return!1;for(var o in n)if(e.getAttribute(o)!==n[o])return!1;return!0}function g(e,t,n,o){for(;e&&e!==t;){if(p(e,n,o))return e;e=e.parentNode}return null}function m(e,t,n){for(;e&&e!==t;){if(n.test(e.nodeName))return e;e=e.parentNode}return null}function v(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function N(e,t,n){var o,i,r,a,s,d="";return e&&e!==t&&(d=N(e.parentNode,t,n),e.nodeType===M&&(d+=(d?">":"")+e.nodeName,(o=e.id)&&(d+="#"+o),(i=e.className.trim())&&(r=i.split(/\s\s*/),r.sort(),d+=".",d+=r.join(".")),(a=e.dir)&&(d+="[dir="+a+"]"),r&&(s=n.classNames,ce.call(r,s.highlight)>-1&&(d+="[backgroundColor="+e.style.backgroundColor.replace(/ /g,"")+"]"),ce.call(r,s.colour)>-1&&(d+="[color="+e.style.color.replace(/ /g,"")+"]"),ce.call(r,s.fontFamily)>-1&&(d+="[fontFamily="+e.style.fontFamily.replace(/ /g,"")+"]"),ce.call(r,s.fontSize)>-1&&(d+="[fontSize="+e.style.fontSize+"]")))),d}function C(e){var t=e.nodeType;return t===M||t===z?e.childNodes.length:e.length||0}function _(e){var t=e.parentNode;return t&&t.removeChild(e),e}function S(e,t){var n=e.parentNode;n&&n.replaceChild(t,e)}function y(e){for(var t=e.ownerDocument.createDocumentFragment(),n=e.childNodes,o=n?n.length:0;o--;)t.appendChild(e.firstChild);return t}function T(e,n,o,i){var r,a,s,d=e.createElement(n);if(o instanceof Array&&(i=o,o=null),o)for(r in o)o[r]!==t&&d.setAttribute(r,o[r]);if(i)for(a=0,s=i.length;as?t.startOffset-=1:t.startOffset===s&&(t.startContainer=o,t.startOffset=C(o))),t.endContainer===e&&(t.endOffset>s?t.endOffset-=1:t.endOffset===s&&(t.endContainer=o,t.endOffset=C(o))),_(n),n.nodeType===H?o.appendData(n.data):d.push(y(n));else if(n.nodeType===M){for(i=d.length;i--;)n.appendChild(d.pop());k(n,t)}}function L(e,t){if(e.nodeType===H&&(e=e.parentNode),e.nodeType===M){var n={startContainer:t.startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset};k(e,n),t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset)}}function A(e){var t=e.nodeName;return"TD"===t||"TH"===t||"TR"===t||"TBODY"===t||"THEAD"===t}function O(e,t,n,o){var i,r,a,s=t;if(!A(e)||!A(t)){for(;(i=s.parentNode)&&i!==o&&i.nodeType===M&&1===i.childNodes.length;)s=i;_(s),a=e.childNodes.length,r=e.lastChild,r&&"BR"===r.nodeName&&(e.removeChild(r),a-=1),e.appendChild(y(t)),n.setStart(e,a),n.collapse(!0),L(e,n),J&&(r=e.lastChild)&&"BR"===r.nodeName&&e.removeChild(r)}}function B(e,t){var n,o,i=e.previousSibling,r=e.firstChild,a=e.ownerDocument,s="LI"===e.nodeName;if((!s||r&&/^[OU]L$/.test(r.nodeName))&&!A(e))if(i&&f(i,e)){if(!d(i)){if(!s)return;o=T(a,"DIV"),o.appendChild(y(i)),i.appendChild(o)}_(e),n=!d(e),i.appendChild(y(e)),n&&b(i,t),r&&B(r,t)}else s&&(i=T(a,"DIV"),e.insertBefore(i,r),E(i,t))}function D(e){this.isShiftDown=e.shiftKey}function R(e,t,n){var o,i;if(e||(e={}),t)for(o in t)!n&&o in e||(i=t[o],e[o]=i&&i.constructor===Object?R(e[o],i,n):i);return e}function P(e,t){e.nodeType===W&&(e=e.body);var n,o=e.ownerDocument,i=o.defaultView;this._win=i,this._doc=o,this._root=e,this._events={},this._isFocused=!1,this._lastSelection=null,ae&&this.addEventListener("beforedeactivate",this.getSelection),this._hasZWS=!1,this._lastAnchorNode=null,this._lastFocusNode=null,this._path="",this._willUpdatePath=!1,"onselectionchange"in o?this.addEventListener("selectionchange",this._updatePathOnEvent):(this.addEventListener("keyup",this._updatePathOnEvent),this.addEventListener("mouseup",this._updatePathOnEvent)),this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0,this._isInUndoState=!1,this._ignoreChange=!1,this._ignoreAllChanges=!1,se?(n=new MutationObserver(this._docWasChanged.bind(this)),n.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._mutation=n):this.addEventListener("keyup",this._keyUpDetectChange),this._restoreSelection=!1,this.addEventListener("blur",U),this.addEventListener("mousedown",I),this.addEventListener("touchstart",I),this.addEventListener("focus",w),this._awaitingPaste=!1,this.addEventListener(X?"beforecut":"cut",tt),this.addEventListener("copy",nt),this.addEventListener("keydown",D),this.addEventListener("keyup",D),this.addEventListener(X?"beforepaste":"paste",ot),this.addEventListener("drop",it),this.addEventListener(J?"keypress":"keydown",Ie),this._keyHandlers=Object.create(He),this.setConfig(t),X&&(i.Text.prototype.splitText=function(e){var t=this.ownerDocument.createTextNode(this.data.slice(e)),n=this.nextSibling,o=this.parentNode,i=this.length-e;return n?o.insertBefore(t,n):o.appendChild(t),i&&this.deleteData(e,i),t}),e.setAttribute("contenteditable","true");try{o.execCommand("enableObjectResizing",!1,"false"),o.execCommand("enableInlineTableEditing",!1,"false")}catch(e){}e.__squire__=this,this.setHTML("")}function U(){this._restoreSelection=!0}function I(){this._restoreSelection=!1}function w(){this._restoreSelection&&this.setSelection(this._lastSelection)}function F(e,t,n){var o,i;for(o=t.firstChild;o;o=i){if(i=o.nextSibling,a(o)){if(o.nodeType===H||"BR"===o.nodeName||"IMG"===o.nodeName){n.appendChild(o);continue}}else if(s(o)){n.appendChild(e.createDefaultBlock([F(e,o,e._doc.createDocumentFragment())]));continue}F(e,o,n)}return n}var M=1,H=3,W=9,z=11,q=1,K="​",G=e.defaultView,Z=navigator.userAgent,j=/Android/.test(Z),Q=/iP(?:ad|hone|od)/.test(Z),$=/Mac OS X/.test(Z),V=/Windows NT/.test(Z),Y=/Gecko\//.test(Z),X=/Trident\/[456]\./.test(Z),J=!!G.opera,ee=/Edge\//.test(Z),te=!ee&&/WebKit\//.test(Z),ne=/Trident\/[4567]\./.test(Z),oe=$?"meta-":"ctrl-",ie=X||J,re=X||te,ae=X,se="undefined"!=typeof MutationObserver,de="undefined"!=typeof WeakMap,le=/[^ \t\r\n]/,ce=Array.prototype.indexOf;Object.create||(Object.create=function(e){var t=function(){};return t.prototype=e,new t});var he={1:1,2:2,3:4,8:128,9:256,11:1024},ue=function(){return!0};n.prototype.nextNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.firstChild;!e&&t&&t!==n;)(e=t.nextSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){if(t===n)return null;if(e=t.previousSibling)for(;t=e.lastChild;)e=t;else e=t.parentNode;if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousPONode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.lastChild;!e&&t&&t!==n;)(e=t.previousSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}};var fe=/^(?:#text|A(?:BBR|CRONYM)?|B(?:R|D[IO])?|C(?:ITE|ODE)|D(?:ATA|EL|FN)|EM|FONT|I(?:FRAME|MG|NPUT|NS)?|KBD|Q|R(?:P|T|UBY)|S(?:AMP|MALL|PAN|TR(?:IKE|ONG)|U[BP])?|TIME|U|VAR|WBR)$/,pe={BR:1,HR:1,IFRAME:1,IMG:1,INPUT:1},ge=0,me=1,ve=2,Ne=3,Ce=de?new WeakMap:null,_e=function(e,t){for(var n=e.childNodes;t&&e.nodeType===M;)e=n[t-1],n=e.childNodes,t=n.length;return e},Se=function(e,t){if(e.nodeType===M){var n=e.childNodes;if(t-1,r=e.compareBoundaryPoints(1,o)<1;return!i&&!r}var a=e.compareBoundaryPoints(0,o)<1,s=e.compareBoundaryPoints(2,o)>-1;return a&&s},ke=function(e){for(var t,n=e.startContainer,o=e.startOffset,r=e.endContainer,a=e.endOffset,s=!0;n.nodeType!==H&&(t=n.childNodes[o])&&!i(t);)n=t,o=0;if(a)for(;r.nodeType!==H;){if(!(t=r.childNodes[a-1])||i(t)){if(s&&t&&"BR"===t.nodeName){a-=1,s=!1;continue}break}r=t,a=C(r)}else for(;r.nodeType!==H&&(t=r.firstChild)&&!i(t);)r=t;e.collapsed?(e.setStart(r,a),e.setEnd(n,o)):(e.setStart(n,o),e.setEnd(r,a))},Le=function(e,t,n,o){var i,r=e.startContainer,a=e.startOffset,s=e.endContainer,d=e.endOffset,l=!0;for(t||(t=e.commonAncestorContainer),n||(n=t);!a&&r!==t&&r!==o;)i=r.parentNode,a=ce.call(i.childNodes,r),r=i;for(;;){if(l&&s.nodeType!==H&&s.childNodes[d]&&"BR"===s.childNodes[d].nodeName&&(d+=1,l=!1),s===n||s===o||d!==C(s))break;i=s.parentNode,d=ce.call(i.childNodes,s)+1,s=i}e.setStart(r,a),e.setEnd(s,d)},Ae=function(e,t){var n,o=e.startContainer;return a(o)?n=c(o,t):o!==t&&s(o)?n=o:(n=_e(o,e.startOffset),n=h(n,t)),n&&xe(e,n,!0)?n:null},Oe=function(e,t){var n,o,i=e.endContainer;if(a(i))n=c(i,t);else if(i!==t&&s(i))n=i;else{if(!(n=Se(i,e.endOffset))||!v(t,n))for(n=t;o=n.lastChild;)n=o;n=c(n,t)}return n&&xe(e,n,!0)?n:null},Be=new n(null,4|q,function(e){return e.nodeType===H?le.test(e.data):"IMG"===e.nodeName}),De=function(e,t){var n,o=e.startContainer,i=e.startOffset;if(Be.root=null,o.nodeType===H){if(i)return!1;n=o}else if(n=Se(o,i),n&&!v(t,n)&&(n=null),!n&&(n=_e(o,i),n.nodeType===H&&n.length))return!1;return Be.currentNode=n,Be.root=Ae(e,t),!Be.previousNode()},Re=function(e,t){var n,o=e.endContainer,i=e.endOffset;if(Be.root=null,o.nodeType===H){if((n=o.data.length)&&i-1||!Y&&ce.call(i,"text/plain")>-1&&ce.call(i,"text/rtf")<0))return e.preventDefault(),void(!d&&(r=a.getData("text/html"))?this.insertHTML(r,!0):((r=a.getData("text/plain"))||(r=a.getData("text/uri-list")))&&this.insertPlainText(r,!0));this._awaitingPaste=!0;var f=this._doc.body,p=this.getSelection(),g=p.startContainer,m=p.startOffset,v=p.endContainer,N=p.endOffset,C=this.createElement("DIV",{contenteditable:"true",style:"position:fixed; overflow:hidden; top:0; right:100%; width:1px; height:1px;"});f.appendChild(C),p.selectNodeContents(C),this.setSelection(p),setTimeout(function(){try{u._awaitingPaste=!1;for(var e,t,n="",o=C;C=o;)o=C.nextSibling,_(C),e=C.firstChild,e&&e===C.lastChild&&"DIV"===e.nodeName&&(C=e),n+=C.innerHTML;t=u.createRange(g,m,v,N),u.setSelection(t),n&&u.insertHTML(n,!0)}catch(e){u.didError(e)}},0)},it=function(e){for(var t=e.dataTransfer.types,n=t.length,o=!1,i=!1;n--;)switch(t[n]){case"text/plain":o=!0;break;case"text/html":i=!0;break;default:return}(i||o)&&this.saveUndoState()},rt=P.prototype,at=function(e,t,n){var o=n._doc,i=e?DOMPurify.sanitize(e,{ALLOW_UNKNOWN_PROTOCOLS:!0,WHOLE_DOCUMENT:!1,RETURN_DOM:!0,RETURN_DOM_FRAGMENT:!0}):null;return i?o.importNode(i,!0):o.createDocumentFragment()};rt.setConfig=function(e){return e=R({blockTag:"DIV",blockAttributes:null,tagAttributes:{blockquote:null,ul:null,ol:null,li:null,a:null},classNames:{colour:"colour",fontFamily:"font",fontSize:"size",highlight:"highlight"},leafNodeNames:pe,undo:{documentSizeThreshold:-1,undoLimit:-1},isInsertedHTMLSanitized:!0,isSetHTMLSanitized:!0,sanitizeToDOMFragment:"undefined"!=typeof DOMPurify&&DOMPurify.isSupported?at:null,willCutCopy:null},e,!0),e.blockTag=e.blockTag.toUpperCase(),this._config=e,this},rt.createElement=function(e,t,n){return T(this._doc,e,t,n)},rt.createDefaultBlock=function(e){var t=this._config;return E(this.createElement(t.blockTag,t.blockAttributes,e),this._root)},rt.didError=function(e){console.log(e)},rt.getDocument=function(){return this._doc},rt.getRoot=function(){return this._root},rt.modifyDocument=function(e){var t=this._mutation;t&&(t.takeRecords().length&&this._docWasChanged(),t.disconnect()),this._ignoreAllChanges=!0,e(),this._ignoreAllChanges=!1,t&&(t.observe(this._root,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._ignoreChange=!1)};var st={pathChange:1,select:1,input:1,undoStateChange:1};rt.fireEvent=function(e,t){var n,o,i,r=this._events[e];if(/^(?:focus|blur)/.test(e))if(n=this._root===this._doc.activeElement,"focus"===e){if(!n||this._isFocused)return this;this._isFocused=!0}else{if(n||!this._isFocused)return this;this._isFocused=!1}if(r)for(t||(t={}),t.type!==e&&(t.type=e),r=r.slice(),o=r.length;o--;){i=r[o];try{i.handleEvent?i.handleEvent(t):i.call(this,t)}catch(t){t.details="Squire: fireEvent error. Event type: "+e,this.didError(t)}}return this},rt.destroy=function(){var e,t=this._events;for(e in t)this.removeEventListener(e);this._mutation&&this._mutation.disconnect(),delete this._root.__squire__,this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0},rt.handleEvent=function(e){this.fireEvent(e.type,e)},rt.addEventListener=function(e,t){var n=this._events[e],o=this._root;return t?(n||(n=this._events[e]=[],st[e]||("selectionchange"===e&&(o=this._doc),o.addEventListener(e,this,!0))),n.push(t),this):(this.didError({name:"Squire: addEventListener with null or undefined fn",message:"Event type: "+e}),this)},rt.removeEventListener=function(e,t){var n,o=this._events[e],i=this._root;if(o){if(t)for(n=o.length;n--;)o[n]===t&&o.splice(n,1);else o.length=0;o.length||(delete this._events[e],st[e]||("selectionchange"===e&&(i=this._doc),i.removeEventListener(e,this,!0)))}return this},rt.createRange=function(e,t,n,o){if(e instanceof this._win.Range)return e.cloneRange();var i=this._doc.createRange();return i.setStart(e,t),n?i.setEnd(n,o):i.setEnd(e,t),i},rt.getCursorPosition=function(e){if(!e&&!(e=this.getSelection())||!e.getBoundingClientRect)return null;var t,n,o=e.getBoundingClientRect();return o&&!o.top&&(this._ignoreChange=!0,t=this._doc.createElement("SPAN"),t.textContent=K,ye(e,t),o=t.getBoundingClientRect(),n=t.parentNode,n.removeChild(t),L(n,e)),o},rt._moveCursorTo=function(e){var t=this._root,n=this.createRange(t,e?0:t.childNodes.length);return ke(n),this.setSelection(n),this},rt.moveCursorToStart=function(){return this._moveCursorTo(!0)},rt.moveCursorToEnd=function(){return this._moveCursorTo(!1)};var dt=function(e){return e._win.getSelection()||null};rt.setSelection=function(e){if(e)if(this._lastSelection=e,this._isFocused)if(j&&!this._restoreSelection)U.call(this),this.blur(),this.focus();else{Q&&this._win.focus();var t=dt(this);t&&(t.removeAllRanges(),t.addRange(e))}else U.call(this);return this},rt.getSelection=function(){var e,t,n,o,r=dt(this),a=this._root;return this._isFocused&&r&&r.rangeCount&&(e=r.getRangeAt(0).cloneRange(),t=e.startContainer,n=e.endContainer,t&&i(t)&&e.setStartBefore(t),n&&i(n)&&e.setEndBefore(n)),e&&v(a,e.commonAncestorContainer)?this._lastSelection=e:(e=this._lastSelection,o=e.commonAncestorContainer,v(o.ownerDocument,o)||(e=null)),e||(e=this.createRange(a.firstChild,0)),e},rt.getSelectedText=function(){var e=this.getSelection();if(!e||e.collapsed)return"";var t,o=new n(e.commonAncestorContainer,4|q,function(t){return xe(e,t,!0)}),i=e.startContainer,r=e.endContainer,s=o.currentNode=i,d="",l=!1;for(o.filter(s)||(s=o.nextNode());s;)s.nodeType===H?(t=s.data)&&/\S/.test(t)&&(s===r&&(t=t.slice(0,e.endOffset)),s===i&&(t=t.slice(e.startOffset)),d+=t,l=!0):("BR"===s.nodeName||l&&!a(s))&&(d+="\n",l=!1),s=o.nextNode();return d},rt.getPath=function(){return this._path};var lt=function(e,t){for(var o,i,r,s=new n(e,4);i=s.nextNode();)for(;(r=i.data.indexOf(K))>-1&&(!t||i.parentNode!==t);){if(1===i.length){do{o=i.parentNode,o.removeChild(i),i=o,s.currentNode=o}while(a(i)&&!C(i));break}i.deleteData(r,1)}};rt._didAddZWS=function(){this._hasZWS=!0},rt._removeZWS=function(){this._hasZWS&&(lt(this._root),this._hasZWS=!1)},rt._updatePath=function(e,t){if(e){var n,o=e.startContainer,i=e.endContainer;(t||o!==this._lastAnchorNode||i!==this._lastFocusNode)&&(this._lastAnchorNode=o,this._lastFocusNode=i,n=o&&i?o===i?N(i,this._root,this._config):"(selection)":"",this._path!==n&&(this._path=n,this.fireEvent("pathChange",{path:n}))),this.fireEvent(e.collapsed?"cursor":"select",{range:e})}},rt._updatePathOnEvent=function(e){var t=this;t._isFocused&&!t._willUpdatePath&&(t._willUpdatePath=!0,setTimeout(function(){t._willUpdatePath=!1,t._updatePath(t.getSelection())},0))}, +rt.focus=function(){return this._root.focus(),ne&&this.fireEvent("focus"),this},rt.blur=function(){return this._root.blur(),ne&&this.fireEvent("blur"),this};var ct="squire-selection-end";rt._saveRangeToBookmark=function(e){var t,n=this.createElement("INPUT",{id:"squire-selection-start",type:"hidden"}),o=this.createElement("INPUT",{id:ct,type:"hidden"});ye(e,n),e.collapse(!1),ye(e,o),2&n.compareDocumentPosition(o)&&(n.id=ct,o.id="squire-selection-start",t=n,n=o,o=t),e.setStartAfter(n),e.setEndBefore(o)},rt._getRangeAndRemoveBookmark=function(e){var t=this._root,n=t.querySelector("#squire-selection-start"),o=t.querySelector("#"+ct);if(n&&o){var i=n.parentNode,r=o.parentNode,a=ce.call(i.childNodes,n),s=ce.call(r.childNodes,o);i===r&&(s-=1),_(n),_(o),e||(e=this._doc.createRange()),e.setStart(i,a),e.setEnd(r,s),L(i,e),i!==r&&L(r,e),e.collapsed&&(i=e.startContainer,i.nodeType===H&&(r=i.childNodes[e.startOffset],r&&r.nodeType===H||(r=i.childNodes[e.startOffset-1]),r&&r.nodeType===H&&(e.setStart(r,0),e.collapse(!0))))}return e||null},rt._keyUpDetectChange=function(e){var t=e.keyCode;e.ctrlKey||e.metaKey||e.altKey||!(t<16||t>20)||!(t<33||t>45)||this._docWasChanged()},rt._docWasChanged=function(){if(de&&(Ce=new WeakMap),!this._ignoreAllChanges){if(se&&this._ignoreChange)return void(this._ignoreChange=!1);this._isInUndoState&&(this._isInUndoState=!1,this.fireEvent("undoStateChange",{canUndo:!0,canRedo:!1})),this.fireEvent("input")}},rt._recordUndoState=function(e,t){if(!this._isInUndoState||t){var n,o=this._undoIndex,i=this._undoStack,r=this._config.undo,a=r.documentSizeThreshold,s=r.undoLimit;t||(o+=1),o-1&&2*n.length>a&&s>-1&&o>s&&(i.splice(0,o-s),o=s,this._undoStackLength=s),i[o]=n,this._undoIndex=o,this._undoStackLength+=1,this._isInUndoState=!0}},rt.saveUndoState=function(e){return e===t&&(e=this.getSelection()),this._recordUndoState(e,this._isInUndoState),this._getRangeAndRemoveBookmark(e),this},rt.undo=function(){if(0!==this._undoIndex||!this._isInUndoState){this._recordUndoState(this.getSelection(),!1),this._undoIndex-=1,this._setHTML(this._undoStack[this._undoIndex]);var e=this._getRangeAndRemoveBookmark();e&&this.setSelection(e),this._isInUndoState=!0,this.fireEvent("undoStateChange",{canUndo:0!==this._undoIndex,canRedo:!0}),this.fireEvent("input")}return this},rt.redo=function(){var e=this._undoIndex,t=this._undoStackLength;if(e+1c&&h.splitText(c),h===s&&l&&(h=h.splitText(l),d===s&&(d=h,c-=l),s=h,l=0),i=this.createElement(e,t),S(h,i),i.appendChild(h))}while(r.nextNode());d.nodeType!==H&&(h.nodeType===H?(d=h,c=h.length):(d=h.parentNode,c=1)),o=this.createRange(s,l,d,c)}return o},rt._removeFormat=function(e,t,n,o){this._saveRangeToBookmark(n);var i,r=this._doc;n.collapsed&&(re?(i=r.createTextNode(K),this._didAddZWS()):i=r.createTextNode(""),ye(n,i));for(var s=n.commonAncestorContainer;a(s);)s=s.parentNode;var d=n.startContainer,l=n.startOffset,c=n.endContainer,h=n.endOffset,u=[],f=function(e,t){if(!xe(n,e,!1)){var o,i,r=e.nodeType===H;if(!xe(n,e,!0))return void("INPUT"===e.nodeName||r&&!e.data||u.push([t,e]));if(r)e===c&&h!==e.length&&u.push([t,e.splitText(h)]),e===d&&l&&(e.splitText(l),u.push([t,e]));else for(o=e.firstChild;o;o=i)i=o.nextSibling,f(o,t)}},g=Array.prototype.filter.call(s.getElementsByTagName(e),function(o){return xe(n,o,!0)&&p(o,e,t)});return o||g.forEach(function(e){f(e,e)}),u.forEach(function(e){var t=e[0].cloneNode(!1),n=e[1];S(n,t),t.appendChild(n)}),g.forEach(function(e){S(e,y(e))}),this._getRangeAndRemoveBookmark(n),i&&n.collapse(!1),L(s,n),n},rt.changeFormat=function(e,t,n,o){return n||(n=this.getSelection())?(this.saveUndoState(n),t&&(n=this._removeFormat(t.tag.toUpperCase(),t.attributes||{},n,o)),e&&(n=this._addFormat(e.tag.toUpperCase(),e.attributes||{},n)),this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged(),this):this};var ht={DT:"DD",DD:"DT",LI:"LI",PRE:"PRE"},ut=function(e,t,n,o){var i=ht[t.nodeName],r=null,a=x(n,o,t.parentNode,e._root),s=e._config;return i||(i=s.blockTag,r=s.blockAttributes),p(a,i,r)||(t=T(a.ownerDocument,i,r),a.dir&&(t.dir=a.dir),S(a,t),t.appendChild(y(a)),a=t),a};rt.forEachBlock=function(e,t,n){if(!n&&!(n=this.getSelection()))return this;t&&this.saveUndoState(n);var o=this._root,i=Ae(n,o),r=Oe(n,o);if(i&&r)do{if(e(i)||i===r)break}while(i=h(i,o));return t&&(this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged()),this},rt.modifyBlocks=function(e,t){if(!t&&!(t=this.getSelection()))return this;this._recordUndoState(t,this._isInUndoState);var n,o=this._root;return Pe(t,o),Le(t,o,o,o),n=Te(t,o,o),ye(t,e.call(this,n)),t.endOffset]+|\([^\s()<>]+\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))|([\w\-.%+]+@(?:[\w\-]+\.)+[A-Z]{2,}\b)(?:\?[^&?\s]+=[^&?\s]+(?:&[^&?\s]+=[^&?\s]+)*)?/i;var St=function(e,t,o){var i,r,a,s,d,l,c,h=e.ownerDocument,u=new n(e,4,function(e){return!g(e,t,"A")}),f=o.linkRegExp,p=o._config.tagAttributes.a;if(f)for(;i=u.nextNode();)for(r=i.data,a=i.parentNode;s=f.exec(r);)d=s.index,l=d+s[0].length,d&&(c=h.createTextNode(r.slice(0,d)),a.insertBefore(c,i)),c=o.createElement("A",R({href:s[1]?/^(?:ht|f)tps?:/i.test(s[1])?s[1]:"http://"+s[1]:"mailto:"+s[0]},p,!1)),c.textContent=r.slice(d,l),a.insertBefore(c,i),i.data=r=r.slice(l)};rt.insertHTML=function(e,t){var n,o,i,r,a,s,d,l=this._config,c=l.isInsertedHTMLSanitized?l.sanitizeToDOMFragment:null,u=this.getSelection(),f=this._doc;"function"==typeof c?r=c(e,t,this):(t&&(n=e.indexOf("\x3c!--StartFragment--\x3e"),o=e.lastIndexOf("\x3c!--EndFragment--\x3e"),n>-1&&o>-1&&(e=e.slice(n+20,o))),/<\/td>((?!<\/tr>)[\s\S])*$/i.test(e)&&(e=""+e+""),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(e)&&(e=""+e+"
    "),i=this.createElement("DIV"),i.innerHTML=e,r=f.createDocumentFragment(),r.appendChild(y(i))),this.saveUndoState(u);try{for(a=this._root,s=r,d={fragment:r,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},St(r,r,this),$e(r,l),Je(r,a,!1),Ve(r),r.normalize();s=h(s,r);)E(s,a);t&&this.fireEvent("willPaste",d),d.defaultPrevented||(be(u,d.fragment,a),se||this._docWasChanged(),u.collapse(!1),this._ensureBottomLine()),this.setSelection(u),this._updatePath(u,!0),t&&this.focus()}catch(e){this.didError(e)}return this};var yt=function(e){return e.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""")};rt.insertPlainText=function(e,t){var n=this.getSelection();if(n.collapsed&&g(n.startContainer,this._root,"PRE")){var o,i,r=n.startContainer,a=n.startOffset;return r&&r.nodeType===H||(o=this._doc.createTextNode(""),r.insertBefore(o,r.childNodes[a]),r=o,a=0),i={text:e,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},t&&this.fireEvent("willPaste",i),i.defaultPrevented||(e=i.text,r.insertData(a,e),n.setStart(r,a+e.length),n.collapse(!0)),this.setSelection(n),this}var s,d,l,c,h=e.split("\n"),u=this._config,f=u.blockTag,p=u.blockAttributes,m="",v="<"+f;for(s in p)v+=" "+s+'="'+yt(p[s])+'"';for(v+=">",d=0,l=h.length;d")+m;return this.insertHTML(h.join(""),t)};var Tt=function(e,t,n){return function(){return this[e](t,n),this.focus()}};rt.addStyles=function(e){if(e){var t=this._doc.documentElement.firstChild,n=this.createElement("STYLE",{type:"text/css"});n.appendChild(this._doc.createTextNode(e)),t.appendChild(n)}return this},rt.bold=Tt("changeFormat",{tag:"B"}),rt.italic=Tt("changeFormat",{tag:"I"}),rt.underline=Tt("changeFormat",{tag:"U"}),rt.strikethrough=Tt("changeFormat",{tag:"S"}),rt.subscript=Tt("changeFormat",{tag:"SUB"},{tag:"SUP"}),rt.superscript=Tt("changeFormat",{tag:"SUP"},{tag:"SUB"}),rt.removeBold=Tt("changeFormat",null,{tag:"B"}),rt.removeItalic=Tt("changeFormat",null,{tag:"I"}),rt.removeUnderline=Tt("changeFormat",null,{tag:"U"}),rt.removeStrikethrough=Tt("changeFormat",null,{tag:"S"}),rt.removeSubscript=Tt("changeFormat",null,{tag:"SUB"}),rt.removeSuperscript=Tt("changeFormat",null,{tag:"SUP"}),rt.makeLink=function(e,t){var n=this.getSelection();if(n.collapsed){var o=e.indexOf(":")+1;if(o)for(;"/"===e[o];)o+=1;ye(n,this._doc.createTextNode(e.slice(o)))}return t=R(R({href:e},t,!0),this._config.tagAttributes.a,!1),this.changeFormat({tag:"A",attributes:t},{tag:"A"},n),this.focus()},rt.removeLink=function(){return this.changeFormat(null,{tag:"A"},this.getSelection(),!0),this.focus()},rt.setFontFace=function(e){var t=this._config.classNames.fontFamily;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-family: "+e+", sans-serif;"}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setFontSize=function(e){var t=this._config.classNames.fontSize;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-size: "+("number"==typeof e?e+"px":e)}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setTextColour=function(e){var t=this._config.classNames.colour;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"color:"+e}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setHighlightColour=function(e){var t=this._config.classNames.highlight;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"background-color:"+e}}:e,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setTextAlignment=function(e){return this.forEachBlock(function(t){var n=t.className.split(/\s+/).filter(function(e){return!!e&&!/^align/.test(e)}).join(" ");e?(t.className=n+" align-"+e,t.style.textAlign=e):(t.className=n,t.style.textAlign="")},!0),this.focus()},rt.setTextDirection=function(e){return this.forEachBlock(function(t){e?t.dir=e:t.removeAttribute("dir")},!0),this.focus()};var Et=function(e){for(var t,o=this._root,i=this._doc,r=i.createDocumentFragment(),a=l(e,o);t=a.nextNode();){var s,d,c=t.querySelectorAll("BR"),h=[],u=c.length;for(s=0;s-1;)a.appendChild(d.createTextNode(r.slice(0,s))),a.appendChild(d.createElement("BR")),r=r.slice(s+1);i.parentNode.insertBefore(a,i),i.data=r}b(t,l),S(t,y(t))}return e};rt.code=function(){var e=this.getSelection();return e.collapsed||d(e.commonAncestorContainer)?this.modifyBlocks(Et,e):this.changeFormat({tag:"CODE",attributes:this._config.tagAttributes.code},null,e),this.focus()},rt.removeCode=function(){var e=this.getSelection();return g(e.commonAncestorContainer,this._root,"PRE")?this.modifyBlocks(bt,e):this.changeFormat(null,{tag:"CODE"},e),this.focus()},rt.toggleCode=function(){return this.hasFormat("PRE")||this.hasFormat("CODE")?this.removeCode():this.code(),this},rt.removeAllFormatting=function(e){if(!e&&!(e=this.getSelection())||e.collapsed)return this;for(var t=this._root,n=e.commonAncestorContainer;n&&!s(n);)n=n.parentNode;if(n||(Pe(e,t),n=t),n.nodeType===H)return this;this.saveUndoState(e),Le(e,n,n,t);for(var o,i,r=n.ownerDocument,a=e.startContainer,d=e.startOffset,l=e.endContainer,c=e.endOffset,h=r.createDocumentFragment(),u=r.createDocumentFragment(),f=x(l,c,n,t),p=x(a,d,n,t);p!==f;)o=p.nextSibling,h.appendChild(p),p=o;return F(this,h,u),u.normalize(),p=u.firstChild,o=u.lastChild,i=n.childNodes,p?(n.insertBefore(u,f),d=ce.call(i,p),c=ce.call(i,o)+1):(d=ce.call(i,f),c=d),e.setStart(n,d),e.setEnd(n,c),L(n,e),ke(e),this.setSelection(e),this._updatePath(e,!0),this.focus()},rt.increaseQuoteLevel=Tt("modifyBlocks",ft),rt.decreaseQuoteLevel=Tt("modifyBlocks",pt),rt.makeUnorderedList=Tt("modifyBlocks",vt),rt.makeOrderedList=Tt("modifyBlocks",Nt),rt.removeList=Tt("modifyBlocks",Ct),P.isInline=a,P.isBlock=s,P.isContainer=d,P.getBlockWalker=l,P.getPreviousBlock=c,P.getNextBlock=h,P.areAlike=f,P.hasTagAttributes=p,P.getNearest=g,P.isOrContains=v,P.detach=_,P.replaceWith=S,P.empty=y,P.getNodeBefore=_e,P.getNodeAfter=Se,P.insertNodeInRange=ye,P.extractContentsOfRange=Te,P.deleteContentsOfRange=Ee,P.insertTreeFragmentIntoRange=be,P.isNodeContainedInRange=xe,P.moveRangeBoundariesDownTree=ke,P.moveRangeBoundariesUpTree=Le,P.getStartBlockOfRange=Ae,P.getEndBlockOfRange=Oe,P.contentWalker=Be,P.rangeDoesStartAtBlockBoundary=De,P.rangeDoesEndAtBlockBoundary=Re,P.expandRangeToBlockBoundaries=Pe,P.onPaste=ot,P.addLinks=St,P.splitBlock=ut,P.startSelectionId="squire-selection-start",P.endSelectionId=ct,"object"==typeof exports?module.exports=P:"function"==typeof define&&define.amd?define(function(){return P}):(G.Squire=P,top!==G&&"true"===e.documentElement.getAttribute("data-squireinit")&&(G.editor=new P(e),G.onEditorLoad&&(G.onEditorLoad(G.editor),G.onEditorLoad=null)))}(document); \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp/yarn.lock b/modules/blogging/app/Volo.BloggingTestApp/yarn.lock index 6f0078f2c9..13a712e13c 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/yarn.lock +++ b/modules/blogging/app/Volo.BloggingTestApp/yarn.lock @@ -2213,9 +2213,9 @@ pumpify@^1.3.5: inherits "^2.0.3" pump "^2.0.0" -"raphael@git+https://github.com/nhn/raphael.git#2.2.0-c": +"raphael@https://github.com/nhn/raphael.git#2.2.0-c": version "2.2.0-c" - resolved "git+https://github.com/nhn/raphael.git#78a6ed3ec269f33b6457b0ec66f8c3d1f2ed70e0" + resolved "https://github.com/nhn/raphael.git#78a6ed3ec269f33b6457b0ec66f8c3d1f2ed70e0" dependencies: eve "git://github.com/adobe-webplatform/eve.git#eef80ed" diff --git a/modules/blogging/app/update-database.ps1 b/modules/blogging/app/update-database.ps1 new file mode 100644 index 0000000000..39297dd2c9 --- /dev/null +++ b/modules/blogging/app/update-database.ps1 @@ -0,0 +1 @@ +dotnet ef database update -s Volo.BloggingTestApp/Volo.BloggingTestApp.csproj -p Volo.BloggingTestApp.EntityFrameworkCore/Volo.BloggingTestApp.EntityFrameworkCore.csproj \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index be51085f86..d798814caa 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -180,14 +180,14 @@ namespace Volo.Blogging.Posts return url; } - private async Task SaveTags(List newTags, Post post) + private async Task SaveTags(ICollection newTags, Post post) { await RemoveOldTags(newTags, post); await AddNewTags(newTags, post); } - private async Task RemoveOldTags(List newTags, Post post) + private async Task RemoveOldTags(ICollection newTags, Post post) { foreach (var oldTag in post.Tags) { @@ -209,7 +209,7 @@ namespace Volo.Blogging.Posts } } - private async Task AddNewTags(List newTags, Post post) + private async Task AddNewTags(IEnumerable newTags, Post post) { var tags = await _tagRepository.GetListAsync(post.BlogId); @@ -219,7 +219,7 @@ namespace Volo.Blogging.Posts if (tag == null) { - tag = await _tagRepository.InsertAsync(new Tag(post.BlogId, newTag, 1)); + tag = await _tagRepository.InsertAsync(new Tag(GuidGenerator.Create(), post.BlogId, newTag, 1)); } else { @@ -249,7 +249,7 @@ namespace Volo.Blogging.Posts return new List(tags.Split(",").Select(t => t.Trim())); } - private Task> FilterPostsByTag(List allPostDtos, Tag tag) + private Task> FilterPostsByTag(IEnumerable allPostDtos, Tag tag) { var filteredPostDtos = allPostDtos.Where(p => p.Tags?.Any(t => t.Id == tag.Id) ?? false).ToList(); diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo.Blogging.Domain.Shared.csproj b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo.Blogging.Domain.Shared.csproj index e466b4dc99..c71ae5aef5 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo.Blogging.Domain.Shared.csproj +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo.Blogging.Domain.Shared.csproj @@ -15,7 +15,7 @@
    - + diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/BloggingDomainSharedModule.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/BloggingDomainSharedModule.cs index 14dc9bd5ca..5cdd272a20 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/BloggingDomainSharedModule.cs +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/BloggingDomainSharedModule.cs @@ -1,12 +1,13 @@ using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; using Volo.Blogging.Localization; using Volo.Abp.VirtualFileSystem; namespace Volo.Blogging { - [DependsOn(typeof(AbpLocalizationModule))] + [DependsOn(typeof(AbpValidationModule))] public class BloggingDomainSharedModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs index 28d14d885d..fb8f97a4dc 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs @@ -20,8 +20,9 @@ namespace Volo.Blogging.Tagging } - public Tag(Guid blogId, [NotNull] string name, int usageCount = 0, string description = null) + public Tag(Guid id, Guid blogId, [NotNull] string name, int usageCount = 0, string description = null) { + Id = id; Name = Check.NotNullOrWhiteSpace(name, nameof(name)); BlogId = blogId; Description = description; diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs index a4368a6341..25ded93f72 100644 --- a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs @@ -14,7 +14,7 @@ namespace Volo.Blogging [InlineData("bbb")] public void SetName(string name) { - var tag = new Tag(Guid.NewGuid(), "abp", 0, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 0, "abp tag"); tag.SetName(name); tag.Name.ShouldBe(name); } @@ -25,7 +25,7 @@ namespace Volo.Blogging [InlineData(3)] public void IncreaseUsageCount(int number) { - var tag = new Tag(Guid.NewGuid(), "abp", 0, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 0, "abp tag"); tag.IncreaseUsageCount(number); tag.UsageCount.ShouldBe(number); } @@ -36,7 +36,7 @@ namespace Volo.Blogging [InlineData(3)] public void DecreaseUsageCount(int number) { - var tag = new Tag(Guid.NewGuid(), "abp", 10, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 10, "abp tag"); tag.DecreaseUsageCount(number); tag.UsageCount.ShouldBe(10 - number); } @@ -44,7 +44,7 @@ namespace Volo.Blogging [Fact] public void DecreaseUsageCount_Should_Greater_ThanOrEqual_Zero() { - var tag = new Tag(Guid.NewGuid(), "abp", 10, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 10, "abp tag"); tag.DecreaseUsageCount(100); tag.UsageCount.ShouldBe(0); } @@ -54,7 +54,7 @@ namespace Volo.Blogging [InlineData("bbb")] public void SetDescription(string description) { - var tag = new Tag(Guid.NewGuid(), "abp", 0, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 0, "abp tag"); tag.SetDescription(description); tag.Description.ShouldBe(description); } diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestBase.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestBase.cs index 69b752a32b..5b5a9718e6 100644 --- a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestBase.cs +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestBase.cs @@ -4,6 +4,7 @@ using NSubstitute; using Volo.Abp; using Volo.Abp.Modularity; using Volo.Abp.Users; +using Volo.Abp.Testing; namespace Volo.Blogging { diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs index 67d8049a06..cd2168d9df 100644 --- a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs @@ -43,8 +43,8 @@ namespace Volo.Blogging await _postRepository.InsertAsync(new Post(_testData.Blog1Post2Id, _testData.Blog1Id, "title2", "coverImage2", "url2")); await _commentRepository.InsertAsync(new Comment(_testData.Blog1Post1Comment1Id,_testData.Blog1Post1Id,null,"text")); await _commentRepository.InsertAsync(new Comment(_testData.Blog1Post1Comment2Id, _testData.Blog1Post1Id, _testData.Blog1Post1Comment1Id, "text")); - await _tagRepository.InsertAsync(new Tag(_testData.Blog1Id, _testData.Tag1Name, 10)); - await _tagRepository.InsertAsync(new Tag(_testData.Blog1Id, _testData.Tag2Name)); + await _tagRepository.InsertAsync(new Tag(Guid.NewGuid(), _testData.Blog1Id, _testData.Tag1Name, 10)); + await _tagRepository.InsertAsync(new Tag(Guid.NewGuid(), _testData.Blog1Id, _testData.Tag2Name)); } } diff --git a/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs b/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs index 189689064a..3e37206f31 100644 --- a/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs +++ b/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs @@ -18,7 +18,6 @@ using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Identity; using Volo.Abp.Identity.Web; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; using Volo.Abp.PermissionManagement.Identity; @@ -32,6 +31,7 @@ using VoloDocs.EntityFrameworkCore; using Localization.Resources.AbpUi; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Hosting; +using Volo.Abp.Validation.Localization; namespace VoloDocs.Web { diff --git a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs index de404a5884..1224b4371f 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs @@ -1,12 +1,8 @@ -using Localization.Resources.AbpUi; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AutoMapper; -using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; -using Volo.Abp.UI; using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; using Volo.Docs.Admin.Navigation; diff --git a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs index b3b2a05b53..839c63860b 100644 --- a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs +++ b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs @@ -23,7 +23,7 @@ namespace Volo.Docs.Documents IDocumentStoreFactory documentStoreFactory, IDistributedCache documentCache, IDistributedCache languageCache, - IDistributedCache resourceCache, + IDistributedCache resourceCache, IHostEnvironment hostEnvironment) { _projectRepository = projectRepository; @@ -107,6 +107,11 @@ namespace Volo.Docs.Documents try { + if (string.IsNullOrWhiteSpace(project.ParametersDocumentName)) + { + return await Task.FromResult(null); + } + var document = await GetDocumentWithDetailsDtoAsync( project, project.ParametersDocumentName, diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs index b4ba841169..c5188b3760 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs @@ -91,7 +91,7 @@ namespace Volo.Docs.Pages.Documents.Project try { - await SetProjectAsync(); + await SetProjectAsync(); } catch (EntityNotFoundException e) { @@ -391,9 +391,12 @@ namespace Volo.Docs.Pages.Documents.Project private async Task ConvertDocumentContentToHtmlAsync() { - await SetDocumentPreferences(); + await SetDocumentPreferencesAsync(); SetUserPreferences(); + UserPreferences.Add("Document_Language_Code", LanguageCode); + UserPreferences.Add("Document_Version", Version); + Document.Content = await _documentSectionRenderer.RenderAsync(Document.Content, UserPreferences); var converter = _documentToHtmlConverterFactory.Create(Document.Format ?? Project.Format); @@ -431,27 +434,30 @@ namespace Volo.Docs.Pages.Documents.Project { continue; } + var key = keyValue.Split("=")[0]; var value = keyValue.Split("=")[1]; UserPreferences.Add(key, value); - UserPreferences.Add(key + "_Value", DocumentPreferences.Parameters?.FirstOrDefault(p=>p.Name == key) - ?.Values.FirstOrDefault(v=>v.Key == value).Value); + UserPreferences.Add(key + "_Value", DocumentPreferences.Parameters?.FirstOrDefault(p => p.Name == key) + ?.Values.FirstOrDefault(v => v.Key == value).Value); } } var query = Request.Query; - foreach (var keyValue in query) + foreach (var (key, value) in query) { - if (UserPreferences.ContainsKey(keyValue.Key)) + if (UserPreferences.ContainsKey(key)) { - UserPreferences.Remove(keyValue.Key); - UserPreferences.Remove(keyValue.Key + "_Value"); + UserPreferences.Remove(key); + UserPreferences.Remove(key + "_Value"); } - UserPreferences.Add(keyValue.Key, keyValue.Value); - UserPreferences.Add(keyValue.Key + "_Value", DocumentPreferences.Parameters?.FirstOrDefault(p => p.Name == keyValue.Key) - ?.Values.FirstOrDefault(v => v.Key == keyValue.Value).Value); + + UserPreferences.Add(key, value); + UserPreferences.Add(key + "_Value", + DocumentPreferences.Parameters?.FirstOrDefault(p => p.Name == key)?.Values + .FirstOrDefault(v => v.Key == value).Value); } if (DocumentPreferences?.Parameters == null) @@ -469,7 +475,7 @@ namespace Volo.Docs.Pages.Documents.Project } } - public async Task SetDocumentPreferences() + public async Task SetDocumentPreferencesAsync() { var projectParameters = await _documentAppService.GetParametersAsync( new GetParametersDocumentInput diff --git a/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestBase.cs b/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestBase.cs index 6073b65e03..ec8270ae01 100644 --- a/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestBase.cs +++ b/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestBase.cs @@ -6,6 +6,7 @@ using Octokit; using Volo.Abp; using Volo.Abp.Modularity; using Volo.Docs.GitHub.Documents; +using Volo.Abp.Testing; namespace Volo.Docs { diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs index 097ea7ffa0..2290e79f00 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.FeatureManagement public virtual async Task GetAsync([NotNull] string providerName, [NotNull] string providerKey) { - await CheckProviderPolicy(providerName); + await CheckProviderPolicy(providerName).ConfigureAwait(false); var featureDefinitions = _featureDefinitionManager.GetAll(); var features = new List(); @@ -48,7 +48,7 @@ namespace Volo.Abp.FeatureManagement ValueType = featureDefinition.ValueType, Description = featureDefinition.Description?.Localize(_stringLocalizerFactory), ParentName = featureDefinition.Parent?.Name, - Value = await _featureManager.GetOrNullAsync(featureDefinition.Name, providerName, providerKey) + Value = await _featureManager.GetOrNullAsync(featureDefinition.Name, providerName, providerKey).ConfigureAwait(false) }); } @@ -59,11 +59,11 @@ namespace Volo.Abp.FeatureManagement public virtual async Task UpdateAsync([NotNull] string providerName, [NotNull] string providerKey, UpdateFeaturesDto input) { - await CheckProviderPolicy(providerName); + await CheckProviderPolicy(providerName).ConfigureAwait(false); foreach (var feature in input.Features) { - await _featureManager.SetAsync(feature.Name, feature.Value, providerName, providerKey); + await _featureManager.SetAsync(feature.Name, feature.Value, providerName, providerKey).ConfigureAwait(false); } } @@ -88,7 +88,7 @@ namespace Volo.Abp.FeatureManagement throw new AbpException($"No policy defined to get/set permissions for the provider '{policyName}'. Use {nameof(FeatureManagementOptions)} to map the policy."); } - await AuthorizationService.CheckAsync(policyName); + await AuthorizationService.CheckAsync(policyName).ConfigureAwait(false); } } } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj index 5990dc210c..bfa20270c8 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj @@ -13,7 +13,7 @@ - + diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainSharedModule.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainSharedModule.cs index f91fe28e5f..0c9a2e0f26 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainSharedModule.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainSharedModule.cs @@ -1,13 +1,14 @@ using Volo.Abp.FeatureManagement.Localization; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.FeatureManagement { [DependsOn( - typeof(AbpLocalizationModule) + typeof(AbpValidationModule) )] public class AbpFeatureManagementDomainSharedModule : AbpModule { diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs index 1d0c59773b..58353321fa 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs @@ -16,17 +16,17 @@ namespace Volo.Abp.FeatureManagement public async Task GetOrNullAsync(FeatureDefinition feature, string providerKey) { - return await Store.GetOrNullAsync(feature.Name, Name, NormalizeProviderKey(providerKey)); + return await Store.GetOrNullAsync(feature.Name, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); } public virtual async Task SetAsync(FeatureDefinition feature, string value, string providerKey) { - await Store.SetAsync(feature.Name, value, Name, NormalizeProviderKey(providerKey)); + await Store.SetAsync(feature.Name, value, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); } public virtual async Task ClearAsync(FeatureDefinition feature, string providerKey) { - await Store.DeleteAsync(feature.Name, Name, NormalizeProviderKey(providerKey)); + await Store.DeleteAsync(feature.Name, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); } protected virtual string NormalizeProviderKey(string providerKey) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementStore.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementStore.cs index 94c4d48067..2970296381 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementStore.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementStore.cs @@ -23,52 +23,52 @@ namespace Volo.Abp.FeatureManagement public async Task GetOrNullAsync(string name, string providerName, string providerKey) { - var cacheItem = await GetCacheItemAsync(name, providerName, providerKey); + var cacheItem = await GetCacheItemAsync(name, providerName, providerKey).ConfigureAwait(false); return cacheItem.Value; } public async Task SetAsync(string name, string value, string providerName, string providerKey) { - var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey); + var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); if (featureValue == null) { featureValue = new FeatureValue(GuidGenerator.Create(), name, value, providerName, providerKey); - await FeatureValueRepository.InsertAsync(featureValue); + await FeatureValueRepository.InsertAsync(featureValue).ConfigureAwait(false); } else { featureValue.Value = value; - await FeatureValueRepository.UpdateAsync(featureValue); + await FeatureValueRepository.UpdateAsync(featureValue).ConfigureAwait(false); } } public async Task DeleteAsync(string name, string providerName, string providerKey) { - var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey); + var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); if (featureValue != null) { - await FeatureValueRepository.DeleteAsync(featureValue); + await FeatureValueRepository.DeleteAsync(featureValue).ConfigureAwait(false); } } protected virtual async Task GetCacheItemAsync(string name, string providerName, string providerKey) { var cacheKey = CalculateCacheKey(name, providerName, providerKey); - var cacheItem = await Cache.GetAsync(cacheKey); + var cacheItem = await Cache.GetAsync(cacheKey).ConfigureAwait(false); if (cacheItem != null) { return cacheItem; } - var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey); + var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); cacheItem = new FeatureValueCacheItem(featureValue?.Value); await Cache.SetAsync( cacheKey, cacheItem - ); + ).ConfigureAwait(false); return cacheItem; } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs index 06ca345bf6..8249166f20 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs @@ -82,7 +82,7 @@ namespace Volo.Abp.FeatureManagement var providerValue = await provider.GetOrNullAsync( feature, provider.Name == providerName ? providerKey : null - ); + ).ConfigureAwait(false); if (providerValue != null) { @@ -123,7 +123,7 @@ namespace Volo.Abp.FeatureManagement if (providers.Count > 1 && !forceToSet && value != null) { - var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); + var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null).ConfigureAwait(false); if (fallbackValue == value) { //Clear the value if it's same as it's fallback value @@ -139,14 +139,14 @@ namespace Volo.Abp.FeatureManagement { foreach (var provider in providers) { - await provider.ClearAsync(feature, providerKey); + await provider.ClearAsync(feature, providerKey).ConfigureAwait(false); } } else { foreach (var provider in providers) { - await provider.SetAsync(feature, value, providerKey); + await provider.SetAsync(feature, value, providerKey).ConfigureAwait(false); } } } @@ -172,7 +172,7 @@ namespace Volo.Abp.FeatureManagement value = await provider.GetOrNullAsync( feature, provider.Name == providerName ? providerKey : null - ); + ).ConfigureAwait(false); if (value != null) { diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItem.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItem.cs index 765e6c9b32..98d3c07e64 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItem.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItem.cs @@ -1,8 +1,10 @@ using System; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.FeatureManagement { [Serializable] + [IgnoreMultiTenancy] public class FeatureValueCacheItem { public string Value { get; set; } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator.cs index 63e207b1e7..1d13d46e0a 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.FeatureManagement eventData.Entity.ProviderKey ); - await Cache.RemoveAsync(cacheKey); + await Cache.RemoveAsync(cacheKey).ConfigureAwait(false); } protected virtual string CalculateCacheKey(string name, string providerName, string providerKey) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs index 9545ac36b4..87251ff366 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore return await DbSet .FirstOrDefaultAsync( s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey - ); + ).ConfigureAwait(false); } public async Task> GetListAsync(string providerName, string providerKey) @@ -28,7 +28,7 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore return await DbSet .Where( s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(); + ).ToListAsync().ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs index f57d125dce..62e112b764 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs @@ -19,14 +19,14 @@ namespace Volo.Abp.FeatureManagement.MongoDB public async Task FindAsync(string name, string providerName, string providerKey) { return await GetMongoQueryable() - .FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey); + .FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey).ConfigureAwait(false); } public async Task> GetListAsync(string providerName, string providerKey) { return await GetMongoQueryable() .Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey) - .ToListAsync(); + .ToListAsync().ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index d9e0d7b2c4..4360e0d72c 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -36,7 +36,7 @@ namespace Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement public async Task OnGetAsync() { - FeatureListDto = await _featureAppService.GetAsync(ProviderName, ProviderKey); + FeatureListDto = await _featureAppService.GetAsync(ProviderName, ProviderKey).ConfigureAwait(false); } public async Task OnPostAsync() @@ -50,7 +50,7 @@ namespace Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement }).ToList() }; - await _featureAppService.UpdateAsync(ProviderName, ProviderKey, features); + await _featureAppService.UpdateAsync(ProviderName, ProviderKey, features).ConfigureAwait(false); return NoContent(); } diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs index b86e6be013..8987a232b0 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs @@ -39,7 +39,7 @@ namespace Volo.Abp.FeatureManagement Login(_testData.User1Id); var featureList = await _featureAppService.GetAsync(EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()); + TestEditionIds.Regular.ToString()).ConfigureAwait(false); featureList.ShouldNotBeNull(); featureList.Features.ShouldContain(feature => feature.Name == TestFeatureDefinitionProvider.SocialLogins); @@ -61,10 +61,10 @@ namespace Volo.Abp.FeatureManagement Value = false.ToString().ToLowerInvariant() } } - }); + }).ConfigureAwait(false); (await _featureAppService.GetAsync(EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString())).Features.Any(x => + TestEditionIds.Regular.ToString()).ConfigureAwait(false)).Features.Any(x => x.Name == TestFeatureDefinitionProvider.SocialLogins && x.Value == false.ToString().ToLowerInvariant()) .ShouldBeTrue(); diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureManager_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureManager_Tests.cs index bae9041a51..ac75fdd86e 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureManager_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureManager_Tests.cs @@ -1,6 +1,8 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using Shouldly; using Volo.Abp.Features; +using Volo.Abp.MultiTenancy; using Xunit; namespace Volo.Abp.FeatureManagement @@ -8,10 +10,14 @@ namespace Volo.Abp.FeatureManagement public class FeatureManager_Tests : FeatureManagementDomainTestBase { private readonly IFeatureManager _featureManager; + private readonly ICurrentTenant _currentTenant; + private readonly IFeatureChecker _featureChecker; public FeatureManager_Tests() { _featureManager = GetRequiredService(); + _featureChecker = GetRequiredService(); + _currentTenant = GetRequiredService(); } [Fact] @@ -21,63 +27,89 @@ namespace Volo.Abp.FeatureManagement (await _featureManager.GetOrNullDefaultAsync( TestFeatureDefinitionProvider.SocialLogins - )).ShouldBeNull(); + ).ConfigureAwait(false)).ShouldBeNull(); (await _featureManager.GetOrNullDefaultAsync( TestFeatureDefinitionProvider.DailyAnalysis - )).ShouldBe(false.ToString().ToLowerInvariant()); + ).ConfigureAwait(false)).ShouldBe(false.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullDefaultAsync( TestFeatureDefinitionProvider.ProjectCount - )).ShouldBe("1"); + ).ConfigureAwait(false)).ShouldBe("1"); (await _featureManager.GetOrNullDefaultAsync( TestFeatureDefinitionProvider.BackupCount - )).ShouldBe("0"); + ).ConfigureAwait(false)).ShouldBe("0"); //"Enterprise" edition values (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.SocialLogins, TestEditionIds.Enterprise - )).ShouldBe(true.ToString().ToLowerInvariant()); + ).ConfigureAwait(false)).ShouldBe(true.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.DailyAnalysis, TestEditionIds.Enterprise - )).ShouldBe(false.ToString().ToLowerInvariant()); + ).ConfigureAwait(false)).ShouldBe(false.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.ProjectCount, TestEditionIds.Enterprise - )).ShouldBe("3"); + ).ConfigureAwait(false)).ShouldBe("3"); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.BackupCount, TestEditionIds.Enterprise - )).ShouldBe("5"); + ).ConfigureAwait(false)).ShouldBe("5"); //"Ultimate" edition values (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.SocialLogins, TestEditionIds.Ultimate - )).ShouldBe(true.ToString().ToLowerInvariant()); + ).ConfigureAwait(false)).ShouldBe(true.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.DailyAnalysis, TestEditionIds.Ultimate - )).ShouldBe(true.ToString().ToLowerInvariant()); + ).ConfigureAwait(false)).ShouldBe(true.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.ProjectCount, TestEditionIds.Ultimate - )).ShouldBe("10"); + ).ConfigureAwait(false)).ShouldBe("10"); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.BackupCount, TestEditionIds.Ultimate - )).ShouldBe("10"); + ).ConfigureAwait(false)).ShouldBe("10"); + } + + [Fact] + public async Task Should_Change_Feature_Value_And_Refresh_Cache() + { + var tenantId = Guid.NewGuid(); + + //It is "False" at the beginning + using (_currentTenant.Change(tenantId)) + { + (await _featureChecker.IsEnabledAsync(TestFeatureDefinitionProvider.SocialLogins)).ShouldBeFalse(); + } + + //Set to "True" by host for the tenant + using (_currentTenant.Change(null)) + { + (await _featureChecker.IsEnabledAsync(TestFeatureDefinitionProvider.SocialLogins)).ShouldBeFalse(); + await _featureManager.SetForTenantAsync(tenantId, TestFeatureDefinitionProvider.SocialLogins, "True"); + (await _featureManager.GetOrNullForTenantAsync(TestFeatureDefinitionProvider.SocialLogins, tenantId)).ShouldBe("True"); + } + + //Now, it should be "True" + using (_currentTenant.Change(tenantId)) + { + (await _featureChecker.IsEnabledAsync(TestFeatureDefinitionProvider.SocialLogins)).ShouldBeTrue(); + } } } } diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator_Tests.cs index ce74094f97..7b3aa9f256 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator_Tests.cs @@ -26,21 +26,31 @@ namespace Volo.Abp.FeatureManagement public async Task Cache_Should_Invalidator_WhenFeatureChanged() { // Arrange cache feature. - await _featureManagementStore.GetOrNullAsync(TestFeatureDefinitionProvider.SocialLogins, - EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()); + (await _featureManagementStore.GetOrNullAsync( + TestFeatureDefinitionProvider.SocialLogins, + EditionFeatureValueProvider.ProviderName, + TestEditionIds.Regular.ToString() + ).ConfigureAwait(false) + ).ShouldNotBeNull(); - var feature = await _featureValueRepository.FindAsync(TestFeatureDefinitionProvider.SocialLogins, + var feature = await _featureValueRepository.FindAsync( + TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()); + TestEditionIds.Regular.ToString() + ).ConfigureAwait(false); // Act - await _featureValueRepository.DeleteAsync(feature); + await _featureValueRepository.DeleteAsync(feature).ConfigureAwait(false); // Assert - (await _cache.GetAsync(FeatureValueCacheItem.CalculateCacheKey(TestFeatureDefinitionProvider.SocialLogins, - EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()))).ShouldBeNull(); + (await _cache.GetAsync( + FeatureValueCacheItem.CalculateCacheKey( + TestFeatureDefinitionProvider.SocialLogins, + EditionFeatureValueProvider.ProviderName, + TestEditionIds.Regular.ToString() + ) + ).ConfigureAwait(false) + ).ShouldBeNull(); } } diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementStore_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementStore_Tests.cs index a6f040dde3..500e28233c 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementStore_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementStore_Tests.cs @@ -27,11 +27,11 @@ namespace Volo.Abp.FeatureManagement // Act (await FeatureManagementStore.GetOrNullAsync(Guid.NewGuid().ToString(), EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString())).ShouldBeNull(); + TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldBeNull(); (await FeatureManagementStore.GetOrNullAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString())).ShouldNotBeNull(); + TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldNotBeNull(); } [Fact] @@ -40,17 +40,17 @@ namespace Volo.Abp.FeatureManagement // Arrange (await FeatureManagementStore.GetOrNullAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString())).ShouldNotBeNull(); + TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldNotBeNull(); // Act await FeatureManagementStore.DeleteAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()); + TestEditionIds.Regular.ToString()).ConfigureAwait(false); // Assert (await FeatureManagementStore.GetOrNullAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString())).ShouldBeNull(); + TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldBeNull(); } [Fact] @@ -59,18 +59,18 @@ namespace Volo.Abp.FeatureManagement // Arrange (await FeatureValueRepository.FindAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString())).Value.ShouldBe(true.ToString().ToLowerInvariant()); + TestEditionIds.Regular.ToString()).ConfigureAwait(false)).Value.ShouldBe(true.ToString().ToLowerInvariant()); // Act await FeatureManagementStore.SetAsync(TestFeatureDefinitionProvider.SocialLogins, false.ToString().ToUpperInvariant(), EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()); + TestEditionIds.Regular.ToString()).ConfigureAwait(false); // Assert (await FeatureValueRepository.FindAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString())).Value.ShouldBe(false.ToString().ToUpperInvariant()); + TestEditionIds.Regular.ToString()).ConfigureAwait(false)).Value.ShouldBe(false.ToString().ToUpperInvariant()); } [Fact] @@ -79,18 +79,18 @@ namespace Volo.Abp.FeatureManagement // Arrange (await FeatureValueRepository.FindAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString())).ShouldNotBeNull(); + TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldNotBeNull(); // Act await FeatureManagementStore.DeleteAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()); + TestEditionIds.Regular.ToString()).ConfigureAwait(false); // Assert (await FeatureValueRepository.FindAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString())).ShouldBeNull(); + TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldBeNull(); } diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestBase.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestBase.cs index 66ab983ebe..b5b72ab0d0 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestBase.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestBase.cs @@ -1,4 +1,5 @@ using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace Volo.Abp.FeatureManagement { diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestDataBuilder.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestDataBuilder.cs index 0629693dbd..dc286e6782 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestDataBuilder.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestDataBuilder.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Regular.ToString() ) - ); + ).ConfigureAwait(false); //UserCount await _featureValueRepository.InsertAsync( @@ -45,7 +45,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Regular.ToString() ) - ); + ).ConfigureAwait(false); //ProjectCount await _featureValueRepository.InsertAsync( @@ -56,7 +56,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Regular.ToString() ) - ); + ).ConfigureAwait(false); #endregion @@ -71,7 +71,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ); + ).ConfigureAwait(false); //EmailSupport await _featureValueRepository.InsertAsync( @@ -82,7 +82,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ); + ).ConfigureAwait(false); //UserCount await _featureValueRepository.InsertAsync( @@ -93,7 +93,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ); + ).ConfigureAwait(false); //ProjectCount await _featureValueRepository.InsertAsync( @@ -104,7 +104,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ); + ).ConfigureAwait(false); //BackupCount await _featureValueRepository.InsertAsync( @@ -115,7 +115,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ); + ).ConfigureAwait(false); #endregion @@ -130,7 +130,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ); + ).ConfigureAwait(false); //EmailSupport await _featureValueRepository.InsertAsync( @@ -141,7 +141,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ); + ).ConfigureAwait(false); //EmailSupport await _featureValueRepository.InsertAsync( @@ -152,7 +152,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ); + ).ConfigureAwait(false); //UserCount await _featureValueRepository.InsertAsync( @@ -163,7 +163,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ); + ).ConfigureAwait(false); //ProjectCount await _featureValueRepository.InsertAsync( @@ -174,7 +174,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ); + ).ConfigureAwait(false); //BackupCount await _featureValueRepository.InsertAsync( @@ -185,7 +185,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ); + ).ConfigureAwait(false); #endregion } diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureValueRepository_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureValueRepository_Tests.cs index c7cbb0d8ae..8c3904ef24 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureValueRepository_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureValueRepository_Tests.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.FeatureManagement TestFeatureDefinitionProvider.ProjectCount, EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() - ); + ).ConfigureAwait(false); featureValue.ShouldNotBeNull(); featureValue.Value.ShouldBe("3"); @@ -35,7 +35,7 @@ namespace Volo.Abp.FeatureManagement TestFeatureDefinitionProvider.ProjectCount, EditionFeatureValueProvider.ProviderName, "undefined-edition-id" - ); + ).ConfigureAwait(false); featureValue.ShouldBeNull(); } @@ -46,7 +46,7 @@ namespace Volo.Abp.FeatureManagement var featureValues = await Repository.GetListAsync( EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() - ); + ).ConfigureAwait(false); featureValues.Count.ShouldBeGreaterThan(0); diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs index f2b902d271..44b97a82ea 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs @@ -24,14 +24,13 @@ namespace Volo.Abp.Identity public virtual async Task GetAsync(Guid id) { return ObjectMapper.Map( - await _roleManager.GetByIdAsync(id) - ); + await _roleManager.GetByIdAsync(id).ConfigureAwait(false)); } public virtual async Task> GetListAsync(PagedAndSortedResultRequestDto input) { - var list = await _roleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount); - var totalCount = await _roleRepository.GetCountAsync(); + var list = await _roleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount).ConfigureAwait(false); + var totalCount = await _roleRepository.GetCountAsync().ConfigureAwait(false); return new PagedResultDto( totalCount, @@ -47,8 +46,8 @@ namespace Volo.Abp.Identity role.IsDefault = input.IsDefault; role.IsPublic = input.IsPublic; - (await _roleManager.CreateAsync(role)).CheckErrors(); - await CurrentUnitOfWork.SaveChangesAsync(); + (await _roleManager.CreateAsync(role).ConfigureAwait(false)).CheckErrors(); + await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); return ObjectMapper.Map(role); } @@ -56,16 +55,16 @@ namespace Volo.Abp.Identity [Authorize(IdentityPermissions.Roles.Update)] public virtual async Task UpdateAsync(Guid id, IdentityRoleUpdateDto input) { - var role = await _roleManager.GetByIdAsync(id); + var role = await _roleManager.GetByIdAsync(id).ConfigureAwait(false); role.ConcurrencyStamp = input.ConcurrencyStamp; - (await _roleManager.SetRoleNameAsync(role, input.Name)).CheckErrors(); + (await _roleManager.SetRoleNameAsync(role, input.Name).ConfigureAwait(false)).CheckErrors(); role.IsDefault = input.IsDefault; role.IsPublic = input.IsPublic; - (await _roleManager.UpdateAsync(role)).CheckErrors(); - await CurrentUnitOfWork.SaveChangesAsync(); + (await _roleManager.UpdateAsync(role).ConfigureAwait(false)).CheckErrors(); + await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); return ObjectMapper.Map(role); } @@ -73,13 +72,13 @@ namespace Volo.Abp.Identity [Authorize(IdentityPermissions.Roles.Delete)] public virtual async Task DeleteAsync(Guid id) { - var role = await _roleManager.FindByIdAsync(id.ToString()); + var role = await _roleManager.FindByIdAsync(id.ToString()).ConfigureAwait(false); if (role == null) { return; } - (await _roleManager.DeleteAsync(role)).CheckErrors(); + (await _roleManager.DeleteAsync(role).ConfigureAwait(false)).CheckErrors(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs index c1d0f8f28b..365fac604f 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs @@ -26,14 +26,14 @@ namespace Volo.Abp.Identity { return ObjectMapper.Map( await _userManager.GetByIdAsync(id) - ); +.ConfigureAwait(false)); } [Authorize(IdentityPermissions.Users.Default)] public virtual async Task> GetListAsync(GetIdentityUsersInput input) { - var count = await _userRepository.GetCountAsync(input.Filter); - var list = await _userRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); + var count = await _userRepository.GetCountAsync(input.Filter).ConfigureAwait(false); + var list = await _userRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter).ConfigureAwait(false); return new PagedResultDto( count, @@ -44,7 +44,7 @@ namespace Volo.Abp.Identity [Authorize(IdentityPermissions.Users.Default)] public virtual async Task> GetRolesAsync(Guid id) { - var roles = await _userRepository.GetRolesAsync(id); + var roles = await _userRepository.GetRolesAsync(id).ConfigureAwait(false); return new ListResultDto( ObjectMapper.Map, List>(roles) ); @@ -55,10 +55,10 @@ namespace Volo.Abp.Identity { var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.Email, CurrentTenant.Id); - (await _userManager.CreateAsync(user, input.Password)).CheckErrors(); - await UpdateUserByInput(user, input); + (await _userManager.CreateAsync(user, input.Password).ConfigureAwait(false)).CheckErrors(); + await UpdateUserByInput(user, input).ConfigureAwait(false); - await CurrentUnitOfWork.SaveChangesAsync(); + await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); return ObjectMapper.Map(user); } @@ -66,20 +66,20 @@ namespace Volo.Abp.Identity [Authorize(IdentityPermissions.Users.Update)] public virtual async Task UpdateAsync(Guid id, IdentityUserUpdateDto input) { - var user = await _userManager.GetByIdAsync(id); + var user = await _userManager.GetByIdAsync(id).ConfigureAwait(false); user.ConcurrencyStamp = input.ConcurrencyStamp; - (await _userManager.SetUserNameAsync(user, input.UserName)).CheckErrors(); - await UpdateUserByInput(user, input); - (await _userManager.UpdateAsync(user)).CheckErrors(); + (await _userManager.SetUserNameAsync(user, input.UserName).ConfigureAwait(false)).CheckErrors(); + await UpdateUserByInput(user, input).ConfigureAwait(false); + (await _userManager.UpdateAsync(user).ConfigureAwait(false)).CheckErrors(); if (!input.Password.IsNullOrEmpty()) { - (await _userManager.RemovePasswordAsync(user)).CheckErrors(); - (await _userManager.AddPasswordAsync(user, input.Password)).CheckErrors(); + (await _userManager.RemovePasswordAsync(user).ConfigureAwait(false)).CheckErrors(); + (await _userManager.AddPasswordAsync(user, input.Password).ConfigureAwait(false)).CheckErrors(); } - await CurrentUnitOfWork.SaveChangesAsync(); + await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); return ObjectMapper.Map(user); } @@ -92,21 +92,21 @@ namespace Volo.Abp.Identity throw new BusinessException(code: IdentityErrorCodes.UserSelfDeletion); } - var user = await _userManager.FindByIdAsync(id.ToString()); + var user = await _userManager.FindByIdAsync(id.ToString()).ConfigureAwait(false); if (user == null) { return; } - (await _userManager.DeleteAsync(user)).CheckErrors(); + (await _userManager.DeleteAsync(user).ConfigureAwait(false)).CheckErrors(); } [Authorize(IdentityPermissions.Users.Update)] public virtual async Task UpdateRolesAsync(Guid id, IdentityUserUpdateRolesDto input) { - var user = await _userManager.GetByIdAsync(id); - (await _userManager.SetRolesAsync(user, input.RoleNames)).CheckErrors(); - await _userRepository.UpdateAsync(user); + var user = await _userManager.GetByIdAsync(id).ConfigureAwait(false); + (await _userManager.SetRolesAsync(user, input.RoleNames).ConfigureAwait(false)).CheckErrors(); + await _userRepository.UpdateAsync(user).ConfigureAwait(false); } [Authorize(IdentityPermissions.Users.Default)] @@ -114,7 +114,7 @@ namespace Volo.Abp.Identity { return ObjectMapper.Map( await _userManager.FindByNameAsync(username) - ); +.ConfigureAwait(false)); } [Authorize(IdentityPermissions.Users.Default)] @@ -122,30 +122,30 @@ namespace Volo.Abp.Identity { return ObjectMapper.Map( await _userManager.FindByEmailAsync(email) - ); +.ConfigureAwait(false)); } private async Task UpdateUserByInput(IdentityUser user, IdentityUserCreateOrUpdateDtoBase input) { if (!string.Equals(user.Email, input.Email, StringComparison.InvariantCultureIgnoreCase)) { - (await _userManager.SetEmailAsync(user, input.Email)).CheckErrors(); + (await _userManager.SetEmailAsync(user, input.Email).ConfigureAwait(false)).CheckErrors(); } if (!string.Equals(user.PhoneNumber, input.PhoneNumber, StringComparison.InvariantCultureIgnoreCase)) { - (await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors(); + (await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber).ConfigureAwait(false)).CheckErrors(); } - (await _userManager.SetTwoFactorEnabledAsync(user, input.TwoFactorEnabled)).CheckErrors(); - (await _userManager.SetLockoutEnabledAsync(user, input.LockoutEnabled)).CheckErrors(); + (await _userManager.SetTwoFactorEnabledAsync(user, input.TwoFactorEnabled).ConfigureAwait(false)).CheckErrors(); + (await _userManager.SetLockoutEnabledAsync(user, input.LockoutEnabled).ConfigureAwait(false)).CheckErrors(); user.Name = input.Name; user.Surname = input.Surname; if (input.RoleNames != null) { - (await _userManager.SetRolesAsync(user, input.RoleNames)).CheckErrors(); + (await _userManager.SetRolesAsync(user, input.RoleNames).ConfigureAwait(false)).CheckErrors(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs index 48d42c4579..ca2b25f83b 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Identity public virtual async Task FindByIdAsync(Guid id) { - var userData = await UserLookupServiceProvider.FindByIdAsync(id); + var userData = await UserLookupServiceProvider.FindByIdAsync(id).ConfigureAwait(false); if (userData == null) { return null; @@ -29,7 +29,7 @@ namespace Volo.Abp.Identity public virtual async Task FindByUserNameAsync(string userName) { - var userData = await UserLookupServiceProvider.FindByUserNameAsync(userName); + var userData = await UserLookupServiceProvider.FindByUserNameAsync(userName).ConfigureAwait(false); if (userData == null) { return null; diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs index 0b8712b93d..04d2c55a0b 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs @@ -21,39 +21,39 @@ namespace Volo.Abp.Identity { return ObjectMapper.Map( await _userManager.GetByIdAsync(CurrentUser.GetId()) - ); +.ConfigureAwait(false)); } public virtual async Task UpdateAsync(UpdateProfileDto input) { - var user = await _userManager.GetByIdAsync(CurrentUser.GetId()); + var user = await _userManager.GetByIdAsync(CurrentUser.GetId()).ConfigureAwait(false); - if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled)) + if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled).ConfigureAwait(false)) { - (await _userManager.SetUserNameAsync(user, input.UserName)).CheckErrors(); + (await _userManager.SetUserNameAsync(user, input.UserName).ConfigureAwait(false)).CheckErrors(); } - if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsEmailUpdateEnabled)) + if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsEmailUpdateEnabled).ConfigureAwait(false)) { - (await _userManager.SetEmailAsync(user, input.Email)).CheckErrors(); + (await _userManager.SetEmailAsync(user, input.Email).ConfigureAwait(false)).CheckErrors(); } - (await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors(); + (await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber).ConfigureAwait(false)).CheckErrors(); user.Name = input.Name; user.Surname = input.Surname; - (await _userManager.UpdateAsync(user)).CheckErrors(); + (await _userManager.UpdateAsync(user).ConfigureAwait(false)).CheckErrors(); - await CurrentUnitOfWork.SaveChangesAsync(); + await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); return ObjectMapper.Map(user); } public virtual async Task ChangePasswordAsync(ChangePasswordInput input) { - var currentUser = await _userManager.GetByIdAsync(CurrentUser.GetId()); - (await _userManager.ChangePasswordAsync(currentUser, input.CurrentPassword, input.NewPassword)).CheckErrors(); + var currentUser = await _userManager.GetByIdAsync(CurrentUser.GetId()).ConfigureAwait(false); + (await _userManager.ChangePasswordAsync(currentUser, input.CurrentPassword, input.NewPassword).ConfigureAwait(false)).CheckErrors(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj index 6b58f2e433..460f5285e4 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj @@ -20,7 +20,7 @@ - + diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/AbpIdentityDomainSharedModule.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/AbpIdentityDomainSharedModule.cs index 5133e0dc03..4bff33d58a 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/AbpIdentityDomainSharedModule.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/AbpIdentityDomainSharedModule.cs @@ -1,15 +1,18 @@ using Volo.Abp.Identity.Localization; using Volo.Abp.Localization; using Volo.Abp.Localization.ExceptionHandling; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.Users; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.Identity { - [DependsOn(typeof(AbpUsersDomainSharedModule))] - [DependsOn(typeof(AbpLocalizationModule))] + [DependsOn( + typeof(AbpUsersDomainSharedModule), + typeof(AbpValidationModule) + )] public class AbpIdentityDomainSharedModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsFactory.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsFactory.cs index 89f2b11bc2..3836783a01 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsFactory.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsFactory.cs @@ -39,19 +39,19 @@ namespace Volo.Abp.Identity protected virtual async Task OverrideOptionsAsync(IdentityOptions options) { - options.Password.RequiredLength = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequiredLength, options.Password.RequiredLength); - options.Password.RequiredUniqueChars = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequiredUniqueChars, options.Password.RequiredUniqueChars); - options.Password.RequireNonAlphanumeric = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireNonAlphanumeric, options.Password.RequireNonAlphanumeric); - options.Password.RequireLowercase = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireLowercase, options.Password.RequireLowercase); - options.Password.RequireUppercase = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireUppercase, options.Password.RequireUppercase); - options.Password.RequireDigit = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireDigit, options.Password.RequireDigit); - - options.Lockout.AllowedForNewUsers = await _settingProvider.GetAsync(IdentitySettingNames.Lockout.AllowedForNewUsers, options.Lockout.AllowedForNewUsers); + options.Password.RequiredLength = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequiredLength, options.Password.RequiredLength).ConfigureAwait(false); + options.Password.RequiredUniqueChars = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequiredUniqueChars, options.Password.RequiredUniqueChars).ConfigureAwait(false); + options.Password.RequireNonAlphanumeric = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireNonAlphanumeric, options.Password.RequireNonAlphanumeric).ConfigureAwait(false); + options.Password.RequireLowercase = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireLowercase, options.Password.RequireLowercase).ConfigureAwait(false); + options.Password.RequireUppercase = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireUppercase, options.Password.RequireUppercase).ConfigureAwait(false); + options.Password.RequireDigit = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireDigit, options.Password.RequireDigit).ConfigureAwait(false); + + options.Lockout.AllowedForNewUsers = await _settingProvider.GetAsync(IdentitySettingNames.Lockout.AllowedForNewUsers, options.Lockout.AllowedForNewUsers).ConfigureAwait(false); options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromSeconds(await _settingProvider.GetAsync(IdentitySettingNames.Lockout.LockoutDuration, options.Lockout.DefaultLockoutTimeSpan.TotalSeconds.To())); - options.Lockout.MaxFailedAccessAttempts = await _settingProvider.GetAsync(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, options.Lockout.MaxFailedAccessAttempts); + options.Lockout.MaxFailedAccessAttempts = await _settingProvider.GetAsync(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, options.Lockout.MaxFailedAccessAttempts).ConfigureAwait(false); - options.SignIn.RequireConfirmedEmail = await _settingProvider.GetAsync(IdentitySettingNames.SignIn.RequireConfirmedEmail, options.SignIn.RequireConfirmedEmail); - options.SignIn.RequireConfirmedPhoneNumber = await _settingProvider.GetAsync(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, options.SignIn.RequireConfirmedPhoneNumber); + options.SignIn.RequireConfirmedEmail = await _settingProvider.GetAsync(IdentitySettingNames.SignIn.RequireConfirmedEmail, options.SignIn.RequireConfirmedEmail).ConfigureAwait(false); + options.SignIn.RequireConfirmedPhoneNumber = await _settingProvider.GetAsync(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, options.SignIn.RequireConfirmedPhoneNumber).ConfigureAwait(false); } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs index 8db2b95942..9425a91cdc 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Identity [UnitOfWork] public override async Task CreateAsync(IdentityUser user) { - var principal = await base.CreateAsync(user); + var principal = await base.CreateAsync(user).ConfigureAwait(false); if (user.TenantId.HasValue) { diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimTypeManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimTypeManager.cs index 6e79b29d98..ae468d272a 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimTypeManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimTypeManager.cs @@ -15,17 +15,17 @@ namespace Volo.Abp.Identity public virtual async Task CreateAsync(IdentityClaimType claimType) { - if (await _identityClaimTypeRepository.AnyAsync(claimType.Name)) + if (await _identityClaimTypeRepository.AnyAsync(claimType.Name).ConfigureAwait(false)) { throw new AbpException($"Name Exist: {claimType.Name}"); } - return await _identityClaimTypeRepository.InsertAsync(claimType); + return await _identityClaimTypeRepository.InsertAsync(claimType).ConfigureAwait(false); } public virtual async Task UpdateAsync(IdentityClaimType claimType) { - if (await _identityClaimTypeRepository.AnyAsync(claimType.Name, claimType.Id)) + if (await _identityClaimTypeRepository.AnyAsync(claimType.Name, claimType.Id).ConfigureAwait(false)) { throw new AbpException($"Name Exist: {claimType.Name}"); } @@ -36,7 +36,7 @@ namespace Volo.Abp.Identity } - return await _identityClaimTypeRepository.UpdateAsync(claimType); + return await _identityClaimTypeRepository.UpdateAsync(claimType).ConfigureAwait(false); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs index 70945c2546..92ebe6adfb 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs @@ -47,7 +47,7 @@ namespace Volo.Abp.Identity const string adminUserName = "admin"; var adminUser = await _userRepository.FindByNormalizedUserNameAsync( _lookupNormalizer.NormalizeName(adminUserName) - ); + ).ConfigureAwait(false); if (adminUser != null) { @@ -64,12 +64,12 @@ namespace Volo.Abp.Identity Name = adminUserName }; - (await _userManager.CreateAsync(adminUser, adminPassword)).CheckErrors(); + (await _userManager.CreateAsync(adminUser, adminPassword).ConfigureAwait(false)).CheckErrors(); result.CreatedAdminUser = true; //"admin" role const string adminRoleName = "admin"; - var adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName(adminRoleName)); + var adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName(adminRoleName)).ConfigureAwait(false); if (adminRole == null) { adminRole = new IdentityRole( @@ -82,11 +82,11 @@ namespace Volo.Abp.Identity IsPublic = true }; - (await _roleManager.CreateAsync(adminRole)).CheckErrors(); + (await _roleManager.CreateAsync(adminRole).ConfigureAwait(false)).CheckErrors(); result.CreatedAdminRole = true; } - (await _userManager.AddToRoleAsync(adminUser, adminRoleName)).CheckErrors(); + (await _userManager.AddToRoleAsync(adminUser, adminRoleName).ConfigureAwait(false)).CheckErrors(); return result; } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs index 92e6d9893c..17f1b817aa 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs @@ -41,7 +41,7 @@ namespace Volo.Abp.Identity public virtual async Task GetByIdAsync(Guid id) { - var role = await Store.FindByIdAsync(id.ToString(), CancellationToken); + var role = await Store.FindByIdAsync(id.ToString(), CancellationToken).ConfigureAwait(false); if (role == null) { throw new EntityNotFoundException(typeof(IdentityRole), id); @@ -57,7 +57,7 @@ namespace Volo.Abp.Identity throw new BusinessException(_localizer["Identity.StaticRoleRenamingErrorMessage"]); // TODO: localize & change exception type } - return await base.SetRoleNameAsync(role,name); + return await base.SetRoleNameAsync(role, name).ConfigureAwait(false); } public override async Task DeleteAsync(IdentityRole role) @@ -67,7 +67,7 @@ namespace Volo.Abp.Identity throw new BusinessException(_localizer["Identity.StaticRoleDeletionErrorMessage"]); // TODO: localize & change exception type } - return await base.DeleteAsync(role); + return await base.DeleteAsync(role).ConfigureAwait(false); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleStore.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleStore.cs index 175b051a48..1ca46b0830 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleStore.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleStore.cs @@ -67,7 +67,7 @@ namespace Volo.Abp.Identity Check.NotNull(role, nameof(role)); - await _roleRepository.InsertAsync(role, AutoSaveChanges, cancellationToken); + await _roleRepository.InsertAsync(role, AutoSaveChanges, cancellationToken).ConfigureAwait(false); return IdentityResult.Success; } @@ -86,7 +86,7 @@ namespace Volo.Abp.Identity try { - await _roleRepository.UpdateAsync(role, AutoSaveChanges, cancellationToken); + await _roleRepository.UpdateAsync(role, AutoSaveChanges, cancellationToken).ConfigureAwait(false); } catch (AbpDbConcurrencyException ex) { @@ -111,7 +111,7 @@ namespace Volo.Abp.Identity try { - await _roleRepository.DeleteAsync(role, AutoSaveChanges, cancellationToken); + await _roleRepository.DeleteAsync(role, AutoSaveChanges, cancellationToken).ConfigureAwait(false); } catch (AbpDbConcurrencyException ex) { @@ -249,7 +249,7 @@ namespace Volo.Abp.Identity Check.NotNull(role, nameof(role)); - await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken); + await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken).ConfigureAwait(false); return role.Claims.Select(c => c.ToClaim()).ToList(); } @@ -268,7 +268,7 @@ namespace Volo.Abp.Identity Check.NotNull(role, nameof(role)); Check.NotNull(claim, nameof(claim)); - await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken); + await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken).ConfigureAwait(false); role.AddClaim(_guidGenerator, claim); } @@ -285,7 +285,7 @@ namespace Volo.Abp.Identity Check.NotNull(role, nameof(role)); Check.NotNull(claim, nameof(claim)); - await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken); + await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken).ConfigureAwait(false); role.RemoveClaim(claim); } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs index 0f732a8dd7..9e66b7b824 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs @@ -45,7 +45,7 @@ namespace Volo.Abp.Identity public virtual async Task GetByIdAsync(Guid id) { - var user = await Store.FindByIdAsync(id.ToString(), CancellationToken); + var user = await Store.FindByIdAsync(id.ToString(), CancellationToken).ConfigureAwait(false); if (user == null) { throw new EntityNotFoundException(typeof(IdentityUser), id); @@ -59,15 +59,15 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(roleNames, nameof(roleNames)); - var currentRoleNames = await GetRolesAsync(user); + var currentRoleNames = await GetRolesAsync(user).ConfigureAwait(false); - var result = await RemoveFromRolesAsync(user, currentRoleNames.Except(roleNames).Distinct()); + var result = await RemoveFromRolesAsync(user, currentRoleNames.Except(roleNames).Distinct()).ConfigureAwait(false); if (!result.Succeeded) { return result; } - result = await AddToRolesAsync(user, roleNames.Except(currentRoleNames).Distinct()); + result = await AddToRolesAsync(user, roleNames.Except(currentRoleNames).Distinct()).ConfigureAwait(false); if (!result.Succeeded) { return result; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs index cb380de5c7..1fdc6ff934 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.Identity includeDetails: false, cancellationToken: cancellationToken ) - )?.ToAbpUserData(); +.ConfigureAwait(false))?.ToAbpUserData(); } public virtual async Task FindByUserNameAsync( @@ -43,7 +43,7 @@ namespace Volo.Abp.Identity includeDetails: false, cancellationToken: cancellationToken ) - )?.ToAbpUserData(); +.ConfigureAwait(false))?.ToAbpUserData(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs index e92f31797d..cb03869ae6 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs @@ -163,7 +163,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.InsertAsync(user, AutoSaveChanges, cancellationToken); + await _userRepository.InsertAsync(user, AutoSaveChanges, cancellationToken).ConfigureAwait(false); return IdentityResult.Success; } @@ -182,7 +182,7 @@ namespace Volo.Abp.Identity try { - await _userRepository.UpdateAsync(user, AutoSaveChanges, cancellationToken); + await _userRepository.UpdateAsync(user, AutoSaveChanges, cancellationToken).ConfigureAwait(false); } catch (AbpDbConcurrencyException ex) { @@ -207,7 +207,7 @@ namespace Volo.Abp.Identity try { - await _userRepository.DeleteAsync(user, AutoSaveChanges, cancellationToken); + await _userRepository.DeleteAsync(user, AutoSaveChanges, cancellationToken).ConfigureAwait(false); } catch (AbpDbConcurrencyException ex) { @@ -313,14 +313,14 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(normalizedRoleName, nameof(normalizedRoleName)); - var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken); + var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken).ConfigureAwait(false); if (role == null) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Role {0} does not exist!", normalizedRoleName)); } - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken).ConfigureAwait(false); user.AddRole(role.Id); } @@ -343,13 +343,13 @@ namespace Volo.Abp.Identity throw new ArgumentException(nameof(normalizedRoleName) + " can not be null or whitespace"); } - var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken); + var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken).ConfigureAwait(false); if (role == null) { return; } - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken).ConfigureAwait(false); user.RemoveRole(role.Id); } @@ -388,13 +388,13 @@ namespace Volo.Abp.Identity throw new ArgumentException(nameof(normalizedRoleName) + " can not be null or whitespace"); } - var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken); + var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken).ConfigureAwait(false); if (role == null) { return false; } - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken).ConfigureAwait(false); return user.IsInRole(role.Id); } @@ -411,7 +411,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken).ConfigureAwait(false); return user.Claims.Select(c => c.ToClaim()).ToList(); } @@ -430,7 +430,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(claims, nameof(claims)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken).ConfigureAwait(false); user.AddClaims(_guidGenerator, claims); } @@ -451,7 +451,7 @@ namespace Volo.Abp.Identity Check.NotNull(claim, nameof(claim)); Check.NotNull(newClaim, nameof(newClaim)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken).ConfigureAwait(false); user.ReplaceClaim(claim, newClaim); } @@ -470,7 +470,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(claims, nameof(claims)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken).ConfigureAwait(false); user.RemoveClaims(claims); } @@ -489,7 +489,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(login, nameof(login)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken).ConfigureAwait(false); user.AddLogin(login); } @@ -510,7 +510,7 @@ namespace Volo.Abp.Identity Check.NotNull(loginProvider, nameof(loginProvider)); Check.NotNull(providerKey, nameof(providerKey)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken).ConfigureAwait(false); user.RemoveLogin(loginProvider, providerKey); } @@ -529,7 +529,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken).ConfigureAwait(false); return user.Logins.Select(l => l.ToUserLoginInfo()).ToList(); } @@ -988,7 +988,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken).ConfigureAwait(false); user.SetToken(loginProvider, name, value); } @@ -1007,7 +1007,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken).ConfigureAwait(false); user.RemoveToken(loginProvider, name); } @@ -1026,7 +1026,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken).ConfigureAwait(false); return user.FindToken(loginProvider, name)?.Value; } @@ -1053,7 +1053,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - var mergedCodes = await GetTokenAsync(user, InternalLoginProvider, RecoveryCodeTokenName, cancellationToken) ?? ""; + var mergedCodes = await GetTokenAsync(user, InternalLoginProvider, RecoveryCodeTokenName, cancellationToken).ConfigureAwait(false) ?? ""; if (mergedCodes.Length > 0) { return mergedCodes.Split(';').Length; @@ -1090,12 +1090,12 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(code, nameof(code)); - var mergedCodes = await GetTokenAsync(user, InternalLoginProvider, RecoveryCodeTokenName, cancellationToken) ?? ""; + var mergedCodes = await GetTokenAsync(user, InternalLoginProvider, RecoveryCodeTokenName, cancellationToken).ConfigureAwait(false) ?? ""; var splitCodes = mergedCodes.Split(';'); if (splitCodes.Contains(code)) { var updatedCodes = new List(splitCodes.Where(s => s != code)); - await ReplaceCodesAsync(user, updatedCodes, cancellationToken); + await ReplaceCodesAsync(user, updatedCodes, cancellationToken).ConfigureAwait(false); return true; } return false; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs index d2de24a568..c366591a57 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.Identity public virtual async Task GetRolesAsync(Guid userId) { - return (await _identityUserRepository.GetRoleNamesAsync(userId)).ToArray(); + return (await _identityUserRepository.GetRoleNamesAsync(userId).ConfigureAwait(false)).ToArray(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs index 95b7a7fe42..d7cb57d396 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { return await DbSet .WhereIf(ignoredId != null, ct => ct.Id != ignoredId) - .CountAsync(ct => ct.Name == name) > 0; + .CountAsync(ct => ct.Name == name).ConfigureAwait(false) > 0; } public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, string filter) @@ -34,7 +34,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore ) .OrderBy(sorting ?? "name desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(); + .ToListAsync().ConfigureAwait(false); return identityClaimTypes; } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs index a9850164ef..731cc6df23 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { return await DbSet .IncludeDetails(includeDetails) - .FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListAsync( @@ -39,7 +39,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .IncludeDetails(includeDetails) .OrderBy(sorting ?? nameof(IdentityRole.Name)) .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public override IQueryable WithDetails() diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs index cab891bc94..e3dfe6ee8c 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .FirstOrDefaultAsync( u => u.NormalizedUserName == normalizedUserName, GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); } public virtual async Task> GetRoleNamesAsync( @@ -40,7 +40,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore where userRole.UserId == id select role.Name; - return await query.ToListAsync(GetCancellationToken(cancellationToken)); + return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task FindByLoginAsync( @@ -52,7 +52,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await DbSet .IncludeDetails(includeDetails) .Where(u => u.Logins.Any(login => login.LoginProvider == loginProvider && login.ProviderKey == providerKey)) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task FindByNormalizedEmailAsync( @@ -62,7 +62,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { return await DbSet .IncludeDetails(includeDetails) - .FirstOrDefaultAsync(u => u.NormalizedEmail == normalizedEmail, GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(u => u.NormalizedEmail == normalizedEmail, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListByClaimAsync( @@ -73,7 +73,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await DbSet .IncludeDetails(includeDetails) .Where(u => u.Claims.Any(c => c.ClaimType == claim.Type && c.ClaimValue == claim.Value)) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListByNormalizedRoleNameAsync( @@ -83,7 +83,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { var role = await DbContext.Roles .Where(x => x.NormalizedName == normalizedRoleName) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); if (role == null) { @@ -93,7 +93,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await DbSet .IncludeDetails(includeDetails) .Where(u => u.Roles.Any(r => r.RoleId == role.Id)) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListAsync( @@ -114,7 +114,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore ) .OrderBy(sorting ?? nameof(IdentityUser.UserName)) .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetRolesAsync( @@ -127,7 +127,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore where userRole.UserId == id select role; - return await query.ToListAsync(GetCancellationToken(cancellationToken)); + return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task GetCountAsync( @@ -140,7 +140,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore u.UserName.Contains(filter) || u.Email.Contains(filter) ) - .LongCountAsync(GetCancellationToken(cancellationToken)); + .LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public override IQueryable WithDetails() diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs index a5fffe9848..1e5934cee5 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Identity public async Task GetRolesAsync(Guid userId) { - var output = await _userAppService.GetRolesAsync(userId); + var output = await _userAppService.GetRolesAsync(userId).ConfigureAwait(false); return output.Items.Select(r => r.Name).ToArray(); } } diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs index 16ba528412..beed5130f1 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs @@ -22,13 +22,13 @@ namespace Volo.Abp.Identity.MongoDB { return await GetMongoQueryable() .Where(ct => ct.Name == name) - .AnyAsync(); + .AnyAsync().ConfigureAwait(false); } else { return await GetMongoQueryable() .Where(ct => ct.Id != ignoredId && ct.Name == name) - .AnyAsync(); + .AnyAsync().ConfigureAwait(false); } } @@ -43,7 +43,7 @@ namespace Volo.Abp.Identity.MongoDB .OrderBy(sorting ?? nameof(IdentityClaimType.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(); + .ToListAsync().ConfigureAwait(false); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs index 50c1403a03..4bae372c8e 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)); + return await GetMongoQueryable().FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task> GetListAsync( @@ -41,7 +41,7 @@ namespace Volo.Abp.Identity.MongoDB .OrderBy(sorting ?? nameof(IdentityRole.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs index 3d6f188c56..9c3b8bcd0e 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs @@ -32,16 +32,16 @@ namespace Volo.Abp.Identity.MongoDB .FirstOrDefaultAsync( u => u.NormalizedUserName == normalizedUserName, GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); } public async Task> GetRoleNamesAsync( Guid id, CancellationToken cancellationToken = default) { - var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)); + var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)).ConfigureAwait(false); var roleIds = user.Roles.Select(r => r.RoleId).ToArray(); - return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken)); + return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task FindByLoginAsync( @@ -51,8 +51,8 @@ namespace Volo.Abp.Identity.MongoDB CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .Where(u=> u.Logins.Any(login => login.LoginProvider == loginProvider && login.ProviderKey == providerKey)) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + .Where(u => u.Logins.Any(login => login.LoginProvider == loginProvider && login.ProviderKey == providerKey)) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task FindByNormalizedEmailAsync( @@ -60,7 +60,7 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().FirstOrDefaultAsync(u => u.NormalizedEmail == normalizedEmail, GetCancellationToken(cancellationToken)); + return await GetMongoQueryable().FirstOrDefaultAsync(u => u.NormalizedEmail == normalizedEmail, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task> GetListByClaimAsync( @@ -70,7 +70,7 @@ namespace Volo.Abp.Identity.MongoDB { return await GetMongoQueryable() .Where(u => u.Claims.Any(c => c.ClaimType == claim.Type && c.ClaimValue == claim.Value)) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task> GetListByNormalizedRoleNameAsync( @@ -78,7 +78,7 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = false, CancellationToken cancellationToken = default) { - var role = await DbContext.Roles.AsQueryable().Where(x => x.NormalizedName == normalizedRoleName).FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + var role = await DbContext.Roles.AsQueryable().Where(x => x.NormalizedName == normalizedRoleName).FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); if (role == null) { @@ -87,7 +87,7 @@ namespace Volo.Abp.Identity.MongoDB return await GetMongoQueryable() .Where(u => u.Roles.Any(r => r.RoleId == role.Id)) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task> GetListAsync( @@ -108,7 +108,7 @@ namespace Volo.Abp.Identity.MongoDB .OrderBy(sorting ?? nameof(IdentityUser.UserName)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task> GetRolesAsync( @@ -116,9 +116,9 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = false, CancellationToken cancellationToken = default) { - var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)); + var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)).ConfigureAwait(false); var roleIds = user.Roles.Select(r => r.RoleId).ToArray(); - return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).ToListAsync(GetCancellationToken(cancellationToken)); + return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task GetCountAsync( @@ -132,7 +132,7 @@ namespace Volo.Abp.Identity.MongoDB u.UserName.Contains(filter) || u.Email.Contains(filter) ) - .LongCountAsync(GetCancellationToken(cancellationToken)); + .LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs b/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs index 34dc3dd4cd..d6d61dcff4 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs @@ -18,8 +18,8 @@ namespace Volo.Abp.Identity.Web.Navigation var authorizationService = context.ServiceProvider.GetRequiredService(); - var hasRolePermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Roles.Default); - var hasUserPermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Users.Default); + var hasRolePermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Roles.Default).ConfigureAwait(false); + var hasUserPermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Users.Default).ConfigureAwait(false); if (hasRolePermission || hasUserPermission) { diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs index b3fdad3a95..4861944c7f 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles ValidateModel(); var input = ObjectMapper.Map(Role); - await _identityRoleAppService.CreateAsync(input); + await _identityRoleAppService.CreateAsync(input).ConfigureAwait(false); return NoContent(); } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs index 8416e171b0..42f13b4bf5 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles { Role = ObjectMapper.Map( await _identityRoleAppService.GetAsync(id) - ); +.ConfigureAwait(false)); } public async Task OnPostAsync() @@ -30,7 +30,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles ValidateModel(); var input = ObjectMapper.Map(Role); - await _identityRoleAppService.UpdateAsync(Role.Id, input); + await _identityRoleAppService.UpdateAsync(Role.Id, input).ConfigureAwait(false); return NoContent(); } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs index 7b3822e64b..e2dbedc660 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users { UserInfo = new UserInfoViewModel(); - var roleDtoList = await _identityRoleAppService.GetListAsync(new PagedAndSortedResultRequestDto()); + var roleDtoList = await _identityRoleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false); Roles = ObjectMapper.Map, AssignedRoleViewModel[]>(roleDtoList.Items); @@ -45,7 +45,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users var input = ObjectMapper.Map(UserInfo); input.RoleNames = Roles.Where(r => r.IsAssigned).Select(r => r.Name).ToArray(); - await _identityUserAppService.CreateAsync(input); + await _identityUserAppService.CreateAsync(input).ConfigureAwait(false); return NoContent(); } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs index 4d4adf7a70..7a55711bd3 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs @@ -28,13 +28,13 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users public async Task OnGetAsync(Guid id) { - UserInfo = ObjectMapper.Map(await _identityUserAppService.GetAsync(id)); + UserInfo = ObjectMapper.Map(await _identityUserAppService.GetAsync(id).ConfigureAwait(false)); Roles = ObjectMapper.Map, AssignedRoleViewModel[]>( - (await _identityRoleAppService.GetListAsync(new PagedAndSortedResultRequestDto())).Items + (await _identityRoleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false)).Items ); - var userRoleNames = (await _identityUserAppService.GetRolesAsync(UserInfo.Id)).Items.Select(r => r.Name).ToList(); + var userRoleNames = (await _identityUserAppService.GetRolesAsync(UserInfo.Id).ConfigureAwait(false)).Items.Select(r => r.Name).ToList(); foreach (var role in Roles) { if (userRoleNames.Contains(role.Name)) @@ -50,7 +50,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users var input = ObjectMapper.Map(UserInfo); input.RoleNames = Roles.Where(r => r.IsAssigned).Select(r => r.Name).ToArray(); - await _identityUserAppService.UpdateAsync(UserInfo.Id, input); + await _identityUserAppService.UpdateAsync(UserInfo.Id, input).ConfigureAwait(false); return NoContent(); } diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs index 09fb389163..2c7920539c 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs @@ -39,11 +39,11 @@ namespace Volo.Abp.PermissionManagement.Identity if (providerName == UserPermissionValueProvider.ProviderName) { var userId = Guid.Parse(providerKey); - var roleNames = await _userRoleFinder.GetRolesAsync(userId); + var roleNames = await _userRoleFinder.GetRolesAsync(userId).ConfigureAwait(false); foreach (var roleName in roleNames) { - var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, roleName); + var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, roleName).ConfigureAwait(false); if (permissionGrant != null) { return new PermissionValueProviderGrantInfo(true, roleName); diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs index 663cc07786..b743ee54e9 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs @@ -23,11 +23,11 @@ namespace Volo.Abp.Identity { //Arrange - var moderator = await GetRoleAsync("moderator"); + var moderator = await GetRoleAsync("moderator").ConfigureAwait(false); //Act - var result = await _roleAppService.GetAsync(moderator.Id); + var result = await _roleAppService.GetAsync(moderator.Id).ConfigureAwait(false); //Assert @@ -39,7 +39,7 @@ namespace Volo.Abp.Identity { //Act - var result = await _roleAppService.GetListAsync(new PagedAndSortedResultRequestDto()); + var result = await _roleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false); //Assert @@ -58,14 +58,14 @@ namespace Volo.Abp.Identity //Act - var result = await _roleAppService.CreateAsync(input); + var result = await _roleAppService.CreateAsync(input).ConfigureAwait(false); //Assert result.Id.ShouldNotBe(Guid.Empty); result.Name.ShouldBe(input.Name); - var role = await _roleRepository.GetAsync(result.Id); + var role = await _roleRepository.GetAsync(result.Id).ConfigureAwait(false); role.Name.ShouldBe(input.Name); } @@ -74,7 +74,7 @@ namespace Volo.Abp.Identity { //Arrange - var moderator = await GetRoleAsync("moderator"); + var moderator = await GetRoleAsync("moderator").ConfigureAwait(false); var input = new IdentityRoleUpdateDto { @@ -86,14 +86,14 @@ namespace Volo.Abp.Identity //Act - var result = await _roleAppService.UpdateAsync(moderator.Id, input); + var result = await _roleAppService.UpdateAsync(moderator.Id, input).ConfigureAwait(false); //Assert result.Id.ShouldBe(moderator.Id); result.Name.ShouldBe(input.Name); - var updatedRole = await _roleRepository.GetAsync(moderator.Id); + var updatedRole = await _roleRepository.GetAsync(moderator.Id).ConfigureAwait(false); updatedRole.Name.ShouldBe(input.Name); } @@ -102,15 +102,15 @@ namespace Volo.Abp.Identity { //Arrange - var moderator = await GetRoleAsync("moderator"); + var moderator = await GetRoleAsync("moderator").ConfigureAwait(false); //Act - await _roleAppService.DeleteAsync(moderator.Id); + await _roleAppService.DeleteAsync(moderator.Id).ConfigureAwait(false); //Assert - (await FindRoleAsync("moderator")).ShouldBeNull(); + (await FindRoleAsync("moderator").ConfigureAwait(false)).ShouldBeNull(); } private async Task GetRoleAsync(string roleName) diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs index 6fbf23ed73..19cfb705fd 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity //Act - var result = await _userAppService.GetAsync(johnNash.Id); + var result = await _userAppService.GetAsync(johnNash.Id).ConfigureAwait(false); //Assert @@ -44,7 +44,7 @@ namespace Volo.Abp.Identity { //Act - var result = await _userAppService.GetListAsync(new GetIdentityUsersInput()); + var result = await _userAppService.GetListAsync(new GetIdentityUsersInput()).ConfigureAwait(false); //Assert @@ -69,7 +69,7 @@ namespace Volo.Abp.Identity //Act - var result = await _userAppService.CreateAsync(input); + var result = await _userAppService.CreateAsync(input).ConfigureAwait(false); //Assert @@ -79,7 +79,7 @@ namespace Volo.Abp.Identity result.LockoutEnabled.ShouldBe(input.LockoutEnabled); result.PhoneNumber.ShouldBe(input.PhoneNumber); - var user = await _userRepository.GetAsync(result.Id); + var user = await _userRepository.GetAsync(result.Id).ConfigureAwait(false); user.Id.ShouldBe(result.Id); user.UserName.ShouldBe(input.UserName); user.Email.ShouldBe(input.Email); @@ -110,7 +110,7 @@ namespace Volo.Abp.Identity //Act - var result = await _userAppService.UpdateAsync(johnNash.Id, input); + var result = await _userAppService.UpdateAsync(johnNash.Id, input).ConfigureAwait(false); //Assert @@ -120,7 +120,7 @@ namespace Volo.Abp.Identity result.LockoutEnabled.ShouldBe(input.LockoutEnabled); result.PhoneNumber.ShouldBe(input.PhoneNumber); - var user = await _userRepository.GetAsync(result.Id); + var user = await _userRepository.GetAsync(result.Id).ConfigureAwait(false); user.Id.ShouldBe(result.Id); user.UserName.ShouldBe(input.UserName); user.Email.ShouldBe(input.Email); @@ -134,7 +134,7 @@ namespace Volo.Abp.Identity public async Task UpdateAsync_Concurrency_Exception() { //Get user - var johnNash = await _userAppService.GetAsync(_testData.UserJohnId); + var johnNash = await _userAppService.GetAsync(_testData.UserJohnId).ConfigureAwait(false); //Act @@ -151,13 +151,13 @@ namespace Volo.Abp.Identity ConcurrencyStamp = johnNash.ConcurrencyStamp }; - await _userAppService.UpdateAsync(johnNash.Id, input); + await _userAppService.UpdateAsync(johnNash.Id, input).ConfigureAwait(false); //Second update with same input will throw exception because the entity has been modified (await Assert.ThrowsAsync(async () => { - await _userAppService.UpdateAsync(johnNash.Id, input); - })).Message.ShouldContain("Optimistic concurrency failure"); + await _userAppService.UpdateAsync(johnNash.Id, input).ConfigureAwait(false); + }).ConfigureAwait(false)).Message.ShouldContain("Optimistic concurrency failure"); } [Fact] @@ -169,7 +169,7 @@ namespace Volo.Abp.Identity //Act - await _userAppService.DeleteAsync(johnNash.Id); + await _userAppService.DeleteAsync(johnNash.Id).ConfigureAwait(false); //Assert @@ -185,7 +185,7 @@ namespace Volo.Abp.Identity //Act - var result = await _userAppService.GetRolesAsync(johnNash.Id); + var result = await _userAppService.GetRolesAsync(johnNash.Id).ConfigureAwait(false); //Assert @@ -209,11 +209,11 @@ namespace Volo.Abp.Identity { RoleNames = new[] { "admin", "moderator" } } - ); + ).ConfigureAwait(false); //Assert - var roleNames = await _userRepository.GetRoleNamesAsync(johnNash.Id); + var roleNames = await _userRepository.GetRoleNamesAsync(johnNash.Id).ConfigureAwait(false); roleNames.Count.ShouldBe(2); roleNames.ShouldContain("admin"); roleNames.ShouldContain("moderator"); diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs index 227977cf15..f28c65be83 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs @@ -24,32 +24,32 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByIdAsync() { - var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserLookupAppService.FindByIdAsync(user.Id)).UserName.ShouldBe(user.UserName); + (await _identityUserLookupAppService.FindByIdAsync(user.Id).ConfigureAwait(false)).UserName.ShouldBe(user.UserName); } [Fact] public async Task FindById_NotExist_Should_Return_Null() { - var user = await _identityUserLookupAppService.FindByIdAsync(Guid.NewGuid()); + var user = await _identityUserLookupAppService.FindByIdAsync(Guid.NewGuid()).ConfigureAwait(false); user.ShouldBeNull(); } [Fact] public async Task FindByUserNameAsync() { - var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserLookupAppService.FindByUserNameAsync(user.UserName)).UserName.ShouldBe(user.UserName); + (await _identityUserLookupAppService.FindByUserNameAsync(user.UserName).ConfigureAwait(false)).UserName.ShouldBe(user.UserName); } [Fact] public async Task FindByUserName_NotExist_Should_Return_Null() { - var user = await _identityUserLookupAppService.FindByUserNameAsync(Guid.NewGuid().ToString()); + var user = await _identityUserLookupAppService.FindByUserNameAsync(Guid.NewGuid().ToString()).ConfigureAwait(false); user.ShouldBeNull(); } } diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs index fc0334ce05..c6e2d45055 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.Identity _currentUser.IsAuthenticated.Returns(true); //Act - var result = await _profileAppService.GetAsync(); + var result = await _profileAppService.GetAsync().ConfigureAwait(false); //Assert var johnNash = GetUser("john.nash"); @@ -62,7 +62,7 @@ namespace Volo.Abp.Identity }; //Act - var result = await _profileAppService.UpdateAsync(input); + var result = await _profileAppService.UpdateAsync(input).ConfigureAwait(false); //Assert result.UserName.ShouldBe(input.UserName); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityResultException_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityResultException_Tests.cs index 6f81d8dcf5..cc349fd3f3 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityResultException_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityResultException_Tests.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Identity ) ); - using (AbpCultureHelper.Use("tr")) + using (CultureHelper.Use("tr")) { var localizeMessage = exception.LocalizeMessage(new LocalizationContext(ServiceProvider)); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs index 95e8f925c4..e16228290c 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs @@ -40,11 +40,11 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); - await _userManager.SetEmailAsync(user, "john.nash_UPDATED@abp.io"); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + await _userManager.SetEmailAsync(user, "john.nash_UPDATED@abp.io").ConfigureAwait(false); _testCounter.GetValue("EntityUpdatedEto").ShouldBe(0); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } _testCounter.GetValue("EntityUpdatedEto").ShouldBe(1); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityClaimTypeManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityClaimTypeManager_Tests.cs index c5c68d40c6..c7622bec8b 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityClaimTypeManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityClaimTypeManager_Tests.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Identity { var claimType = await _claimTypeManager.CreateAsync(new IdentityClaimType(Guid.NewGuid(), "Phone", false, false, null, - null, null, IdentityClaimValueType.String)); + null, null, IdentityClaimValueType.String)).ConfigureAwait(false); claimType.ShouldNotBeNull(); claimType.Name.ShouldBe("Phone"); @@ -36,17 +36,17 @@ namespace Volo.Abp.Identity { await Assert.ThrowsAnyAsync(async () => await _claimTypeManager.CreateAsync( new IdentityClaimType( - Guid.NewGuid(), "Age"))); + Guid.NewGuid(), "Age")).ConfigureAwait(false)).ConfigureAwait(false); } [Fact] public async Task UpdateAsync() { - var ageClaim = await _identityClaimTypeRepository.FindAsync(_testData.AgeClaimId); + var ageClaim = await _identityClaimTypeRepository.FindAsync(_testData.AgeClaimId).ConfigureAwait(false); ageClaim.ShouldNotBeNull(); ageClaim.Description = "this is age"; - var updatedAgeClaimType = await _claimTypeManager.UpdateAsync(ageClaim); + var updatedAgeClaimType = await _claimTypeManager.UpdateAsync(ageClaim).ConfigureAwait(false); updatedAgeClaimType.ShouldNotBeNull(); updatedAgeClaimType.Description.ShouldBe("this is age"); } @@ -57,7 +57,7 @@ namespace Volo.Abp.Identity { await Assert.ThrowsAnyAsync(async () => await _claimTypeManager.UpdateAsync( new IdentityClaimType( - Guid.NewGuid(), "Age"))); + Guid.NewGuid(), "Age")).ConfigureAwait(false)).ConfigureAwait(false); } @@ -65,9 +65,9 @@ namespace Volo.Abp.Identity public async Task Static_IdentityClaimType_Cant_Not_Update() { var phoneClaim = new IdentityClaimType(Guid.NewGuid(), "Phone", true, true); - await _identityClaimTypeRepository.InsertAsync(phoneClaim); + await _identityClaimTypeRepository.InsertAsync(phoneClaim).ConfigureAwait(false); - await Assert.ThrowsAnyAsync(async () => await _claimTypeManager.UpdateAsync(phoneClaim)); + await Assert.ThrowsAnyAsync(async () => await _claimTypeManager.UpdateAsync(phoneClaim).ConfigureAwait(false)).ConfigureAwait(false); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs index 4314f3eac6..fbb2a3c023 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetByIdAsync() { - var role = await _identityRoleManager.FindByIdAsync(_testData.RoleModeratorId.ToString()); + var role = await _identityRoleManager.FindByIdAsync(_testData.RoleModeratorId.ToString()).ConfigureAwait(false); role.ShouldNotBeNull(); role.Name.ShouldBe("moderator"); @@ -37,10 +37,10 @@ namespace Volo.Abp.Identity [Fact] public async Task SetRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - (await _identityRoleManager.SetRoleNameAsync(role, "teacher")).Succeeded.ShouldBeTrue(); + (await _identityRoleManager.SetRoleNameAsync(role, "teacher").ConfigureAwait(false)).Succeeded.ShouldBeTrue(); role.Name.ShouldBe("teacher"); } @@ -48,12 +48,12 @@ namespace Volo.Abp.Identity [Fact] public async Task DeleteAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - await _identityRoleManager.DeleteAsync(role); + await _identityRoleManager.DeleteAsync(role).ConfigureAwait(false); - (await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator"))).ShouldBeNull(); + (await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false)).ShouldBeNull(); } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs index 11345a4a46..9a4d9d194d 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs @@ -32,9 +32,9 @@ namespace Volo.Abp.Identity { var roleId = Guid.NewGuid(); var role = new IdentityRole(roleId, "teacher"); - (await _identityRoleStore.CreateAsync(role)).Succeeded.ShouldBeTrue(); + (await _identityRoleStore.CreateAsync(role).ConfigureAwait(false)).Succeeded.ShouldBeTrue(); - var teacher = await _identityRoleStore.FindByIdAsync(roleId.ToString()); + var teacher = await _identityRoleStore.FindByIdAsync(roleId.ToString()).ConfigureAwait(false); teacher.ShouldNotBeNull(); teacher.Name.ShouldBe("teacher"); @@ -43,11 +43,11 @@ namespace Volo.Abp.Identity [Fact] public async Task UpdateAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); role.IsDefault = true; - await _identityRoleStore.UpdateAsync(role); + await _identityRoleStore.UpdateAsync(role).ConfigureAwait(false); role.IsDefault.ShouldBeTrue(); } @@ -56,40 +56,40 @@ namespace Volo.Abp.Identity [Fact] public async Task DeleteAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - await _identityRoleStore.DeleteAsync(role); + await _identityRoleStore.DeleteAsync(role).ConfigureAwait(false); - (await _identityRoleStore.FindByIdAsync(_testData.RoleModeratorId.ToString())).ShouldBeNull(); + (await _identityRoleStore.FindByIdAsync(_testData.RoleModeratorId.ToString()).ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task GetRoleIdAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - (await _identityRoleStore.GetRoleIdAsync(role)).ShouldBe(_testData.RoleModeratorId.ToString()); + (await _identityRoleStore.GetRoleIdAsync(role).ConfigureAwait(false)).ShouldBe(_testData.RoleModeratorId.ToString()); } [Fact] public async Task GetRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - (await _identityRoleStore.GetRoleNameAsync(role)).ShouldBe(role.Name); + (await _identityRoleStore.GetRoleNameAsync(role).ConfigureAwait(false)).ShouldBe(role.Name); } [Fact] public async Task SetRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - await _identityRoleStore.SetRoleNameAsync(role, "teacher"); + await _identityRoleStore.SetRoleNameAsync(role, "teacher").ConfigureAwait(false); role.Name.ShouldBe("teacher"); } @@ -97,7 +97,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByIdAsync() { - var role = await _identityRoleStore.FindByIdAsync(_testData.RoleModeratorId.ToString()); + var role = await _identityRoleStore.FindByIdAsync(_testData.RoleModeratorId.ToString()).ConfigureAwait(false); role.ShouldNotBeNull(); role.Name.ShouldBe("moderator"); @@ -106,7 +106,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNameAsync() { - var role = await _identityRoleStore.FindByNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleStore.FindByNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); role.Name.ShouldBe("moderator"); @@ -115,19 +115,19 @@ namespace Volo.Abp.Identity [Fact] public async Task GetNormalizedRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - (await _identityRoleStore.GetNormalizedRoleNameAsync(role)).ShouldBe(role.NormalizedName); + (await _identityRoleStore.GetNormalizedRoleNameAsync(role).ConfigureAwait(false)).ShouldBe(role.NormalizedName); } [Fact] public async Task SetNormalizedRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - await _identityRoleStore.SetNormalizedRoleNameAsync(role, _lookupNormalizer.NormalizeName("teacher")); + await _identityRoleStore.SetNormalizedRoleNameAsync(role, _lookupNormalizer.NormalizeName("teacher")).ConfigureAwait(false); role.NormalizedName.ShouldBe(_lookupNormalizer.NormalizeName("teacher")); } @@ -137,15 +137,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - var claims = await _identityRoleStore.GetClaimsAsync(role); + var claims = await _identityRoleStore.GetClaimsAsync(role).ConfigureAwait(false); claims.ShouldNotBeEmpty(); claims.ShouldContain(x => x.Type == "test-claim" && x.Value == "test-value"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -156,7 +156,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); role.Claims.Add(new IdentityRoleClaim(Guid.NewGuid(), role.Id, "my-claim", "my-value", role.TenantId)); @@ -164,7 +164,7 @@ namespace Volo.Abp.Identity //role.Claims.ShouldContain(x => x.ClaimType == "my-claim" && x.ClaimValue == "my-value"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -173,7 +173,7 @@ namespace Volo.Abp.Identity throw; } - var role2 = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role2 = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role2.ShouldNotBeNull(); role2.Claims.ShouldContain(x => x.ClaimType == "my-claim" && x.ClaimValue == "my-value"); } @@ -183,14 +183,14 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.ShouldNotBeNull(); - await _identityRoleStore.RemoveClaimAsync(role, new Claim("test-claim", "test-value")); + await _identityRoleStore.RemoveClaimAsync(role, new Claim("test-claim", "test-value")).ConfigureAwait(false); role.Claims.ShouldNotContain(x => x.ClaimType == "test-claim" && x.ClaimValue == "test-value"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs index 761655deb2..bc03f35c49 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs @@ -31,7 +31,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetByIdAsync() { - var user = await _identityUserManager.GetByIdAsync(_testData.UserJohnId); + var user = await _identityUserManager.GetByIdAsync(_testData.UserJohnId).ConfigureAwait(false); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); @@ -43,18 +43,18 @@ namespace Volo.Abp.Identity using (var uow = _unitOfWorkManager.Begin()) { var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.NormalizeName("david")); + _lookupNormalizer.NormalizeName("david")).ConfigureAwait(false); user.ShouldNotBeNull(); var identityResult = await _identityUserManager.SetRolesAsync(user, new List() { "moderator", - }); + }).ConfigureAwait(false); identityResult.Succeeded.ShouldBeTrue(); user.Roles.ShouldContain(x => x.RoleId == _testData.RoleModeratorId); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -64,23 +64,23 @@ namespace Volo.Abp.Identity using (var uow = _unitOfWorkManager.Begin()) { var roleSupporter = - await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("supporter")); + await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("supporter")).ConfigureAwait(false); roleSupporter.ShouldNotBeNull(); var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.NormalizeName("john.nash")); + _lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); var identityResult = await _identityUserManager.SetRolesAsync(user, new List() { "admin", - }); + }).ConfigureAwait(false); identityResult.Succeeded.ShouldBeTrue(); user.Roles.ShouldNotContain(x => x.RoleId == _testData.RoleModeratorId); user.Roles.ShouldNotContain(x => x.RoleId == roleSupporter.Id); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs index 6e84a88450..6c7b6610ae 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs @@ -29,29 +29,29 @@ namespace Volo.Abp.Identity [Fact] public async Task GetUserIdAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetUserIdAsync(user)).ShouldBe(user.Id.ToString()); + (await _identityUserStore.GetUserIdAsync(user).ConfigureAwait(false)).ShouldBe(user.Id.ToString()); } [Fact] public async Task GetUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetUserNameAsync(user)).ShouldBe(user.UserName); + (await _identityUserStore.GetUserNameAsync(user).ConfigureAwait(false)).ShouldBe(user.UserName); } [Fact] public async Task SetUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetUserNameAsync(user, "bob.lee"); + await _identityUserStore.SetUserNameAsync(user, "bob.lee").ConfigureAwait(false); user.UserName.ShouldBe("bob.lee"); //user.NormalizedUserName.ShouldBe(_lookupNormalizer.Normalize("bob.lee")); } @@ -60,19 +60,19 @@ namespace Volo.Abp.Identity [Fact] public async Task GetNormalizedUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetNormalizedUserNameAsync(user)).ShouldBe(user.NormalizedUserName); + (await _identityUserStore.GetNormalizedUserNameAsync(user).ConfigureAwait(false)).ShouldBe(user.NormalizedUserName); } [Fact] public async Task SetNormalizedUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetNormalizedUserNameAsync(user, _lookupNormalizer.NormalizeName("bob.lee")); + await _identityUserStore.SetNormalizedUserNameAsync(user, _lookupNormalizer.NormalizeName("bob.lee")).ConfigureAwait(false); user.NormalizedUserName.ShouldBe(_lookupNormalizer.NormalizeName("bob.lee")); } @@ -83,9 +83,9 @@ namespace Volo.Abp.Identity var userId = Guid.NewGuid(); var user = new IdentityUser(userId, "bob.lee", "bob.lee@abp.io"); - await _identityUserStore.CreateAsync(user); + await _identityUserStore.CreateAsync(user).ConfigureAwait(false); - var bobLee = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("bob.lee")); + var bobLee = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("bob.lee")).ConfigureAwait(false); bobLee.ShouldNotBeNull(); bobLee.UserName.ShouldBe("bob.lee"); bobLee.Email.ShouldBe("bob.lee@abp.io"); @@ -94,26 +94,26 @@ namespace Volo.Abp.Identity [Fact] public async Task UpdateAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); user.Name = "lee"; - (await _identityUserStore.UpdateAsync(user)).Succeeded.ShouldBeTrue(); + (await _identityUserStore.UpdateAsync(user).ConfigureAwait(false)).Succeeded.ShouldBeTrue(); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash"))).Name + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false)).Name .ShouldBe("lee"); } [Fact] public async Task Update_Concurrency() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.UpdateAsync(user)).Succeeded.ShouldBeTrue(); + (await _identityUserStore.UpdateAsync(user).ConfigureAwait(false)).Succeeded.ShouldBeTrue(); user.ConcurrencyStamp = Guid.NewGuid().ToString(); - var identityResult = await _identityUserStore.UpdateAsync(user); + var identityResult = await _identityUserStore.UpdateAsync(user).ConfigureAwait(false); identityResult.Succeeded.ShouldBeFalse(); identityResult.Errors.ShouldContain(x => @@ -126,19 +126,19 @@ namespace Volo.Abp.Identity [Fact] public async Task DeleteAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.DeleteAsync(user)).Succeeded.ShouldBeTrue(); + (await _identityUserStore.DeleteAsync(user).ConfigureAwait(false)).Succeeded.ShouldBeTrue(); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash"))).ShouldBeNull(); + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task FindByIdAsync() { - var user = await _identityUserStore.FindByIdAsync(_testData.UserJohnId.ToString()); + var user = await _identityUserStore.FindByIdAsync(_testData.UserJohnId.ToString()).ConfigureAwait(false); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); @@ -148,7 +148,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNameAsync() { - var user = await _identityUserStore.FindByNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _identityUserStore.FindByNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); @@ -158,11 +158,11 @@ namespace Volo.Abp.Identity [Fact] public async Task SetPasswordHashAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); user.PasswordHash.ShouldBeNull(); - await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd"); + await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd").ConfigureAwait(false); user.PasswordHash.ShouldBe("P@ssw0rd"); } @@ -170,23 +170,23 @@ namespace Volo.Abp.Identity [Fact] public async Task GetPasswordHashAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd"); + await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd").ConfigureAwait(false); - (await _identityUserStore.GetPasswordHashAsync(user)).ShouldBe("P@ssw0rd"); + (await _identityUserStore.GetPasswordHashAsync(user).ConfigureAwait(false)).ShouldBe("P@ssw0rd"); } [Fact] public async Task HasPasswordAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.HasPasswordAsync(user)).ShouldBeFalse(); + (await _identityUserStore.HasPasswordAsync(user).ConfigureAwait(false)).ShouldBeFalse(); - await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd"); - (await _identityUserStore.HasPasswordAsync(user)).ShouldBeTrue(); + await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd").ConfigureAwait(false); + (await _identityUserStore.HasPasswordAsync(user).ConfigureAwait(false)).ShouldBeTrue(); } [Fact] @@ -194,15 +194,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("david")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("david")).ConfigureAwait(false); user.ShouldNotBeNull(); user.Roles.ShouldBeEmpty(); - await _identityUserStore.AddToRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")); + await _identityUserStore.AddToRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); user.Roles.ShouldContain(x => x.RoleId == _testData.RoleModeratorId); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -211,15 +211,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); user.Roles.ShouldContain(x => x.RoleId == _testData.RoleModeratorId); - await _identityUserStore.RemoveFromRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")); + await _identityUserStore.RemoveFromRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); user.Roles.ShouldNotContain(x => x.RoleId == _testData.RoleModeratorId); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -227,10 +227,10 @@ namespace Volo.Abp.Identity [Fact] public async Task GetRolesAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - var roleNames = await _identityUserStore.GetRolesAsync(user); + var roleNames = await _identityUserStore.GetRolesAsync(user).ConfigureAwait(false); roleNames.ShouldNotBeEmpty(); roleNames.ShouldContain(x => x == "moderator"); roleNames.ShouldContain(x => x == "supporter"); @@ -241,13 +241,13 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderator"))).ShouldBeTrue(); - (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderatorNotExist"))).ShouldBeFalse(); + (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false)).ShouldBeTrue(); + (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderatorNotExist")).ConfigureAwait(false)).ShouldBeFalse(); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -256,14 +256,14 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - var claims = await _identityUserStore.GetClaimsAsync(user); + var claims = await _identityUserStore.GetClaimsAsync(user).ConfigureAwait(false); claims.ShouldNotBeEmpty(); claims.ShouldContain(x => x.Type == "TestClaimType" && x.Value == "42"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -272,18 +272,18 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); user.Claims.ShouldNotContain(x => x.ClaimType == "MyClaimType" && x.ClaimValue == "MyClaimValue"); await _identityUserStore.AddClaimsAsync(user, new List() { new Claim("MyClaimType", "MyClaimValue") - }); + }).ConfigureAwait(false); user.Claims.ShouldContain(x => x.ClaimType == "MyClaimType" && x.ClaimValue == "MyClaimValue"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -292,15 +292,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.ReplaceClaimAsync(user, new Claim("TestClaimType", "42"), new Claim("MyClaimType", "MyClaimValue")); + await _identityUserStore.ReplaceClaimAsync(user, new Claim("TestClaimType", "42"), new Claim("MyClaimType", "MyClaimValue")).ConfigureAwait(false); user.Claims.ShouldNotContain(x => x.ClaimType == "TestClaimType" && x.ClaimValue == "42"); user.Claims.ShouldContain(x => x.ClaimType == "MyClaimType" && x.ClaimValue == "MyClaimValue"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -309,17 +309,17 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); await _identityUserStore.RemoveClaimsAsync(user, new List() { new Claim("TestClaimType", "42") - }); + }).ConfigureAwait(false); user.Claims.ShouldNotContain(x => x.ClaimType == "TestClaimType" && x.ClaimValue == "42"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -328,15 +328,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); user.Logins.ShouldNotContain(x => x.LoginProvider == "facebook" && x.ProviderKey == "john"); - await _identityUserStore.AddLoginAsync(user, new UserLoginInfo("facebook", "john", "John Nash")); + await _identityUserStore.AddLoginAsync(user, new UserLoginInfo("facebook", "john", "John Nash")).ConfigureAwait(false); user.Logins.ShouldContain(x => x.LoginProvider == "facebook" && x.ProviderKey == "john"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -345,15 +345,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); user.Logins.ShouldContain(x => x.LoginProvider == "github" && x.ProviderKey == "john"); - await _identityUserStore.RemoveLoginAsync(user, "github", "john"); + await _identityUserStore.RemoveLoginAsync(user, "github", "john").ConfigureAwait(false); user.Logins.ShouldNotContain(x => x.LoginProvider == "github" && x.ProviderKey == "john"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -363,16 +363,16 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - var logins = await _identityUserStore.GetLoginsAsync(user); + var logins = await _identityUserStore.GetLoginsAsync(user).ConfigureAwait(false); logins.ShouldNotBeNull(); logins.ShouldContain(x => x.LoginProvider == "github" && x.ProviderKey == "john"); logins.ShouldContain(x => x.LoginProvider == "twitter" && x.ProviderKey == "johnx"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -380,7 +380,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByLoginAsync() { - var user = await _identityUserStore.FindByLoginAsync("github", "john"); + var user = await _identityUserStore.FindByLoginAsync("github", "john").ConfigureAwait(false); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); } @@ -389,21 +389,21 @@ namespace Volo.Abp.Identity [Fact] public async Task GetEmailConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetEmailConfirmedAsync(user)).ShouldBe(user.EmailConfirmed); + (await _identityUserStore.GetEmailConfirmedAsync(user).ConfigureAwait(false)).ShouldBe(user.EmailConfirmed); } [Fact] public async Task SetEmailConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); var emailConfirmed = user.EmailConfirmed; - await _identityUserStore.SetEmailConfirmedAsync(user, !emailConfirmed); + await _identityUserStore.SetEmailConfirmedAsync(user, !emailConfirmed).ConfigureAwait(false); user.EmailConfirmed.ShouldBe(!emailConfirmed); } @@ -411,10 +411,10 @@ namespace Volo.Abp.Identity [Fact] public async Task SetEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetEmailAsync(user, "john.nash.kobe@abp.io"); + await _identityUserStore.SetEmailAsync(user, "john.nash.kobe@abp.io").ConfigureAwait(false); user.Email.ShouldBe("john.nash.kobe@abp.io"); //user.NormalizedEmail.ShouldBe(_lookupNormalizer.Normalize("john.nash.kobe@abp.io")); @@ -423,28 +423,28 @@ namespace Volo.Abp.Identity [Fact] public async Task GetEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetEmailAsync(user)).ShouldBe(user.Email); + (await _identityUserStore.GetEmailAsync(user).ConfigureAwait(false)).ShouldBe(user.Email); } [Fact] public async Task GetNormalizedEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetNormalizedEmailAsync(user)).ShouldBe(user.NormalizedEmail); + (await _identityUserStore.GetNormalizedEmailAsync(user).ConfigureAwait(false)).ShouldBe(user.NormalizedEmail); } [Fact] public async Task SetNormalizedEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetNormalizedEmailAsync(user, _lookupNormalizer.NormalizeEmail("john.nash.kobe@abp.io")); + await _identityUserStore.SetNormalizedEmailAsync(user, _lookupNormalizer.NormalizeEmail("john.nash.kobe@abp.io")).ConfigureAwait(false); user.NormalizedEmail.ShouldBe(_lookupNormalizer.NormalizeEmail("john.nash.kobe@abp.io")); } @@ -452,7 +452,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByEmailAsync() { - var user = await _identityUserStore.FindByEmailAsync(_lookupNormalizer.NormalizeEmail("john.nash@abp.io")); + var user = await _identityUserStore.FindByEmailAsync(_lookupNormalizer.NormalizeEmail("john.nash@abp.io")).ConfigureAwait(false); user.ShouldNotBeNull(); user.Email.ShouldBe("john.nash@abp.io"); @@ -461,19 +461,19 @@ namespace Volo.Abp.Identity [Fact] public async Task GetLockoutEndDateAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetLockoutEndDateAsync(user)).ShouldBe(user.LockoutEnd); + (await _identityUserStore.GetLockoutEndDateAsync(user).ConfigureAwait(false)).ShouldBe(user.LockoutEnd); } [Fact] public async Task SetLockoutEndDateAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetLockoutEndDateAsync(user, DateTimeOffset.Parse("01/01/2019")); + await _identityUserStore.SetLockoutEndDateAsync(user, DateTimeOffset.Parse("01/01/2019")).ConfigureAwait(false); user.LockoutEnd.ShouldBe(DateTimeOffset.Parse("01/01/2019")); } @@ -482,11 +482,11 @@ namespace Volo.Abp.Identity [Fact] public async Task IncrementAccessFailedCountAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); var count = user.AccessFailedCount; - await _identityUserStore.IncrementAccessFailedCountAsync(user); + await _identityUserStore.IncrementAccessFailedCountAsync(user).ConfigureAwait(false); user.AccessFailedCount.ShouldBe(count + 1); } @@ -494,10 +494,10 @@ namespace Volo.Abp.Identity [Fact] public async Task ResetAccessFailedCountAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.ResetAccessFailedCountAsync(user); + await _identityUserStore.ResetAccessFailedCountAsync(user).ConfigureAwait(false); user.AccessFailedCount.ShouldBe(0); } @@ -505,29 +505,29 @@ namespace Volo.Abp.Identity [Fact] public async Task GetAccessFailedCountAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetAccessFailedCountAsync(user)).ShouldBe(user.AccessFailedCount); + (await _identityUserStore.GetAccessFailedCountAsync(user).ConfigureAwait(false)).ShouldBe(user.AccessFailedCount); } [Fact] public async Task GetLockoutEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetLockoutEnabledAsync(user)).ShouldBe(user.LockoutEnabled); + (await _identityUserStore.GetLockoutEnabledAsync(user).ConfigureAwait(false)).ShouldBe(user.LockoutEnabled); } [Fact] public async Task SetLockoutEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); var lockoutEnabled = user.LockoutEnabled; - await _identityUserStore.SetLockoutEnabledAsync(user, !lockoutEnabled); + await _identityUserStore.SetLockoutEnabledAsync(user, !lockoutEnabled).ConfigureAwait(false); user.LockoutEnabled.ShouldBe(!lockoutEnabled); } @@ -536,10 +536,10 @@ namespace Volo.Abp.Identity [Fact] public async Task SetPhoneNumberAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetPhoneNumberAsync(user, "13800138000"); + await _identityUserStore.SetPhoneNumberAsync(user, "13800138000").ConfigureAwait(false); user.PhoneNumber.ShouldBe("13800138000"); } @@ -548,30 +548,30 @@ namespace Volo.Abp.Identity [Fact] public async Task GetPhoneNumberAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetPhoneNumberAsync(user)).ShouldBe(user.PhoneNumber); + (await _identityUserStore.GetPhoneNumberAsync(user).ConfigureAwait(false)).ShouldBe(user.PhoneNumber); } [Fact] public async Task GetPhoneNumberConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetPhoneNumberConfirmedAsync(user)).ShouldBe(user.PhoneNumberConfirmed); + (await _identityUserStore.GetPhoneNumberConfirmedAsync(user).ConfigureAwait(false)).ShouldBe(user.PhoneNumberConfirmed); } [Fact] public async Task SetPhoneNumberConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); var phoneNumberConfirmed = user.PhoneNumberConfirmed; - await _identityUserStore.SetPhoneNumberConfirmedAsync(user, !phoneNumberConfirmed); + await _identityUserStore.SetPhoneNumberConfirmedAsync(user, !phoneNumberConfirmed).ConfigureAwait(false); user.PhoneNumberConfirmed.ShouldBe(!phoneNumberConfirmed); } @@ -580,11 +580,11 @@ namespace Volo.Abp.Identity [Fact] public async Task SetSecurityStampAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); var securityStamp = Guid.NewGuid().ToString(); - await _identityUserStore.SetSecurityStampAsync(user, securityStamp); + await _identityUserStore.SetSecurityStampAsync(user, securityStamp).ConfigureAwait(false); user.SecurityStamp.ShouldBe(securityStamp); } @@ -592,21 +592,21 @@ namespace Volo.Abp.Identity [Fact] public async Task GetSecurityStampAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetSecurityStampAsync(user)).ShouldBe(user.SecurityStamp); + (await _identityUserStore.GetSecurityStampAsync(user).ConfigureAwait(false)).ShouldBe(user.SecurityStamp); } [Fact] public async Task SetTwoFactorEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); var twoFactorEnabled = user.TwoFactorEnabled; - await _identityUserStore.SetTwoFactorEnabledAsync(user, !twoFactorEnabled); + await _identityUserStore.SetTwoFactorEnabledAsync(user, !twoFactorEnabled).ConfigureAwait(false); user.TwoFactorEnabled.ShouldBe(!twoFactorEnabled); } @@ -615,16 +615,16 @@ namespace Volo.Abp.Identity [Fact] public async Task GetTwoFactorEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetTwoFactorEnabledAsync(user)).ShouldBe(user.TwoFactorEnabled); + (await _identityUserStore.GetTwoFactorEnabledAsync(user).ConfigureAwait(false)).ShouldBe(user.TwoFactorEnabled); } [Fact] public async Task GetUsersForClaimAsync() { - var user = await _identityUserStore.GetUsersForClaimAsync(new Claim("TestClaimType", "42")); + var user = await _identityUserStore.GetUsersForClaimAsync(new Claim("TestClaimType", "42")).ConfigureAwait(false); user.ShouldNotBeNull(); user.ShouldNotBeEmpty(); user.ShouldContain(x => x.UserName == "john.nash"); @@ -633,7 +633,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetUsersInRoleAsync() { - var user = await _identityUserStore.GetUsersInRoleAsync(_lookupNormalizer.NormalizeName("moderator")); + var user = await _identityUserStore.GetUsersInRoleAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); user.ShouldNotBeNull(); user.ShouldContain(x => x.UserName == "john.nash"); } @@ -643,15 +643,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetTokenAsync(user, "test-provider", "test-name", "123123"); + await _identityUserStore.SetTokenAsync(user, "test-provider", "test-name", "123123").ConfigureAwait(false); user.Tokens.ShouldNotBeEmpty(); user.Tokens.ShouldContain(x => x.LoginProvider == "test-provider" && x.Name == "test-name" && x.Value == "123123"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -660,14 +660,14 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.RemoveTokenAsync(user, "test-provider", "test-name"); + await _identityUserStore.RemoveTokenAsync(user, "test-provider", "test-name").ConfigureAwait(false); user.Tokens.ShouldNotContain(x => x.LoginProvider == "test-provider" && x.Name == "test-name" && x.Value == "123123"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -676,12 +676,12 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - (await _identityUserStore.GetTokenAsync(user, "test-provider", "test-name")).ShouldBe("test-value"); + (await _identityUserStore.GetTokenAsync(user, "test-provider", "test-name").ConfigureAwait(false)).ShouldBe("test-value"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -690,14 +690,14 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey"); + await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey").ConfigureAwait(false); user.Tokens.ShouldContain(x => x.LoginProvider == "[AspNetUserStore]" && x.Name == "AuthenticatorKey" && x.Value == "testKey"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -706,13 +706,13 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey"); + await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey").ConfigureAwait(false); - (await _identityUserStore.GetAuthenticatorKeyAsync(user)).ShouldBe("testKey"); + (await _identityUserStore.GetAuthenticatorKeyAsync(user).ConfigureAwait(false)).ShouldBe("testKey"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -722,13 +722,13 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2"); + await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2").ConfigureAwait(false); - (await _identityUserStore.CountCodesAsync(user)).ShouldBe(2); + (await _identityUserStore.CountCodesAsync(user).ConfigureAwait(false)).ShouldBe(2); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -737,18 +737,18 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); await _identityUserStore.ReplaceCodesAsync(user, new List() { "testKey", "testKey2" - }); + }).ConfigureAwait(false); user.Tokens.ShouldContain(x => x.LoginProvider == "[AspNetUserStore]" && x.Name == "RecoveryCodes" && x.Value == "testKey;testKey2"); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -757,13 +757,13 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); user.ShouldNotBeNull(); - await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2"); + await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2").ConfigureAwait(false); - (await _identityUserStore.RedeemCodeAsync(user, "testKey")).ShouldBeTrue(); + (await _identityUserStore.RedeemCodeAsync(user, "testKey").ConfigureAwait(false)).ShouldBeTrue(); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/PermissionManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/PermissionManager_Tests.cs index 621cb4621f..a098ba92c6 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/PermissionManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/PermissionManager_Tests.cs @@ -24,19 +24,19 @@ namespace Volo.Abp.Identity public async Task Roles_Should_Have_Configured_Permissions() { //admin - var grantInfos = await _permissionManager.GetAllForRoleAsync("admin"); + var grantInfos = await _permissionManager.GetAllForRoleAsync("admin").ConfigureAwait(false); RoleShouldHavePermission(grantInfos, "admin", TestPermissionNames.MyPermission1); RoleShouldHavePermission(grantInfos, "admin", TestPermissionNames.MyPermission2); RoleShouldHavePermission(grantInfos, "admin", TestPermissionNames.MyPermission2_ChildPermission1); //moderator - grantInfos = await _permissionManager.GetAllForRoleAsync("moderator"); + grantInfos = await _permissionManager.GetAllForRoleAsync("moderator").ConfigureAwait(false); RoleShouldHavePermission(grantInfos, "moderator", TestPermissionNames.MyPermission1); RoleShouldHavePermission(grantInfos, "moderator", TestPermissionNames.MyPermission2); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2_ChildPermission1); //supporter - grantInfos = await _permissionManager.GetAllForRoleAsync("supporter"); + grantInfos = await _permissionManager.GetAllForRoleAsync("supporter").ConfigureAwait(false); RoleShouldHavePermission(grantInfos, "supporter", TestPermissionNames.MyPermission1); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2_ChildPermission1); @@ -45,21 +45,21 @@ namespace Volo.Abp.Identity [Fact] public async Task Should_Grant_Permission_To_Role() { - (await _permissionManager.GetForRoleAsync("supporter", TestPermissionNames.MyPermission2)).IsGranted.ShouldBeFalse(); - (await _permissionStore.IsGrantedAsync(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "supporter")).ShouldBeFalse(); + (await _permissionManager.GetForRoleAsync("supporter", TestPermissionNames.MyPermission2).ConfigureAwait(false)).IsGranted.ShouldBeFalse(); + (await _permissionStore.IsGrantedAsync(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "supporter").ConfigureAwait(false)).ShouldBeFalse(); - await _permissionManager.SetForRoleAsync("supporter", TestPermissionNames.MyPermission2, true); + await _permissionManager.SetForRoleAsync("supporter", TestPermissionNames.MyPermission2, true).ConfigureAwait(false); - (await _permissionManager.GetForRoleAsync("supporter", TestPermissionNames.MyPermission2)).IsGranted.ShouldBeTrue(); - (await _permissionStore.IsGrantedAsync(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "supporter")).ShouldBeTrue(); + (await _permissionManager.GetForRoleAsync("supporter", TestPermissionNames.MyPermission2).ConfigureAwait(false)).IsGranted.ShouldBeTrue(); + (await _permissionStore.IsGrantedAsync(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "supporter").ConfigureAwait(false)).ShouldBeTrue(); } [Fact] public async Task Should_Revoke_Permission_From_Role() { - (await _permissionManager.GetForRoleAsync("moderator", TestPermissionNames.MyPermission1)).IsGranted.ShouldBeTrue(); - await _permissionManager.SetForRoleAsync("moderator", TestPermissionNames.MyPermission1, false); - (await _permissionManager.GetForRoleAsync("moderator", TestPermissionNames.MyPermission1)).IsGranted.ShouldBeFalse(); + (await _permissionManager.GetForRoleAsync("moderator", TestPermissionNames.MyPermission1).ConfigureAwait(false)).IsGranted.ShouldBeTrue(); + await _permissionManager.SetForRoleAsync("moderator", TestPermissionNames.MyPermission1, false).ConfigureAwait(false); + (await _permissionManager.GetForRoleAsync("moderator", TestPermissionNames.MyPermission1).ConfigureAwait(false)).IsGranted.ShouldBeFalse(); } [Fact] @@ -67,21 +67,21 @@ namespace Volo.Abp.Identity { //administrator var user = GetUser("administrator"); - var grantInfos = await _permissionManager.GetAllForUserAsync(user.Id); + var grantInfos = await _permissionManager.GetAllForUserAsync(user.Id).ConfigureAwait(false); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission1, "admin"); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission2, "admin"); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission2_ChildPermission1, "admin"); //john.nash user = GetUser("john.nash"); - grantInfos = await _permissionManager.GetAllForUserAsync(user.Id); + grantInfos = await _permissionManager.GetAllForUserAsync(user.Id).ConfigureAwait(false); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission1, "moderator", "supporter"); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission2, "moderator"); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2_ChildPermission1); //john.nash user = GetUser("david"); - grantInfos = await _permissionManager.GetAllForUserAsync(user.Id); + grantInfos = await _permissionManager.GetAllForUserAsync(user.Id).ConfigureAwait(false); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission1); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2_ChildPermission1); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs index ad94e914b5..c53592d567 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs @@ -29,26 +29,26 @@ namespace Volo.Abp.Identity public async Task Build() { - await AddRolePermissions(); - await AddUserPermissions(); + await AddRolePermissions().ConfigureAwait(false); + await AddUserPermissions().ConfigureAwait(false); } private async Task AddRolePermissions() { - await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "admin"); - await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "admin"); - await AddPermission(TestPermissionNames.MyPermission2_ChildPermission1, RolePermissionValueProvider.ProviderName, "admin"); + await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "admin").ConfigureAwait(false); + await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "admin").ConfigureAwait(false); + await AddPermission(TestPermissionNames.MyPermission2_ChildPermission1, RolePermissionValueProvider.ProviderName, "admin").ConfigureAwait(false); - await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "moderator"); - await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "moderator"); + await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "moderator").ConfigureAwait(false); + await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "moderator").ConfigureAwait(false); - await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "supporter"); + await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "supporter").ConfigureAwait(false); } private async Task AddUserPermissions() { var david = AsyncHelper.RunSync(() => _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("david"))); - await AddPermission(TestPermissionNames.MyPermission1, UserPermissionValueProvider.ProviderName, david.Id.ToString()); + await AddPermission(TestPermissionNames.MyPermission1, UserPermissionValueProvider.ProviderName, david.Id.ToString()).ConfigureAwait(false); } private async Task AddPermission(string permissionName, string providerName, string providerKey) @@ -60,7 +60,7 @@ namespace Volo.Abp.Identity providerName, providerKey ) - ); + ).ConfigureAwait(false); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs index ef06949500..a8f2159fc2 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetRolesAsync() { - var roleNames = await _userRoleFinder.GetRolesAsync(_testData.UserJohnId); + var roleNames = await _userRoleFinder.GetRolesAsync(_testData.UserJohnId).ConfigureAwait(false); roleNames.ShouldNotBeEmpty(); roleNames.ShouldContain(x => x == "moderator"); roleNames.ShouldContain(x => x == "supporter"); diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBase.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBase.cs index b603612525..ac75b16b02 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBase.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBase.cs @@ -1,4 +1,5 @@ using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace Volo.Abp.Identity { diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBaseModule.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBaseModule.cs index 4b956ab16d..0c8c545b8c 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBaseModule.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBaseModule.cs @@ -32,10 +32,10 @@ namespace Volo.Abp.Identity var dataSeeder = scope.ServiceProvider.GetRequiredService(); AsyncHelper.RunSync(async () => { - await dataSeeder.SeedAsync(); + await dataSeeder.SeedAsync().ConfigureAwait(false); await scope.ServiceProvider .GetRequiredService() - .Build(); + .Build().ConfigureAwait(false); }); } } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs index 69361ff5a8..ad36fe69a7 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs @@ -37,21 +37,21 @@ namespace Volo.Abp.Identity public async Task Build() { - await AddRoles(); - await AddUsers(); - await AddClaimTypes(); + await AddRoles().ConfigureAwait(false); + await AddUsers().ConfigureAwait(false); + await AddClaimTypes().ConfigureAwait(false); } private async Task AddRoles() { - _adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")); + _adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false); _moderator = new IdentityRole(_testData.RoleModeratorId, "moderator"); _moderator.AddClaim(_guidGenerator, new Claim("test-claim", "test-value")); - await _roleRepository.InsertAsync(_moderator); + await _roleRepository.InsertAsync(_moderator).ConfigureAwait(false); _supporterRole = new IdentityRole(_guidGenerator.Create(), "supporter"); - await _roleRepository.InsertAsync(_supporterRole); + await _roleRepository.InsertAsync(_supporterRole).ConfigureAwait(false); } private async Task AddUsers() @@ -59,7 +59,7 @@ namespace Volo.Abp.Identity var adminUser = new IdentityUser(_guidGenerator.Create(), "administrator", "admin@abp.io"); adminUser.AddRole(_adminRole.Id); adminUser.AddClaim(_guidGenerator, new Claim("TestClaimType", "42")); - await _userRepository.InsertAsync(adminUser); + await _userRepository.InsertAsync(adminUser).ConfigureAwait(false); var john = new IdentityUser(_testData.UserJohnId, "john.nash", "john.nash@abp.io"); john.AddRole(_moderator.Id); @@ -68,23 +68,23 @@ namespace Volo.Abp.Identity john.AddLogin(new UserLoginInfo("twitter", "johnx", "John Nash")); john.AddClaim(_guidGenerator, new Claim("TestClaimType", "42")); john.SetToken("test-provider", "test-name", "test-value"); - await _userRepository.InsertAsync(john); + await _userRepository.InsertAsync(john).ConfigureAwait(false); var david = new IdentityUser(_testData.UserDavidId, "david", "david@abp.io"); - await _userRepository.InsertAsync(david); + await _userRepository.InsertAsync(david).ConfigureAwait(false); var neo = new IdentityUser(_testData.UserNeoId, "neo", "neo@abp.io"); neo.AddRole(_supporterRole.Id); neo.AddClaim(_guidGenerator, new Claim("TestClaimType", "43")); - await _userRepository.InsertAsync(neo); + await _userRepository.InsertAsync(neo).ConfigureAwait(false); } private async Task AddClaimTypes() { var ageClaim = new IdentityClaimType(_testData.AgeClaimId, "Age", false, false, null, null, null,IdentityClaimValueType.Int); - await _identityClaimTypeRepository.InsertAsync(ageClaim); + await _identityClaimTypeRepository.InsertAsync(ageClaim).ConfigureAwait(false); var educationClaim = new IdentityClaimType(_testData.EducationClaimId, "Education", true, false, null, null, null); - await _identityClaimTypeRepository.InsertAsync(educationClaim); + await _identityClaimTypeRepository.InsertAsync(educationClaim).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs index 3250c0b04a..afe117d421 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs @@ -28,11 +28,11 @@ namespace Volo.Abp.Identity { var claim = (await ClaimTypeRepository.GetListAsync()).FirstOrDefault(); - var result1 = await ClaimTypeRepository.AnyAsync(claim.Name); + var result1 = await ClaimTypeRepository.AnyAsync(claim.Name).ConfigureAwait(false); result1.ShouldBe(true); - var result2 = await ClaimTypeRepository.AnyAsync(Guid.NewGuid().ToString()); + var result2 = await ClaimTypeRepository.AnyAsync(Guid.NewGuid().ToString()).ConfigureAwait(false); result2.ShouldBe(false); } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs index 65eac5bc9d..0b6692f419 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs @@ -25,11 +25,11 @@ namespace Volo.Abp.Identity [Fact] public async Task Should_Create_Admin_User_And_Role() { - await _identityDataSeeder.SeedAsync("admin@abp.io", "1q2w3E*"); + await _identityDataSeeder.SeedAsync("admin@abp.io", "1q2w3E*").ConfigureAwait(false); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull(); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin"))).Name.ShouldBe("admin"); - (await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull(); + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false)).ShouldNotBeNull(); + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false)).Name.ShouldBe("admin"); + (await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false)).ShouldNotBeNull(); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs index e4a15d15f1..cd7ee1eb32 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs @@ -23,14 +23,14 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNormalizedNameAsync() { - (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull(); - (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("undefined-role"))).ShouldBeNull(); + (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("admin")).ConfigureAwait(false)).ShouldNotBeNull(); + (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("undefined-role")).ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task GetListAsync() { - var roles = await RoleRepository.GetListAsync(); + var roles = await RoleRepository.GetListAsync().ConfigureAwait(false); roles.ShouldContain(r => r.Name == "admin"); roles.ShouldContain(r => r.Name == "moderator"); roles.ShouldContain(r => r.Name == "supporter"); @@ -39,13 +39,13 @@ namespace Volo.Abp.Identity [Fact] public async Task GetCountAsync() { - (await RoleRepository.GetCountAsync()).ShouldBeGreaterThan(0); + (await RoleRepository.GetCountAsync().ConfigureAwait(false)).ShouldBeGreaterThan(0); } [Fact] public async Task Should_Eager_Load_Role_Collections() { - var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator")); + var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); role.Claims.ShouldNotBeNull(); role.Claims.Any().ShouldBeTrue(); } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs index 4fa407a512..98f25f6aee 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs @@ -25,23 +25,23 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNormalizedUserNameAsync() { - (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash"))).ShouldNotBeNull(); - (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("undefined-user"))).ShouldBeNull(); + (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false)).ShouldNotBeNull(); + (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("undefined-user")).ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task FindByNormalizedEmailAsync() { - (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("john.nash@abp.io"))).ShouldNotBeNull(); - (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("david@abp.io"))).ShouldNotBeNull(); - (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("undefined-user@abp.io"))).ShouldBeNull(); + (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("john.nash@abp.io")).ConfigureAwait(false)).ShouldNotBeNull(); + (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("david@abp.io")).ConfigureAwait(false)).ShouldNotBeNull(); + (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("undefined-user@abp.io")).ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task GetRoleNamesAsync() { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")); - var roles = await UserRepository.GetRoleNamesAsync(john.Id); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var roles = await UserRepository.GetRoleNamesAsync(john.Id).ConfigureAwait(false); roles.Count.ShouldBe(2); roles.ShouldContain("moderator"); roles.ShouldContain("supporter"); @@ -50,37 +50,37 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByLoginAsync() { - var user = await UserRepository.FindByLoginAsync("github", "john"); + var user = await UserRepository.FindByLoginAsync("github", "john").ConfigureAwait(false); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); - user = await UserRepository.FindByLoginAsync("twitter", "johnx"); + user = await UserRepository.FindByLoginAsync("twitter", "johnx").ConfigureAwait(false); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); - (await UserRepository.FindByLoginAsync("github", "undefinedid")).ShouldBeNull(); + (await UserRepository.FindByLoginAsync("github", "undefinedid").ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task GetListByClaimAsync() { - var users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "42")); + var users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "42")).ConfigureAwait(false); users.Count.ShouldBe(2); users.ShouldContain(u => u.UserName == "administrator"); users.ShouldContain(u => u.UserName == "john.nash"); - users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "43")); + users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "43")).ConfigureAwait(false); users.Count.ShouldBe(1); users.ShouldContain(u => u.UserName == "neo"); - users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "undefined")); + users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "undefined")).ConfigureAwait(false); users.Count.ShouldBe(0); } [Fact] public async Task GetListByNormalizedRoleNameAsync() { - var users = await UserRepository.GetListByNormalizedRoleNameAsync(LookupNormalizer.NormalizeName("supporter")); + var users = await UserRepository.GetListByNormalizedRoleNameAsync(LookupNormalizer.NormalizeName("supporter")).ConfigureAwait(false); users.Count.ShouldBe(2); users.ShouldContain(u => u.UserName == "john.nash"); users.ShouldContain(u => u.UserName == "neo"); @@ -89,7 +89,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetListAsync() { - var users = await UserRepository.GetListAsync("UserName DESC", 5, 0, "n"); + var users = await UserRepository.GetListAsync("UserName DESC", 5, 0, "n").ConfigureAwait(false); users.Count.ShouldBeGreaterThan(1); users.Count.ShouldBeLessThanOrEqualTo(5); @@ -107,15 +107,15 @@ namespace Volo.Abp.Identity ).ShouldBeGreaterThan(0); } - users = await UserRepository.GetListAsync(null, 999, 0, "undefined-username"); + users = await UserRepository.GetListAsync(null, 999, 0, "undefined-username").ConfigureAwait(false); users.Count.ShouldBe(0); } [Fact] public async Task GetRolesAsync() { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")); - var roles = await UserRepository.GetRolesAsync(john.Id); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var roles = await UserRepository.GetRolesAsync(john.Id).ConfigureAwait(false); roles.Count.ShouldBe(2); roles.ShouldContain(r => r.Name == "moderator"); roles.ShouldContain(r => r.Name == "supporter"); @@ -124,14 +124,14 @@ namespace Volo.Abp.Identity [Fact] public async Task GetCountAsync() { - (await UserRepository.GetCountAsync("n")).ShouldBeGreaterThan(1); - (await UserRepository.GetCountAsync("undefined-username")).ShouldBe(0); + (await UserRepository.GetCountAsync("n").ConfigureAwait(false)).ShouldBeGreaterThan(1); + (await UserRepository.GetCountAsync("undefined-username").ConfigureAwait(false)).ShouldBe(0); } [Fact] public async Task Should_Eager_Load_User_Collections() { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); john.Roles.ShouldNotBeNull(); john.Roles.Any().ShouldBeTrue(); diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs index 1ae671dd4f..3313803436 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs @@ -28,11 +28,11 @@ namespace Volo.Abp.Identity { using (var uow = GetRequiredService().Begin()) { - var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator"), includeDetails: false); + var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator"), includeDetails: false).ConfigureAwait(false); role.Claims.ShouldNotBeNull(); role.Claims.Any().ShouldBeTrue(); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } @@ -41,7 +41,7 @@ namespace Volo.Abp.Identity { using (var uow = GetRequiredService().Begin()) { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash"), includeDetails: false); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash"), includeDetails: false).ConfigureAwait(false); john.Roles.ShouldNotBeNull(); john.Roles.Any().ShouldBeTrue(); @@ -55,7 +55,7 @@ namespace Volo.Abp.Identity john.Tokens.ShouldNotBeNull(); john.Tokens.Any().ShouldBeTrue(); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo.Abp.IdentityServer.Domain.Shared.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo.Abp.IdentityServer.Domain.Shared.csproj index bcd99cd524..71d99b826b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo.Abp.IdentityServer.Domain.Shared.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo.Abp.IdentityServer.Domain.Shared.csproj @@ -22,7 +22,7 @@ - + diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/AbpIdentityServerDomainSharedModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/AbpIdentityServerDomainSharedModule.cs index 983ffcb071..d56968ba5d 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/AbpIdentityServerDomainSharedModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/AbpIdentityServerDomainSharedModule.cs @@ -1,14 +1,15 @@ using Volo.Abp.IdentityServer.Localization; using Volo.Abp.Localization; using Volo.Abp.Localization.ExceptionHandling; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.IdentityServer { [DependsOn( - typeof(AbpLocalizationModule) + typeof(AbpValidationModule) )] public class AbpIdentityServerDomainSharedModule : AbpModule { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj index 70d0fbcba7..e7f4a6bc43 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj @@ -20,6 +20,7 @@ + diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpCorsPolicyService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpCorsPolicyService.cs index 9113051a4a..c445b7e90e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpCorsPolicyService.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpCorsPolicyService.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.IdentityServer public async Task IsOriginAllowedAsync(string origin) { - var cacheItem = await Cache.GetOrAddAsync(AllowedCorsOriginsCacheItem.AllOrigins, CreateCacheItemAsync); + var cacheItem = await Cache.GetOrAddAsync(AllowedCorsOriginsCacheItem.AllOrigins, CreateCacheItemAsync).ConfigureAwait(false); var isAllowed = cacheItem.AllowedOrigins.Contains(origin, StringComparer.OrdinalIgnoreCase); @@ -49,7 +49,7 @@ namespace Volo.Abp.IdentityServer return new AllowedCorsOriginsCacheItem { - AllowedOrigins = (await clientRepository.GetAllDistinctAllowedCorsOriginsAsync()).ToArray() + AllowedOrigins = (await clientRepository.GetAllDistinctAllowedCorsOriginsAsync().ConfigureAwait(false)).ToArray() }; } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index c89e7e74d2..0ff798e7fd 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -1,11 +1,13 @@ -using System.Security.Cryptography.X509Certificates; -using IdentityServer4.Services; +using IdentityServer4.Services; using IdentityServer4.Stores; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Options; using Volo.Abp.AutoMapper; +using Volo.Abp.BackgroundWorkers; using Volo.Abp.Caching; using Volo.Abp.Identity; -using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Tokens; using Volo.Abp.Modularity; using Volo.Abp.Security; using Volo.Abp.Validation; @@ -18,7 +20,8 @@ namespace Volo.Abp.IdentityServer typeof(AbpIdentityDomainModule), typeof(AbpSecurityModule), typeof(AbpCachingModule), - typeof(AbpValidationModule) + typeof(AbpValidationModule), + typeof(AbpBackgroundWorkersModule) )] public class AbpIdentityServerDomainModule : AbpModule { @@ -28,12 +31,12 @@ namespace Volo.Abp.IdentityServer Configure(options => { - options.AddProfile(validate: true); + options.AddProfile(validate: true); }); AddIdentityServer(context.Services); } - + private static void AddIdentityServer(IServiceCollection services) { var configuration = services.GetConfiguration(); @@ -58,7 +61,12 @@ namespace Volo.Abp.IdentityServer if (!services.IsAdded()) { - identityServerBuilder.AddInMemoryPersistedGrants(); + services.TryAddSingleton(); + } + + if (!services.IsAdded()) + { + services.TryAddSingleton(); } if (!services.IsAdded()) @@ -72,5 +80,19 @@ namespace Volo.Abp.IdentityServer identityServerBuilder.AddInMemoryIdentityResources(configuration.GetSection("IdentityServer:IdentityResources")); } } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + var options = context.ServiceProvider.GetRequiredService>().Value; + if (options.IsCleanupEnabled) + { + context.ServiceProvider + .GetRequiredService() + .Add( + context.ServiceProvider + .GetRequiredService() + ); + } + } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedCorsOriginsCacheItemInvalidator.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedCorsOriginsCacheItemInvalidator.cs index 80bc425d5c..0a05e1781e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedCorsOriginsCacheItemInvalidator.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedCorsOriginsCacheItemInvalidator.cs @@ -21,12 +21,12 @@ namespace Volo.Abp.IdentityServer public async Task HandleEventAsync(EntityChangedEventData eventData) { - await Cache.RemoveAsync(AllowedCorsOriginsCacheItem.AllOrigins); + await Cache.RemoveAsync(AllowedCorsOriginsCacheItem.AllOrigins).ConfigureAwait(false); } public async Task HandleEventAsync(EntityChangedEventData eventData) { - await Cache.RemoveAsync(AllowedCorsOriginsCacheItem.AllOrigins); + await Cache.RemoveAsync(AllowedCorsOriginsCacheItem.AllOrigins).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs index f3bca6dba9..93a1fb5bbe 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity { using (_currentTenant.Change(context.Subject.FindTenantId())) { - await base.GetProfileDataAsync(context); + await base.GetProfileDataAsync(context).ConfigureAwait(false); } } @@ -37,7 +37,7 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity { using (_currentTenant.Change(context.Subject.FindTenantId())) { - await base.IsActiveAsync(context); + await base.IsActiveAsync(context).ConfigureAwait(false); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs index f427d9edf1..c7d9000cd2 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs @@ -43,22 +43,22 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity [UnitOfWork] public virtual async Task ValidateAsync(ResourceOwnerPasswordValidationContext context) { - await ReplaceEmailToUsernameOfInputIfNeeds(context); + await ReplaceEmailToUsernameOfInputIfNeeds(context).ConfigureAwait(false); - var user = await _userManager.FindByNameAsync(context.UserName); + var user = await _userManager.FindByNameAsync(context.UserName).ConfigureAwait(false); if (user != null) { - var result = await _signInManager.CheckPasswordSignInAsync(user, context.Password, true); + var result = await _signInManager.CheckPasswordSignInAsync(user, context.Password, true).ConfigureAwait(false); if (result.Succeeded) { - var sub = await _userManager.GetUserIdAsync(user); + var sub = await _userManager.GetUserIdAsync(user).ConfigureAwait(false); _logger.LogInformation("Credentials validated for username: {username}", context.UserName); - await _events.RaiseAsync(new UserLoginSuccessEvent(context.UserName, sub, context.UserName, interactive: false)); + await _events.RaiseAsync(new UserLoginSuccessEvent(context.UserName, sub, context.UserName, interactive: false)).ConfigureAwait(false); var additionalClaims = new List(); - await AddCustomClaimsAsync(additionalClaims, user, context); + await AddCustomClaimsAsync(additionalClaims, user, context).ConfigureAwait(false); context.Result = new GrantValidationResult( sub, @@ -71,23 +71,23 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity else if (result.IsLockedOut) { _logger.LogInformation("Authentication failed for username: {username}, reason: locked out", context.UserName); - await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "locked out", interactive: false)); + await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "locked out", interactive: false)).ConfigureAwait(false); } else if (result.IsNotAllowed) { _logger.LogInformation("Authentication failed for username: {username}, reason: not allowed", context.UserName); - await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "not allowed", interactive: false)); + await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "not allowed", interactive: false)).ConfigureAwait(false); } else { _logger.LogInformation("Authentication failed for username: {username}, reason: invalid credentials", context.UserName); - await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid credentials", interactive: false)); + await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid credentials", interactive: false)).ConfigureAwait(false); } } else { _logger.LogInformation("No user found matching username: {username}", context.UserName); - await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid username", interactive: false)); + await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid username", interactive: false)).ConfigureAwait(false); } context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant); @@ -100,13 +100,13 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity return; } - var userByUsername = await _userManager.FindByNameAsync(context.UserName); + var userByUsername = await _userManager.FindByNameAsync(context.UserName).ConfigureAwait(false); if (userByUsername != null) { return; } - var userByEmail = await _userManager.FindByEmailAsync(context.UserName); + var userByEmail = await _userManager.FindByEmailAsync(context.UserName).ConfigureAwait(false); if (userByEmail == null) { return; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs index 031aa86bfc..b7a53ad66f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs @@ -108,10 +108,10 @@ namespace Volo.Abp.IdentityServer.Clients } public Client(Guid id, [NotNull] string clientId) + : base(id) { Check.NotNull(clientId, nameof(clientId)); - Id = id; ClientId = clientId; //TODO: Replace magics with constants? diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs index 0e88b658cd..8ba8aea7e3 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.IdentityServer.Clients public virtual async Task FindClientByIdAsync(string clientId) { - var client = await _clientRepository.FindByCliendIdAsync(clientId); + var client = await _clientRepository.FindByCliendIdAsync(clientId).ConfigureAwait(false); return _objectMapper.Map(client); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs new file mode 100644 index 0000000000..8814519cd4 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs @@ -0,0 +1,31 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; + +namespace Volo.Abp.IdentityServer.Devices +{ + public class DeviceFlowCodes : CreationAuditedAggregateRoot + { + public virtual string DeviceCode { get; set; } + + public virtual string UserCode { get; set; } + + public virtual string SubjectId { get; set; } + + public virtual string ClientId { get; set; } + + public virtual DateTime? Expiration { get; set; } + + public virtual string Data { get; set; } + + private DeviceFlowCodes() + { + + } + + public DeviceFlowCodes(Guid id) + : base(id) + { + + } + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowStore.cs new file mode 100644 index 0000000000..4bd55ab2c6 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowStore.cs @@ -0,0 +1,143 @@ +using System; +using System.Threading.Tasks; +using IdentityModel; +using IdentityServer4.Models; +using IdentityServer4.Stores; +using IdentityServer4.Stores.Serialization; +using JetBrains.Annotations; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace Volo.Abp.IdentityServer.Devices +{ + public class DeviceFlowStore : IDeviceFlowStore, ITransientDependency + { + protected IDeviceFlowCodesRepository DeviceFlowCodesRepository { get; } + protected IGuidGenerator GuidGenerator { get; } + protected IPersistentGrantSerializer PersistentGrantSerializer { get; } + + public DeviceFlowStore( + IDeviceFlowCodesRepository deviceFlowCodesRepository, + IGuidGenerator guidGenerator, + IPersistentGrantSerializer persistentGrantSerializer) + { + DeviceFlowCodesRepository = deviceFlowCodesRepository; + GuidGenerator = guidGenerator; + PersistentGrantSerializer = persistentGrantSerializer; + } + + public async Task StoreDeviceAuthorizationAsync(string deviceCode, string userCode, DeviceCode data) + { + Check.NotNull(deviceCode, nameof(deviceCode)); + Check.NotNull(userCode, nameof(userCode)); + Check.NotNull(data, nameof(data)); + + await DeviceFlowCodesRepository + .InsertAsync( + new DeviceFlowCodes(GuidGenerator.Create()) + { + DeviceCode = deviceCode, + UserCode = userCode, + ClientId = data.ClientId, + SubjectId = data.Subject?.FindFirst(JwtClaimTypes.Subject).Value, + CreationTime = data.CreationTime, + Expiration = data.CreationTime.AddSeconds(data.Lifetime), + Data = Serialize(data) + } + ).ConfigureAwait(false); + } + + public async Task FindByUserCodeAsync(string userCode) + { + Check.NotNull(userCode, nameof(userCode)); + + var deviceCodes = await DeviceFlowCodesRepository + .FindByUserCodeAsync(userCode) + .ConfigureAwait(false); + + if (deviceCodes == null) + { + return null; + } + + return DeserializeToDeviceCode(deviceCodes.Data); + } + + public async Task FindByDeviceCodeAsync(string deviceCode) + { + Check.NotNull(deviceCode, nameof(deviceCode)); + + var deviceCodes = await DeviceFlowCodesRepository + .FindByDeviceCodeAsync(deviceCode) + .ConfigureAwait(false); + + if (deviceCodes == null) + { + return null; + } + + return DeserializeToDeviceCode(deviceCodes.Data); + } + + public async Task UpdateByUserCodeAsync(string userCode, DeviceCode data) + { + Check.NotNull(userCode, nameof(userCode)); + Check.NotNull(data, nameof(data)); + + + var deviceCodes = await DeviceFlowCodesRepository + .FindByUserCodeAsync(userCode) + .ConfigureAwait(false); + + if (deviceCodes == null) + { + throw new InvalidOperationException($"Could not update device code by the given userCode: {userCode}"); + } + + deviceCodes.SubjectId = data.Subject?.FindFirst(JwtClaimTypes.Subject).Value; + deviceCodes.Data = Serialize(data); + + await DeviceFlowCodesRepository + .UpdateAsync(deviceCodes, autoSave: true) + .ConfigureAwait(false); + } + + public async Task RemoveByDeviceCodeAsync(string deviceCode) + { + Check.NotNull(deviceCode, nameof(deviceCode)); + + var deviceCodes = await DeviceFlowCodesRepository + .FindByDeviceCodeAsync(deviceCode) + .ConfigureAwait(false); + + if (deviceCodes == null) + { + return; + } + + await DeviceFlowCodesRepository + .DeleteAsync(deviceCodes, autoSave: true) + .ConfigureAwait(false); + } + + private string Serialize([CanBeNull] DeviceCode deviceCode) + { + if (deviceCode == null) + { + return null; + } + + return PersistentGrantSerializer.Serialize(deviceCode); + } + + protected virtual DeviceCode DeserializeToDeviceCode([CanBeNull] string data) + { + if (data == null) + { + return null; + } + + return PersistentGrantSerializer.Deserialize(data); + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/IDeviceFlowCodesRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/IDeviceFlowCodesRepository.cs new file mode 100644 index 0000000000..b6bcb69bed --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/IDeviceFlowCodesRepository.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace Volo.Abp.IdentityServer.Devices +{ + public interface IDeviceFlowCodesRepository : IBasicRepository + { + Task FindByUserCodeAsync( + string userCode, + CancellationToken cancellationToken = default + ); + + Task FindByDeviceCodeAsync( + string deviceCode, + CancellationToken cancellationToken = default + ); + + Task> GetListByExpirationAsync( + DateTime maxExpirationDate, + int maxResultCount, + CancellationToken cancellationToken = default + ); + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs index 6e316806b6..65cfabd7e7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs @@ -18,6 +18,12 @@ namespace Volo.Abp.IdentityServer.Grants CancellationToken cancellationToken = default ); + Task> GetListByExpirationAsync( + DateTime maxExpirationDate, + int maxResultCount, + CancellationToken cancellationToken = default + ); + Task DeleteAsync( string subjectId, string clientId, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs index 5ff3831e0e..9cf855e105 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs @@ -24,51 +24,51 @@ namespace Volo.Abp.IdentityServer.Grants public virtual async Task StoreAsync(IdentityServer4.Models.PersistedGrant grant) { - var entity = await _persistentGrantRepository.FindByKeyAsync(grant.Key); + var entity = await _persistentGrantRepository.FindByKeyAsync(grant.Key).ConfigureAwait(false); if (entity == null) { entity = _objectMapper.Map(grant); EntityHelper.TrySetId(entity, () => _guidGenerator.Create()); - await _persistentGrantRepository.InsertAsync(entity); + await _persistentGrantRepository.InsertAsync(entity).ConfigureAwait(false); } else { _objectMapper.Map(grant, entity); - await _persistentGrantRepository.UpdateAsync(entity); + await _persistentGrantRepository.UpdateAsync(entity).ConfigureAwait(false); } } public virtual async Task GetAsync(string key) { - var persistedGrant = await _persistentGrantRepository.FindByKeyAsync(key); + var persistedGrant = await _persistentGrantRepository.FindByKeyAsync(key).ConfigureAwait(false); return _objectMapper.Map(persistedGrant); } public virtual async Task> GetAllAsync(string subjectId) { - var persistedGrants = await _persistentGrantRepository.GetListBySubjectIdAsync(subjectId); + var persistedGrants = await _persistentGrantRepository.GetListBySubjectIdAsync(subjectId).ConfigureAwait(false); return persistedGrants.Select(x => _objectMapper.Map(x)); } public virtual async Task RemoveAsync(string key) { - var persistedGrant = await _persistentGrantRepository.FindByKeyAsync(key); + var persistedGrant = await _persistentGrantRepository.FindByKeyAsync(key).ConfigureAwait(false); if (persistedGrant == null) { return; } - await _persistentGrantRepository.DeleteAsync(persistedGrant); + await _persistentGrantRepository.DeleteAsync(persistedGrant).ConfigureAwait(false); } public virtual async Task RemoveAllAsync(string subjectId, string clientId) { - await _persistentGrantRepository.DeleteAsync(subjectId, clientId); + await _persistentGrantRepository.DeleteAsync(subjectId, clientId).ConfigureAwait(false); } public virtual async Task RemoveAllAsync(string subjectId, string clientId, string type) { - await _persistentGrantRepository.DeleteAsync(subjectId, clientId, type); + await _persistentGrantRepository.DeleteAsync(subjectId, clientId, type).ConfigureAwait(false); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs index 024f8bea13..8c828b970c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs @@ -37,16 +37,16 @@ namespace Volo.Abp.IdentityServer.IdentityResources { foreach (var claimType in resource.UserClaims) { - await AddClaimTypeIfNotExistsAsync(claimType); + await AddClaimTypeIfNotExistsAsync(claimType).ConfigureAwait(false); } - await AddIdentityResourceIfNotExistsAsync(resource); + await AddIdentityResourceIfNotExistsAsync(resource).ConfigureAwait(false); } } protected virtual async Task AddIdentityResourceIfNotExistsAsync(IdentityServer4.Models.IdentityResource resource) { - if (await IdentityResourceRepository.CheckNameExistAsync(resource.Name)) + if (await IdentityResourceRepository.CheckNameExistAsync(resource.Name).ConfigureAwait(false)) { return; } @@ -56,12 +56,12 @@ namespace Volo.Abp.IdentityServer.IdentityResources GuidGenerator.Create(), resource ) - ); + ).ConfigureAwait(false); } protected virtual async Task AddClaimTypeIfNotExistsAsync(string claimType) { - if (await ClaimTypeRepository.AnyAsync(claimType)) + if (await ClaimTypeRepository.AnyAsync(claimType).ConfigureAwait(false)) { return; } @@ -72,7 +72,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources claimType, isStatic: true ) - ); + ).ConfigureAwait(false); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientAutoMapperProfile.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs similarity index 94% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientAutoMapperProfile.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs index 81e5841d6b..ba1f44953c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientAutoMapperProfile.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs @@ -2,14 +2,15 @@ using System.Security.Claims; using AutoMapper; using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; -namespace Volo.Abp.IdentityServer.Clients +namespace Volo.Abp.IdentityServer { - public class ClientAutoMapperProfile : Profile + public class IdentityServerAutoMapperProfile : Profile { - public ClientAutoMapperProfile() + public IdentityServerAutoMapperProfile() { //TODO: Reverse maps will not used probably. Remove those will not used diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerBuilderExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerBuilderExtensions.cs index 2168b2067e..516d400db6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerBuilderExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerBuilderExtensions.cs @@ -1,6 +1,7 @@ using IdentityServer4.Stores; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; namespace Volo.Abp.IdentityServer @@ -10,6 +11,7 @@ namespace Volo.Abp.IdentityServer public static IIdentityServerBuilder AddAbpStores(this IIdentityServerBuilder builder) { builder.Services.AddTransient(); + builder.Services.AddTransient(); return builder .AddClientStore() diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Jwt/JwtTokenMiddleware.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Jwt/JwtTokenMiddleware.cs index 57ca9cc4c2..58d3205dc2 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Jwt/JwtTokenMiddleware.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Jwt/JwtTokenMiddleware.cs @@ -13,14 +13,14 @@ namespace Volo.Abp.IdentityServer.Jwt { 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) { ctx.User = result.Principal; } } - await next(); + await next().ConfigureAwait(false); }); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs index 56275bb386..0b8b5016a7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs @@ -29,26 +29,26 @@ namespace Volo.Abp.IdentityServer public virtual async Task> FindIdentityResourcesByScopeAsync(IEnumerable scopeNames) { - var resource = await _identityResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true); + var resource = await _identityResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true).ConfigureAwait(false); return _objectMapper.Map, List>(resource); } public virtual async Task> FindApiResourcesByScopeAsync(IEnumerable scopeNames) { - var resources = await _apiResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true); + var resources = await _apiResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true).ConfigureAwait(false); return resources.Select(x => _objectMapper.Map(x)); } public virtual async Task FindApiResourceAsync(string name) { - var resource = await _apiResourceRepository.FindByNameAsync(name); + var resource = await _apiResourceRepository.FindByNameAsync(name).ConfigureAwait(false); return _objectMapper.Map(resource); } public virtual async Task GetAllResourcesAsync() { - var identityResources = await _identityResourceRepository.GetListAsync(includeDetails: true); - var apiResources = await _apiResourceRepository.GetListAsync(includeDetails: true); + var identityResources = await _identityResourceRepository.GetListAsync(includeDetails: true).ConfigureAwait(false); + var apiResources = await _apiResourceRepository.GetListAsync(includeDetails: true).ConfigureAwait(false); return new Resources( _objectMapper.Map, IdentityServer4.Models.IdentityResource[]>(identityResources), diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupBackgroundWorker.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupBackgroundWorker.cs new file mode 100644 index 0000000000..4bec8318eb --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupBackgroundWorker.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Threading; + +namespace Volo.Abp.IdentityServer.Tokens +{ + public class TokenCleanupBackgroundWorker : AsyncPeriodicBackgroundWorkerBase + { + protected TokenCleanupOptions Options { get; } + + public TokenCleanupBackgroundWorker( + AbpTimer timer, + IServiceScopeFactory serviceScopeFactory, + IOptions options) + : base( + timer, + serviceScopeFactory) + { + Options = options.Value; + timer.Period = Options.CleanupPeriod; + } + + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + { + await workerContext + .ServiceProvider + .GetRequiredService() + .CleanAsync() + .ConfigureAwait(false); + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupOptions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupOptions.cs new file mode 100644 index 0000000000..816ef6af15 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupOptions.cs @@ -0,0 +1,34 @@ +using Volo.Abp.BackgroundWorkers; + +namespace Volo.Abp.IdentityServer.Tokens +{ + public class TokenCleanupOptions + { + /// + /// Default: 3,600,000 ms. + /// + public int CleanupPeriod { get; set; } = 3_600_000; + + /// + /// Default value: 100. + /// + public int CleanupBatchSize { get; set; } = 100; + + /// + /// The number of loop if there are + /// more than tokens in the database. + /// So, if is 10 and is 100, + /// then the cleanup worker will clean 1,000 items in one at max. + /// + /// Default value: 10. + /// + public int CleanupLoopCount { get; set; } = 10; + + /// + /// Default value: true. + /// If is false, + /// this property is ignored and the cleanup worker doesn't work for this application instance. + /// + public bool IsCleanupEnabled { get; set; } = true; + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupService.cs new file mode 100644 index 0000000000..ac38f792c1 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupService.cs @@ -0,0 +1,88 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; +using Volo.Abp.IdentityServer.Devices; +using Volo.Abp.IdentityServer.Grants; +using Volo.Abp.Timing; +using Volo.Abp.Uow; + +namespace Volo.Abp.IdentityServer.Tokens +{ + public class TokenCleanupService : ITransientDependency + { + protected IPersistentGrantRepository PersistentGrantRepository { get; } + protected IDeviceFlowCodesRepository DeviceFlowCodesRepository { get; } + protected IClock Clock { get; } + protected TokenCleanupOptions Options { get; } + + public TokenCleanupService( + IPersistentGrantRepository persistentGrantRepository, + IDeviceFlowCodesRepository deviceFlowCodesRepository, + IClock clock, + IOptions options) + { + PersistentGrantRepository = persistentGrantRepository; + DeviceFlowCodesRepository = deviceFlowCodesRepository; + Clock = clock; + Options = options.Value; + } + + public virtual async Task CleanAsync() + { + await RemoveGrantsAsync() + .ConfigureAwait(false); + + await RemoveDeviceCodesAsync() + .ConfigureAwait(false); + } + + [UnitOfWork] + protected virtual async Task RemoveGrantsAsync() + { + for (int i = 0; i < Options.CleanupLoopCount; i++) + { + var persistentGrants = await PersistentGrantRepository + .GetListByExpirationAsync(Clock.Now, Options.CleanupBatchSize) + .ConfigureAwait(false); + + //TODO: Can be optimized if the repository implements the batch deletion + foreach (var persistentGrant in persistentGrants) + { + await PersistentGrantRepository + .DeleteAsync(persistentGrant) + .ConfigureAwait(false); + } + + //No need to continue to query if it gets more than max items. + if (persistentGrants.Count < Options.CleanupBatchSize) + { + break; + } + } + } + + protected virtual async Task RemoveDeviceCodesAsync() + { + for (int i = 0; i < Options.CleanupLoopCount; i++) + { + var deviceFlowCodeses = await DeviceFlowCodesRepository + .GetListByExpirationAsync(Clock.Now, Options.CleanupBatchSize) + .ConfigureAwait(false); + + //TODO: Can be optimized if the repository implements the batch deletion + foreach (var deviceFlowCodes in deviceFlowCodeses) + { + await DeviceFlowCodesRepository + .DeleteAsync(deviceFlowCodes) + .ConfigureAwait(false); + } + + //No need to continue to query if it gets more than max items. + if (deviceFlowCodeses.Count < Options.CleanupBatchSize) + { + break; + } + } + } + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index 5f7d6369af..ec038afac6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.IdentityServer.ApiResources select apiResource; return await query - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListByScopesAsync( @@ -40,7 +40,7 @@ namespace Volo.Abp.IdentityServer.ApiResources where api.Scopes.Any(x => scopeNames.Contains(x.Name)) select api; - return await query.ToListAsync(GetCancellationToken(cancellationToken)); + return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false, @@ -49,7 +49,7 @@ namespace Volo.Abp.IdentityServer.ApiResources return await DbSet .IncludeDetails(includeDetails).OrderBy(sorting ?? "name desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListAsync( @@ -58,12 +58,12 @@ namespace Volo.Abp.IdentityServer.ApiResources { return await DbSet .IncludeDetails(includeDetails) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken); + return await DbSet.AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken).ConfigureAwait(false); } public override async Task DeleteAsync(Guid id, bool autoSave = false, CancellationToken cancellationToken = default) @@ -82,7 +82,7 @@ namespace Volo.Abp.IdentityServer.ApiResources DbContext.Set().Remove(scope); } - await base.DeleteAsync(id, autoSave, cancellationToken); + await base.DeleteAsync(id, autoSave, cancellationToken).ConfigureAwait(false); } public override IQueryable WithDetails() diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs index 44218470fd..4dc5134ff6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.IdentityServer.Clients { return await DbSet .IncludeDetails(includeDetails) - .FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false, @@ -34,7 +34,7 @@ namespace Volo.Abp.IdentityServer.Clients return await DbSet .IncludeDetails(includeDetails).OrderBy(sorting ?? nameof(Client.ClientName) + " desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task> GetAllDistinctAllowedCorsOriginsAsync(CancellationToken cancellationToken = default) @@ -42,12 +42,12 @@ namespace Volo.Abp.IdentityServer.Clients return await DbContext.ClientCorsOrigins .Select(x => x.Origin) .Distinct() - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task CheckClientIdExistAsync(string clientId, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken); + return await DbSet.AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken).ConfigureAwait(false); } public override IQueryable WithDetails() diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesRepository.cs new file mode 100644 index 0000000000..a8d2bce3ce --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesRepository.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.IdentityServer.EntityFrameworkCore; + +namespace Volo.Abp.IdentityServer.Devices +{ + public class DeviceFlowCodesRepository : EfCoreRepository, + IDeviceFlowCodesRepository + { + public DeviceFlowCodesRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + + } + + public async Task FindByUserCodeAsync( + string userCode, + CancellationToken cancellationToken = default) + { + return await DbSet + .FirstOrDefaultAsync(d => d.UserCode == userCode, GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); + } + + public async Task FindByDeviceCodeAsync( + string deviceCode, + CancellationToken cancellationToken = default) + { + return await DbSet + .FirstOrDefaultAsync(d => d.DeviceCode == deviceCode, GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); + } + + public async Task> GetListByExpirationAsync(DateTime maxExpirationDate, int maxResultCount, + CancellationToken cancellationToken = default) + { + return await DbSet + .Where(x => x.Expiration != null && x.Expiration < maxExpirationDate) + .OrderBy(x => x.ClientId) + .Take(maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs index 74a4ce754f..a932cd3351 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs @@ -2,6 +2,7 @@ using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.Modularity; @@ -34,6 +35,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs index 3c7f425dc9..52ba7c8e6c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs @@ -3,6 +3,7 @@ using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; @@ -46,5 +47,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore DbSet ClientProperties { get; set; } DbSet PersistedGrants { get; set; } + + DbSet DeviceFlowCodes { get; set; } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs index 800aa8b8be..f63cd6bf1c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs @@ -3,6 +3,7 @@ using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; @@ -47,6 +48,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore public DbSet PersistedGrants { get; set; } + public DbSet DeviceFlowCodes { get; set; } + public IdentityServerDbContext(DbContextOptions options) : base(options) { @@ -56,6 +59,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); + builder.ConfigureIdentityServer(); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index bd69f6948f..ad74721eb4 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -6,6 +6,7 @@ using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Modeling; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; @@ -246,6 +247,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore apiSecret.HasKey(x => new { x.ApiResourceId, x.Type, x.Value }); apiSecret.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); + apiSecret.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); if (options.DatabaseProvider == EfCoreDatabaseProvider.MySql) { @@ -255,8 +257,6 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore { apiSecret.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLength).IsRequired(); } - - apiSecret.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); }); builder.Entity(apiClaim => @@ -290,6 +290,24 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore apiScopeClaim.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); apiScopeClaim.Property(x => x.Name).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "DeviceFlowCodes", options.Schema); + + b.ConfigureByConvention(); + + b.Property(x => x.DeviceCode).HasMaxLength(200).IsRequired(); + b.Property(x => x.UserCode).HasMaxLength(200).IsRequired(); + b.Property(x => x.SubjectId).HasMaxLength(200); + b.Property(x => x.ClientId).HasMaxLength(200).IsRequired(); + b.Property(x => x.Expiration).IsRequired(); + b.Property(x => x.Data).HasMaxLength(50000).IsRequired(); + + b.HasIndex(x => new { x.UserCode }).IsUnique(); + b.HasIndex(x => x.DeviceCode).IsUnique(); + b.HasIndex(x => x.Expiration); + }); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs index 6f8b8fd4aa..cf208c7875 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs @@ -12,26 +12,42 @@ namespace Volo.Abp.IdentityServer.Grants { public class PersistentGrantRepository : EfCoreRepository, IPersistentGrantRepository { - public PersistentGrantRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + public PersistentGrantRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) { } - public Task FindByKeyAsync( + public async Task FindByKeyAsync( string key, CancellationToken cancellationToken = default) { - return DbSet - .FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)); + return await DbSet + .FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); } - public Task> GetListBySubjectIdAsync( + public async Task> GetListBySubjectIdAsync( string subjectId, CancellationToken cancellationToken = default) { - return DbSet + return await DbSet .Where(x => x.SubjectId == subjectId) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); + } + + public async Task> GetListByExpirationAsync( + DateTime maxExpirationDate, + int maxResultCount, + CancellationToken cancellationToken = default) + { + return await DbSet + .Where(x => x.Expiration != null && x.Expiration < maxExpirationDate) + .OrderBy(x => x.ClientId) + .Take(maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); } public async Task DeleteAsync( @@ -42,7 +58,7 @@ namespace Volo.Abp.IdentityServer.Grants await DeleteAsync( x => x.SubjectId == subjectId && x.ClientId == clientId, cancellationToken: GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); } public async Task DeleteAsync( @@ -54,7 +70,7 @@ namespace Volo.Abp.IdentityServer.Grants await DeleteAsync( x => x.SubjectId == subjectId && x.ClientId == clientId && x.Type == type, cancellationToken: GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs index 20789ecca8..d5d05c5e9a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources where scopeNames.Contains(identityResource.Name) select identityResource; - return await query.ToListAsync(GetCancellationToken(cancellationToken)); + return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public override IQueryable WithDetails() @@ -43,7 +43,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources .IncludeDetails(includeDetails) .OrderBy(sorting ?? "name desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task FindByNameAsync( @@ -54,12 +54,12 @@ namespace Volo.Abp.IdentityServer.IdentityResources return await DbSet .IncludeDetails(includeDetails) .Where(x => x.Name == name) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken); + return await DbSet.AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken).ConfigureAwait(false); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs index 16f99b9119..b4b5fe9b60 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs @@ -2,6 +2,7 @@ using Volo.Abp.Data; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.MongoDB; using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; @@ -19,6 +20,8 @@ namespace Volo.Abp.IdentityServer.MongoDB public IMongoCollection PersistedGrants => Collection(); + public IMongoCollection DeviceFlowCodes => Collection(); + protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs index 474188a0e1..b6a20d842a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs @@ -1,6 +1,7 @@ using System; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.MongoDB; @@ -39,6 +40,11 @@ namespace Volo.Abp.IdentityServer.MongoDB { b.CollectionName = options.CollectionPrefix + "PersistedGrants"; }); + + builder.Entity(b => + { + b.CollectionName = options.CollectionPrefix + "DeviceFlowCodes"; + }); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs index 1076d19ecf..251378e087 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.Modularity; using Volo.Abp.MongoDB; @@ -32,6 +33,7 @@ namespace Volo.Abp.IdentityServer.MongoDB options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs index cda4718896..3bb21a8198 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs @@ -1,6 +1,7 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.MongoDB; @@ -18,5 +19,7 @@ namespace Volo.Abp.IdentityServer.MongoDB IMongoCollection IdentityResources { get; } IMongoCollection PersistedGrants { get; } + + IMongoCollection DeviceFlowCodes { get; } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index e148bbe216..008d34f322 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -21,16 +21,16 @@ namespace Volo.Abp.IdentityServer.MongoDB public virtual async Task FindByNameAsync(string name, bool includeDetails = true, CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .Where(ar=>ar.Name == name) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + .Where(ar => ar.Name == name) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListByScopesAsync(string[] scopeNames, bool includeDetails = false, CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .Where(ar=>ar.Scopes.Any(x=> scopeNames.Contains(x.Name))) - .ToListAsync(GetCancellationToken(cancellationToken)); + .Where(ar => ar.Scopes.Any(x => scopeNames.Contains(x.Name))) + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false, @@ -40,17 +40,17 @@ namespace Volo.Abp.IdentityServer.MongoDB .OrderBy(sorting ?? nameof(ApiResource.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task GetTotalCount() { - return await GetCountAsync(); + return await GetCountAsync().ConfigureAwait(false); } public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken); + return await GetMongoQueryable().AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken).ConfigureAwait(false); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs index 61488edc3d..6e371717ba 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.IdentityServer.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)); + return await GetMongoQueryable().FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListAsync( @@ -40,7 +40,7 @@ namespace Volo.Abp.IdentityServer.MongoDB .OrderBy(sorting ?? nameof(Client.ClientName)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task> GetAllDistinctAllowedCorsOriginsAsync( @@ -50,17 +50,17 @@ namespace Volo.Abp.IdentityServer.MongoDB .SelectMany(x => x.AllowedCorsOrigins) .Select(y => y.Origin) .Distinct() - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task CheckClientIdExistAsync(string clientId, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken); + return await GetMongoQueryable().AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken).ConfigureAwait(false); } public virtual async Task GetTotalCount() { - return await GetCountAsync(); + return await GetCountAsync().ConfigureAwait(false); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoDeviceFlowCodesRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoDeviceFlowCodesRepository.cs new file mode 100644 index 0000000000..86daac80a9 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoDeviceFlowCodesRepository.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MongoDB.Driver; +using MongoDB.Driver.Linq; +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.IdentityServer.Devices; +using Volo.Abp.MongoDB; + +namespace Volo.Abp.IdentityServer.MongoDB +{ + public class MongoDeviceFlowCodesRepository : + MongoDbRepository, IDeviceFlowCodesRepository + { + public MongoDeviceFlowCodesRepository( + IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) + { + + } + + public async Task FindByUserCodeAsync( + string userCode, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .FirstOrDefaultAsync(d => d.UserCode == userCode, GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); + } + + public async Task FindByDeviceCodeAsync(string deviceCode, CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .FirstOrDefaultAsync(d => d.DeviceCode == deviceCode, GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); + } + + public async Task> GetListByExpirationAsync( + DateTime maxExpirationDate, + int maxResultCount, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .Where(x => x.Expiration != null && x.Expiration < maxExpirationDate) + .OrderBy(x => x.ClientId) + .Take(maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs index d25faa9622..eefd4d325c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.IdentityServer.MongoDB .OrderBy(sorting ?? nameof(IdentityResource.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task FindByNameAsync( @@ -34,7 +34,7 @@ namespace Volo.Abp.IdentityServer.MongoDB { return await GetMongoQueryable() .Where(x => x.Name == name) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task> GetListByScopesAsync(string[] scopeNames, bool includeDetails = false, @@ -42,17 +42,17 @@ namespace Volo.Abp.IdentityServer.MongoDB { return await GetMongoQueryable() .Where(ar => scopeNames.Contains(ar.Name)) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task GetTotalCountAsync() { - return await GetCountAsync(); + return await GetCountAsync().ConfigureAwait(false); } public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken); + return await GetMongoQueryable().AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken).ConfigureAwait(false); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs index 6a3248b9db..4b414482db 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs @@ -20,14 +20,26 @@ namespace Volo.Abp.IdentityServer.MongoDB { return await GetMongoQueryable() - .FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task> GetListBySubjectIdAsync(string subjectId, CancellationToken cancellationToken = default) { return await GetMongoQueryable() .Where(x => x.SubjectId == subjectId) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); + } + + public async Task> GetListByExpirationAsync(DateTime maxExpirationDate, int maxResultCount, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .Where(x => x.Expiration != null && x.Expiration < maxExpirationDate) + .OrderBy(x => x.ClientId) + .Take(maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)) + .ConfigureAwait(false); } public async Task DeleteAsync(string subjectId, string clientId, CancellationToken cancellationToken = default) @@ -35,7 +47,7 @@ namespace Volo.Abp.IdentityServer.MongoDB await DeleteAsync( x => x.SubjectId == subjectId && x.ClientId == clientId, cancellationToken: GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); } public async Task DeleteAsync(string subjectId, string clientId, string type, CancellationToken cancellationToken = default) @@ -43,7 +55,7 @@ namespace Volo.Abp.IdentityServer.MongoDB await DeleteAsync( x => x.SubjectId == subjectId && x.ClientId == clientId && x.Type == type, cancellationToken: GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/AbpIdentityServerDomainTestBase.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/AbpIdentityServerDomainTestBase.cs index 009c6ca468..5b9c9240bf 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/AbpIdentityServerDomainTestBase.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/AbpIdentityServerDomainTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.IdentityServer +using Volo.Abp.Testing; + +namespace Volo.Abp.IdentityServer { public class AbpIdentityServerDomainTestBase : AbpIntegratedTest { diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs index e89f385b57..a5b1540a1b 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.IdentityServer.Clients [Fact] public async Task FindClientByIdAsync_Should_Return_Null_If_Not_Found() { - var client = await _clientStore.FindClientByIdAsync("non-existing-id"); + var client = await _clientStore.FindClientByIdAsync("non-existing-id").ConfigureAwait(false); client.ShouldBeNull(); } @@ -26,7 +26,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindClientByIdAsync_Should_Return_The_Client_If_Found() { //Act - var client = await _clientStore.FindClientByIdAsync("42"); + var client = await _clientStore.FindClientByIdAsync("42").ConfigureAwait(false); //Assert client.ShouldNotBeNull(); diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs index a313c2717f..9e7bdfc99a 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindApiResourceAsync_Should_Return_Null_If_Not_Found() { //Act - var resource = await _resourceStore.FindApiResourceAsync("non-existing-name"); + var resource = await _resourceStore.FindApiResourceAsync("non-existing-name").ConfigureAwait(false); //Assert resource.ShouldBeNull(); @@ -32,7 +32,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindApiResourceAsync_Should_Return_If_Found() { //Act - var apiResource = await _resourceStore.FindApiResourceAsync("Test-ApiResource-Name-1"); + var apiResource = await _resourceStore.FindApiResourceAsync("Test-ApiResource-Name-1").ConfigureAwait(false); //Assert apiResource.ShouldNotBe(null); @@ -48,7 +48,7 @@ namespace Volo.Abp.IdentityServer.Clients var apiResources = (await _resourceStore.FindApiResourcesByScopeAsync(new List { "Test-ApiResource-ApiScope-Name-1" - })).ToList(); + }).ConfigureAwait(false)).ToList(); //Assert apiResources.ShouldNotBe(null); @@ -63,7 +63,7 @@ namespace Volo.Abp.IdentityServer.Clients var identityResourcesByScope = await _resourceStore.FindIdentityResourcesByScopeAsync(new List { "Test-Identity-Resource-Name-1" - }); + }).ConfigureAwait(false); //Assert var resourcesByScope = identityResourcesByScope as IdentityResource[] ?? identityResourcesByScope.ToArray(); @@ -77,7 +77,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task GetAllResourcesAsync_Should_Return() { //Act - var resources = await _resourceStore.GetAllResourcesAsync(); + var resources = await _resourceStore.GetAllResourcesAsync().ConfigureAwait(false); //Assert resources.ShouldNotBe(null); diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs index 8e83f57c51..7df9936183 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.IdentityServer.Clients [Fact] public async Task FindClientByIdAsync_Should_Return_Null_If_Not_Found() { - var persistentGrant = await _persistedGrantStore.GetAsync("not-existing-id"); + var persistentGrant = await _persistedGrantStore.GetAsync("not-existing-id").ConfigureAwait(false); persistentGrant.ShouldBeNull(); } @@ -29,7 +29,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindPersistentGrantByIdAsync_Should_Return_The_PersistentGrant_If_Found() { //Act - var client = await _persistedGrantStore.GetAsync("38"); + var client = await _persistedGrantStore.GetAsync("38").ConfigureAwait(false); //Assert client.ShouldNotBeNull(); @@ -52,10 +52,10 @@ namespace Volo.Abp.IdentityServer.Clients Data = "TestData-39", Expiration = new DateTime(2018, 1, 6, 21, 22, 23), CreationTime = new DateTime(2018, 1, 5, 19, 20, 21) - }); + }).ConfigureAwait(false); //Assert - var persistedGrant = await _persistedGrantStore.GetAsync("39"); + var persistedGrant = await _persistedGrantStore.GetAsync("39").ConfigureAwait(false); persistedGrant.Key.ShouldBe("39"); persistedGrant.ClientId.ShouldBe("TestClientId-39"); persistedGrant.Type.ShouldBe("TestType-39"); @@ -92,10 +92,10 @@ namespace Volo.Abp.IdentityServer.Clients Data = "TestData-PersistedGrantKey1", Expiration = new DateTime(2018, 1, 6, 21, 22, 23), CreationTime = new DateTime(2018, 1, 5, 19, 20, 21) - }); + }).ConfigureAwait(false); //Assert - var persistedGrant = await _persistedGrantStore.GetAsync("PersistedGrantKey1"); + var persistedGrant = await _persistedGrantStore.GetAsync("PersistedGrantKey1").ConfigureAwait(false); persistedGrant.Key.ShouldBe("PersistedGrantKey1"); persistedGrant.ClientId.ShouldBe("TestClientId-PersistedGrantKey1"); persistedGrant.Type.ShouldBe("TestType-PersistedGrantKey1"); @@ -122,7 +122,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task GetAllAsync_Should_Get_All_PersistedGrants_For_A_Given_SubjectId() { //Act - var persistentGrants = await _persistedGrantStore.GetAllAsync("TestSubject"); + var persistentGrants = await _persistedGrantStore.GetAllAsync("TestSubject").ConfigureAwait(false); //Assert var persistedGrants = persistentGrants as PersistedGrant[] ?? persistentGrants.ToArray(); @@ -142,13 +142,13 @@ namespace Volo.Abp.IdentityServer.Clients Type = "Type", ClientId = "ClientId", Data = "" - }); + }).ConfigureAwait(false); //Act - await _persistedGrantStore.RemoveAsync("#1P3R"); + await _persistedGrantStore.RemoveAsync("#1P3R").ConfigureAwait(false); //Assert - var persistedGrant = await _persistedGrantStore.GetAsync("#1P3R"); + var persistedGrant = await _persistedGrantStore.GetAsync("#1P3R").ConfigureAwait(false); persistedGrant.ShouldBe(null); } @@ -156,16 +156,16 @@ namespace Volo.Abp.IdentityServer.Clients public async Task RemoveAllAsync_Should_RemoveAll_PeristedGrants_For_A_Given_Subject_And_ClientId() { //Arrange - var persistedGrantsWithTestSubjectX = await _persistedGrantStore.GetAllAsync("TestSubject-X"); + var persistedGrantsWithTestSubjectX = await _persistedGrantStore.GetAllAsync("TestSubject-X").ConfigureAwait(false); var persistedGrantsWithTestSubjectXBeforeLength = persistedGrantsWithTestSubjectX.ToArray().Length; //Act - await _persistedGrantStore.RemoveAllAsync("TestSubject-X", "TestClientId-X"); + await _persistedGrantStore.RemoveAllAsync("TestSubject-X", "TestClientId-X").ConfigureAwait(false); //Assert persistedGrantsWithTestSubjectXBeforeLength.ShouldBe(2); - var persistedGrants = (await _persistedGrantStore.GetAllAsync("TestClientId-37")).ToArray(); + var persistedGrants = (await _persistedGrantStore.GetAllAsync("TestClientId-37").ConfigureAwait(false)).ToArray(); persistedGrants.ShouldNotBe(null); persistedGrants.Length.ShouldBe(0); } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs index af701cfc69..cdbea763c6 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs @@ -23,27 +23,27 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task IsOriginAllowedAsync() { - (await _corsPolicyService.IsOriginAllowedAsync("https://client1-origin.com")).ShouldBeTrue(); - (await _corsPolicyService.IsOriginAllowedAsync("https://unknown-origin.com")).ShouldBeFalse(); + (await _corsPolicyService.IsOriginAllowedAsync("https://client1-origin.com").ConfigureAwait(false)).ShouldBeTrue(); + (await _corsPolicyService.IsOriginAllowedAsync("https://unknown-origin.com").ConfigureAwait(false)).ShouldBeFalse(); } [Fact] public async Task IsOriginAllowedAsync_Should_Invalidate_Cache_On_Update() { //It does not exists before - (await _corsPolicyService.IsOriginAllowedAsync("https://new-origin.com")).ShouldBeFalse(); + (await _corsPolicyService.IsOriginAllowedAsync("https://new-origin.com").ConfigureAwait(false)).ShouldBeFalse(); using (var uow = _unitOfWorkManager.Begin()) { - var client1 = await _clientRepository.FindByCliendIdAsync("ClientId1"); + var client1 = await _clientRepository.FindByCliendIdAsync("ClientId1").ConfigureAwait(false); client1.AddCorsOrigin("https://new-origin.com"); - await _clientRepository.UpdateAsync(client1); + await _clientRepository.UpdateAsync(client1).ConfigureAwait(false); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } //It does exists now - (await _corsPolicyService.IsOriginAllowedAsync("https://new-origin.com")).ShouldBeTrue(); + (await _corsPolicyService.IsOriginAllowedAsync("https://new-origin.com").ConfigureAwait(false)).ShouldBeTrue(); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Devices/DeviceFlowStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Devices/DeviceFlowStore_Tests.cs new file mode 100644 index 0000000000..7d4c630de7 --- /dev/null +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Devices/DeviceFlowStore_Tests.cs @@ -0,0 +1,95 @@ +using System.Linq; +using System.Security.Claims; +using System.Threading.Tasks; +using IdentityModel; +using IdentityServer4.Models; +using IdentityServer4.Stores; +using Shouldly; +using Xunit; + +namespace Volo.Abp.IdentityServer.Devices +{ + public class DeviceFlowStore_Tests : AbpIdentityServerTestBase + { + private readonly IDeviceFlowStore _deviceFlowStore; + + public DeviceFlowStore_Tests() + { + _deviceFlowStore = GetRequiredService(); + } + + [Fact] + public async Task StoreDeviceAuthorizationAsync() + { + await _deviceFlowStore.StoreDeviceAuthorizationAsync( + "DeviceCode-Test1", + "UserCode-Test1", + new DeviceCode + { + ClientId = "ClientId1", + AuthorizedScopes = new string[] { "s1", "s2" }, + IsAuthorized = true, + Lifetime = 42, + RequestedScopes = new string[] { "rs1" }, + Subject = new ClaimsPrincipal( + new[] + { + new ClaimsIdentity(new[] + { + new Claim(JwtClaimTypes.Subject, "sid1") + }) + } + ) + } + ); + + void Check(DeviceCode deviceCode) + { + deviceCode.ClientId.ShouldBe("ClientId1"); + deviceCode.AuthorizedScopes.ShouldNotBeNull(); + deviceCode.AuthorizedScopes.Count().ShouldBe(2); + deviceCode.AuthorizedScopes.ShouldContain("s1"); + deviceCode.AuthorizedScopes.ShouldContain("s2"); + deviceCode.IsAuthorized.ShouldBeTrue(); + deviceCode.Lifetime.ShouldBe(42); + deviceCode.RequestedScopes.ShouldNotBeNull(); + deviceCode.RequestedScopes.Count().ShouldBe(1); + deviceCode.RequestedScopes.ShouldContain("rs1"); + deviceCode.Subject.ShouldNotBeNull(); + deviceCode.Subject.Claims.ShouldContain(x => x.Type == JwtClaimTypes.Subject && x.Value == "sid1"); + } + + Check(await _deviceFlowStore.FindByUserCodeAsync("UserCode-Test1")); + Check(await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode-Test1")); + } + + [Fact] + public async Task RemoveByDeviceCodeAsync() + { + (await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode1")).ShouldNotBeNull(); + + await _deviceFlowStore.RemoveByDeviceCodeAsync("DeviceCode1"); + + (await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode1")).ShouldBeNull(); + } + + [Fact] + public async Task UpdateByDeviceCodeAsync() + { + var deviceCode = await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode1"); + deviceCode.ShouldNotBeNull(); + deviceCode.Lifetime.ShouldBe(42); + + await _deviceFlowStore.UpdateByUserCodeAsync( + "DeviceFlowCodesUserCode1", + new DeviceCode + { + Lifetime = 43 + } + ); + + deviceCode = await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode1"); + deviceCode.Lifetime.ShouldBe(43); + } + } +} diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Tokens/TokenCleanupService_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Tokens/TokenCleanupService_Tests.cs new file mode 100644 index 0000000000..8de564cc23 --- /dev/null +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Tokens/TokenCleanupService_Tests.cs @@ -0,0 +1,37 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.IdentityServer.Devices; +using Volo.Abp.IdentityServer.Grants; +using Xunit; + +namespace Volo.Abp.IdentityServer.Tokens +{ + public class TokenCleanupService_Tests : AbpIdentityServerTestBase + { + private readonly IPersistentGrantRepository _persistentGrantRepository; + private readonly IDeviceFlowCodesRepository _deviceFlowCodesRepository; + private readonly TokenCleanupService _tokenCleanupService; + + public TokenCleanupService_Tests() + { + _persistentGrantRepository = GetRequiredService(); + _deviceFlowCodesRepository = GetRequiredService(); + _tokenCleanupService = GetRequiredService(); + } + + [Fact] + public async Task Should_Clear_Expired_Tokens() + { + var persistentGrantCount = await _persistentGrantRepository.GetCountAsync(); + var deviceFlowCodesCount = await _deviceFlowCodesRepository.GetCountAsync(); + + await _tokenCleanupService.CleanAsync(); + + (await _persistentGrantRepository.GetCountAsync()) + .ShouldBe(persistentGrantCount - 1); + + (await _deviceFlowCodesRepository.GetCountAsync()) + .ShouldBe(deviceFlowCodesCount - 1); + } + } +} diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityApplicationTestBase.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityApplicationTestBase.cs index b102a72329..f66709e5d1 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityApplicationTestBase.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityApplicationTestBase.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.IdentityServer +using Volo.Abp.Testing; + +namespace Volo.Abp.IdentityServer { public class AbpIdentityServerTestBase : AbpIntegratedTest { diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index 0d87a2fd19..d7e0716151 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -39,10 +39,10 @@ namespace Volo.Abp.IdentityServer public async Task BuildAsync() { - await AddClients(); - await AddPersistentGrants(); - await AddApiResources(); - await AddIdentityResources(); + await AddClients().ConfigureAwait(false); + await AddPersistentGrants().ConfigureAwait(false); + await AddApiResources().ConfigureAwait(false); + await AddIdentityResources().ConfigureAwait(false); } private async Task AddClients() @@ -56,7 +56,7 @@ namespace Volo.Abp.IdentityServer client42.AddScope("api1"); - await _clientRepository.InsertAsync(client42); + await _clientRepository.InsertAsync(client42).ConfigureAwait(false); } private async Task AddPersistentGrants() @@ -68,7 +68,7 @@ namespace Volo.Abp.IdentityServer Type = "TestType-38", SubjectId = "TestSubject", Data = "TestData-38" - }); + }).ConfigureAwait(false); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -77,7 +77,7 @@ namespace Volo.Abp.IdentityServer Type = "TestType-37", SubjectId = "TestSubject", Data = "TestData-37" - }); + }).ConfigureAwait(false); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -86,7 +86,7 @@ namespace Volo.Abp.IdentityServer Type = "TestType-36", SubjectId = "TestSubject-X", Data = "TestData-36" - }); + }).ConfigureAwait(false); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -95,7 +95,7 @@ namespace Volo.Abp.IdentityServer Type = "TestType-35", SubjectId = "TestSubject-X", Data = "TestData-35" - }); + }).ConfigureAwait(false); } private async Task AddApiResources() @@ -111,7 +111,7 @@ namespace Volo.Abp.IdentityServer apiResource.AddScope("Test-ApiResource-ApiScope-Name-1", "Test-ApiResource-ApiScope-DisplayName-1"); apiResource.AddUserClaim("Test-ApiResource-Claim-Type-1"); - await _apiResourceRepository.InsertAsync(apiResource); + await _apiResourceRepository.InsertAsync(apiResource).ConfigureAwait(false); } private async Task AddIdentityResources() @@ -126,7 +126,7 @@ namespace Volo.Abp.IdentityServer identityResource.AddUserClaim("Test-Identity-Resource-1-IdentityClaim-Type-1"); - await _identityResourceRepository.InsertAsync(identityResource); + await _identityResourceRepository.InsertAsync(identityResource).ConfigureAwait(false); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestBase.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestBase.cs index a78caec8d0..ca3eebd260 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestBase.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestBase.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace Volo.Abp.IdentityServer { diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index dd0016e666..ee6c8c59b6 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -6,8 +6,10 @@ using Volo.Abp.Guids; using Volo.Abp.Identity; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; +using Volo.Abp.Timing; namespace Volo.Abp.IdentityServer { @@ -19,7 +21,9 @@ namespace Volo.Abp.IdentityServer private readonly IIdentityResourceRepository _identityResourceRepository; private readonly IIdentityClaimTypeRepository _identityClaimTypeRepository; private readonly IPersistentGrantRepository _persistentGrantRepository; + private readonly IDeviceFlowCodesRepository _deviceFlowCodesRepository; private readonly AbpIdentityServerTestData _testData; + private readonly IClock _clock; public AbpIdentityServerTestDataBuilder( IGuidGenerator guidGenerator, @@ -28,7 +32,9 @@ namespace Volo.Abp.IdentityServer IIdentityResourceRepository identityResourceRepository, IIdentityClaimTypeRepository identityClaimTypeRepository, AbpIdentityServerTestData testData, - IPersistentGrantRepository persistentGrantRepository) + IPersistentGrantRepository persistentGrantRepository, + IDeviceFlowCodesRepository deviceFlowCodesRepository, + IClock clock) { _testData = testData; _guidGenerator = guidGenerator; @@ -37,15 +43,46 @@ namespace Volo.Abp.IdentityServer _identityResourceRepository = identityResourceRepository; _identityClaimTypeRepository = identityClaimTypeRepository; _persistentGrantRepository = persistentGrantRepository; + _clock = clock; + _deviceFlowCodesRepository = deviceFlowCodesRepository; } public async Task BuildAsync() { - await AddPersistedGrants(); - await AddIdentityResources(); - await AddApiResources(); - await AddClients(); - await AddClaimTypes(); + await AddDeviceFlowCodes().ConfigureAwait(false); + await AddPersistedGrants().ConfigureAwait(false); + await AddIdentityResources().ConfigureAwait(false); + await AddApiResources().ConfigureAwait(false); + await AddClients().ConfigureAwait(false); + await AddClaimTypes().ConfigureAwait(false); + } + + private async Task AddDeviceFlowCodes() + { + await _deviceFlowCodesRepository.InsertAsync( + new DeviceFlowCodes(_guidGenerator.Create()) + { + ClientId = "c1", + DeviceCode = "DeviceCode1", + Expiration = _clock.Now.AddDays(1), + Data = "{\"Lifetime\":\"42\"}", + UserCode = "DeviceFlowCodesUserCode1", + SubjectId = "DeviceFlowCodesSubjectId1" + } + ); + + await _deviceFlowCodesRepository.InsertAsync( + new DeviceFlowCodes(_guidGenerator.Create()) + { + ClientId = "c1", + DeviceCode = "DeviceCode2", + Expiration = _clock.Now.AddDays(-1), + Data = "", + UserCode = "DeviceFlowCodesUserCode2", + SubjectId = "DeviceFlowCodesSubjectId2" + } + ); + } private async Task AddPersistedGrants() @@ -57,7 +94,7 @@ namespace Volo.Abp.IdentityServer ClientId = "PersistedGrantClientId1", Type = "PersistedGrantType1", Data = "" - }); + }).ConfigureAwait(false); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -66,7 +103,7 @@ namespace Volo.Abp.IdentityServer ClientId = "c1", Type = "c1type", Data = "" - }); + }).ConfigureAwait(false); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -74,8 +111,19 @@ namespace Volo.Abp.IdentityServer SubjectId = "PersistedGrantSubjectId3", ClientId = "c1", Type = "c1type", - Data = "" - }); + Data = "", + Expiration = _clock.Now.AddDays(1), + }).ConfigureAwait(false); + + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "PersistedGrantKey_Expired1", + SubjectId = "PersistedGrantSubjectId_Expired1", + ClientId = "c1", + Type = "c1type", + Data = "", + Expiration = _clock.Now.AddDays(-1) + }).ConfigureAwait(false); } private async Task AddIdentityResources() @@ -88,9 +136,9 @@ namespace Volo.Abp.IdentityServer identityResource.AddUserClaim(nameof(ApiResourceClaim.Type)); - await _identityResourceRepository.InsertAsync(identityResource); - await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource2")); - await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource3")); + await _identityResourceRepository.InsertAsync(identityResource).ConfigureAwait(false); + await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource2")).ConfigureAwait(false); + await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource3")).ConfigureAwait(false); } private async Task AddApiResources() @@ -103,9 +151,9 @@ namespace Volo.Abp.IdentityServer apiResource.AddUserClaim(nameof(ApiResourceClaim.Type)); apiResource.AddSecret(nameof(ApiSecret.Value)); - await _apiResourceRepository.InsertAsync(apiResource); - await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource2")); - await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource3")); + await _apiResourceRepository.InsertAsync(apiResource).ConfigureAwait(false); + await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource2")).ConfigureAwait(false); + await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource3")).ConfigureAwait(false); } private async Task AddClients() @@ -130,17 +178,17 @@ namespace Volo.Abp.IdentityServer client.AddScope(nameof(ClientScope.Scope)); client.AddSecret(nameof(ClientSecret.Value)); - await _clientRepository.InsertAsync(client); + await _clientRepository.InsertAsync(client).ConfigureAwait(false); - await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId2")); - await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId3")); + await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId2")).ConfigureAwait(false); + await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId3")).ConfigureAwait(false); } private async Task AddClaimTypes() { var ageClaim = new IdentityClaimType(Guid.NewGuid(), "Age", false, false, null, null, null, IdentityClaimValueType.Int); - await _identityClaimTypeRepository.InsertAsync(ageClaim); + await _identityClaimTypeRepository.InsertAsync(ageClaim).ConfigureAwait(false); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs index db8eacae5c..43b4e9d8f2 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs @@ -20,13 +20,13 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task FindByNormalizedNameAsync() { - (await apiResourceRepository.FindByNameAsync("NewApiResource2")).ShouldNotBeNull(); + (await apiResourceRepository.FindByNameAsync("NewApiResource2").ConfigureAwait(false)).ShouldNotBeNull(); } [Fact] public async Task GetListByScopesAsync() { - (await apiResourceRepository.GetListByScopesAsync(new []{ "NewApiResource2", "NewApiResource3"})).Count.ShouldBe(2); + (await apiResourceRepository.GetListByScopesAsync(new[] { "NewApiResource2", "NewApiResource3" }).ConfigureAwait(false)).Count.ShouldBe(2); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs index 86f69610f5..300c1620ff 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs @@ -21,13 +21,13 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task FindByCliendIdAsync() { - (await clientRepository.FindByCliendIdAsync("ClientId2")).ShouldNotBeNull(); + (await clientRepository.FindByCliendIdAsync("ClientId2").ConfigureAwait(false)).ShouldNotBeNull(); } [Fact] public async Task GetAllDistinctAllowedCorsOriginsAsync() { - var origins = await clientRepository.GetAllDistinctAllowedCorsOriginsAsync(); + var origins = await clientRepository.GetAllDistinctAllowedCorsOriginsAsync().ConfigureAwait(false); origins.Any().ShouldBeTrue(); } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs index 32fd716d3d..2d98fff2a3 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task GetListByScopesAsync() { - (await identityResourceRepository.GetListByScopesAsync(new []{"", "NewIdentityResource2" })).Count.ShouldBe(1); + (await identityResourceRepository.GetListByScopesAsync(new[] { "", "NewIdentityResource2" }).ConfigureAwait(false)).Count.ShouldBe(1); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs index 20f6674515..0786af42bc 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs @@ -22,13 +22,13 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task FindByKeyAsync() { - (await _persistentGrantRepository.FindByKeyAsync("PersistedGrantKey1")).ShouldNotBeNull(); + (await _persistentGrantRepository.FindByKeyAsync("PersistedGrantKey1").ConfigureAwait(false)).ShouldNotBeNull(); } [Fact] public async Task GetListBySubjectIdAsync() { - var persistedGrants = await _persistentGrantRepository.GetListBySubjectIdAsync("PersistedGrantSubjectId1"); + var persistedGrants = await _persistentGrantRepository.GetListBySubjectIdAsync("PersistedGrantSubjectId1").ConfigureAwait(false); persistedGrants.ShouldNotBeEmpty(); persistedGrants.ShouldContain(x => x.Key == "PersistedGrantKey1"); } @@ -36,9 +36,9 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task DeleteBySubjectIdAndClientId() { - await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1"); + await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1").ConfigureAwait(false); - var persistedGrants = await _persistentGrantRepository.GetListAsync(); + var persistedGrants = await _persistentGrantRepository.GetListAsync().ConfigureAwait(false); persistedGrants.ShouldNotBeEmpty(); persistedGrants.ShouldNotContain(x => x.Key == "PersistedGrantKey1" && x.SubjectId == "PersistedGrantSubjectId1" && @@ -49,9 +49,9 @@ namespace Volo.Abp.IdentityServer public async Task DeleteBySubjectIdAndClientIdAndType() { await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1", - "PersistedGrantClientId1"); + "PersistedGrantClientId1").ConfigureAwait(false); - var persistedGrants = await _persistentGrantRepository.GetListAsync(); + var persistedGrants = await _persistentGrantRepository.GetListAsync().ConfigureAwait(false); persistedGrants.ShouldNotBeEmpty(); persistedGrants.ShouldNotContain(x => x.Key == "PersistedGrantKey1" && x.SubjectId == "PersistedGrantSubjectId1" && diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs index 63065fd688..b9f504b4f1 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.PermissionManagement public virtual async Task GetAsync(string providerName, string providerKey) { - await CheckProviderPolicy(providerName); + await CheckProviderPolicy(providerName).ConfigureAwait(false); var result = new GetPermissionListResultDto { @@ -74,7 +74,7 @@ namespace Volo.Abp.PermissionManagement GrantedProviders = new List() }; - var grantInfo = await _permissionManager.GetAsync(permission.Name, providerName, providerKey); + var grantInfo = await _permissionManager.GetAsync(permission.Name, providerName, providerKey).ConfigureAwait(false); grantInfoDto.IsGranted = grantInfo.IsGranted; @@ -101,11 +101,11 @@ namespace Volo.Abp.PermissionManagement public virtual async Task UpdateAsync(string providerName, string providerKey, UpdatePermissionsDto input) { - await CheckProviderPolicy(providerName); + await CheckProviderPolicy(providerName).ConfigureAwait(false); foreach (var permissionDto in input.Permissions) { - await _permissionManager.SetAsync(permissionDto.Name, providerName, providerKey, permissionDto.IsGranted); + await _permissionManager.SetAsync(permissionDto.Name, providerName, providerKey, permissionDto.IsGranted).ConfigureAwait(false); } } @@ -117,7 +117,7 @@ namespace Volo.Abp.PermissionManagement throw new AbpException($"No policy defined to get/set permissions for the provider '{policyName}'. Use {nameof(PermissionManagementOptions)} to map the policy."); } - await AuthorizationService.CheckAsync(policyName); + await AuthorizationService.CheckAsync(policyName).ConfigureAwait(false); } } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo.Abp.PermissionManagement.Domain.Shared.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo.Abp.PermissionManagement.Domain.Shared.csproj index fd4d602045..ff0ba6fbee 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo.Abp.PermissionManagement.Domain.Shared.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo.Abp.PermissionManagement.Domain.Shared.csproj @@ -19,7 +19,7 @@ - + diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/AbpPermissionManagementDomainSharedModule.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/AbpPermissionManagementDomainSharedModule.cs index 210ff6affc..b1d2c59a73 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/AbpPermissionManagementDomainSharedModule.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/AbpPermissionManagementDomainSharedModule.cs @@ -1,13 +1,14 @@ using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.Localization; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.PermissionManagement { [DependsOn( - typeof(AbpLocalizationModule) + typeof(AbpValidationModule) )] public class AbpPermissionManagementDomainSharedModule : AbpModule { diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeeder.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeeder.cs index 80062f528d..451b9fadbf 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeeder.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeeder.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.PermissionManagement providerKey, tenantId ) - ); + ).ConfigureAwait(false); } } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs index 9e73e59b79..46badf093a 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.PermissionManagement using (CurrentTenant.Change(eventData.Entity.TenantId)) { - await Cache.RemoveAsync(cacheKey); + await Cache.RemoveAsync(cacheKey).ConfigureAwait(false); } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementProvider.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementProvider.cs index 0b83f37fd1..9cca1277d5 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementProvider.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementProvider.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.PermissionManagement protected virtual async Task GrantAsync(string name, string providerKey) { - var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey); + var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey).ConfigureAwait(false); if (permissionGrant != null) { return; @@ -60,18 +60,18 @@ namespace Volo.Abp.PermissionManagement providerKey, CurrentTenant.Id ) - ); + ).ConfigureAwait(false); } protected virtual async Task RevokeAsync(string name, string providerKey) { - var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey); + var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey).ConfigureAwait(false); if (permissionGrant == null) { return; } - await PermissionGrantRepository.DeleteAsync(permissionGrant); + await PermissionGrantRepository.DeleteAsync(permissionGrant).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs index f8825c6e81..d7d1dd70c1 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs @@ -52,7 +52,7 @@ namespace Volo.Abp.PermissionManagement public async Task GetAsync(string permissionName, string providerName, string providerKey) { - return await GetInternalAsync(PermissionDefinitionManager.Get(permissionName), providerName, providerKey); + return await GetInternalAsync(PermissionDefinitionManager.Get(permissionName), providerName, providerKey).ConfigureAwait(false); } public async Task> GetAllAsync(string providerName, string providerKey) @@ -61,7 +61,7 @@ namespace Volo.Abp.PermissionManagement foreach (var permissionDefinition in PermissionDefinitionManager.GetPermissions()) { - results.Add(await GetInternalAsync(permissionDefinition, providerName, providerKey)); + results.Add(await GetInternalAsync(permissionDefinition, providerName, providerKey).ConfigureAwait(false)); } return results; @@ -83,7 +83,7 @@ namespace Volo.Abp.PermissionManagement throw new ApplicationException($"The permission named '{permission.Name}' has multitenancy side '{permission.MultiTenancySide}' which is not compatible with the current multitenancy side '{CurrentTenant.GetMultiTenancySide()}'"); } - var currentGrantInfo = await GetInternalAsync(permission, providerName, providerKey); + var currentGrantInfo = await GetInternalAsync(permission, providerName, providerKey).ConfigureAwait(false); if (currentGrantInfo.IsGranted == isGranted) { return; @@ -96,7 +96,7 @@ namespace Volo.Abp.PermissionManagement throw new AbpException("Unknown permission management provider: " + providerName); } - await provider.SetAsync(permissionName, providerKey, isGranted); + await provider.SetAsync(permissionName, providerKey, isGranted).ConfigureAwait(false); } protected virtual async Task GetInternalAsync(PermissionDefinition permission, string providerName, string providerKey) @@ -115,7 +115,7 @@ namespace Volo.Abp.PermissionManagement foreach (var provider in ManagementProviders) { - var providerResult = await provider.CheckAsync(permission.Name, providerName, providerKey); + var providerResult = await provider.CheckAsync(permission.Name, providerName, providerKey).ConfigureAwait(false); if (providerResult.IsGranted) { result.IsGranted = true; diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs index 744dc19c8e..0d594007e8 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.PermissionManagement public async Task IsGrantedAsync(string name, string providerName, string providerKey) { - return (await GetCacheItemAsync(name, providerName, providerKey)).IsGranted; + return (await GetCacheItemAsync(name, providerName, providerKey).ConfigureAwait(false)).IsGranted; } protected virtual async Task GetCacheItemAsync(string name, string providerName, string providerKey) @@ -35,7 +35,7 @@ namespace Volo.Abp.PermissionManagement Logger.LogDebug($"PermissionStore.GetCacheItemAsync: {cacheKey}"); - var cacheItem = await Cache.GetAsync(cacheKey); + var cacheItem = await Cache.GetAsync(cacheKey).ConfigureAwait(false); if (cacheItem != null) { @@ -55,7 +55,7 @@ namespace Volo.Abp.PermissionManagement await Cache.SetAsync( cacheKey, cacheItem - ); + ).ConfigureAwait(false); Logger.LogDebug($"Finished setting the cache item: {cacheKey}"); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs index d8241d6f8f..8663e8026a 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.PermissionManagement.EntityFrameworkCore s.ProviderName == providerName && s.ProviderKey == providerKey, GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); } public async Task> GetListAsync( @@ -42,7 +42,7 @@ namespace Volo.Abp.PermissionManagement.EntityFrameworkCore .Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(GetCancellationToken(cancellationToken)); + ).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs index 67befaa717..bc2f5ef5d9 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.PermissionManagement.MongoDB s.ProviderName == providerName && s.ProviderKey == providerKey, GetCancellationToken(cancellationToken) - ); + ).ConfigureAwait(false); } public async Task> GetListAsync( @@ -41,7 +41,7 @@ namespace Volo.Abp.PermissionManagement.MongoDB .Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(GetCancellationToken(cancellationToken)); + ).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs index cf1c3f13b1..c7f4e08480 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs @@ -1,10 +1,7 @@ -using Localization.Resources.AbpUi; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AutoMapper; -using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.HttpApi; using Volo.Abp.PermissionManagement.Localization; diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs index 70ec393455..fe01aa6618 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs @@ -42,7 +42,7 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement { ValidateModel(); - var result = await _permissionAppService.GetAsync(ProviderName, ProviderKey); + var result = await _permissionAppService.GetAsync(ProviderName, ProviderKey).ConfigureAwait(false); EntityDisplayName = result.EntityDisplayName; @@ -84,7 +84,7 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement { Permissions = updatePermissionDtos } - ); + ).ConfigureAwait(false); return NoContent(); } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs index e944aeebc2..d610eede6e 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan public async Task GetAsync() { var permissionListResultDto = await _permissionAppService.GetAsync(UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()); + PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); permissionListResultDto.ShouldNotBeNull(); permissionListResultDto.EntityDisplayName.ShouldBe(PermissionTestDataBuilder.User1Id.ToString()); @@ -43,7 +43,7 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan public async Task UpdateAsync() { (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test")).ShouldBeNull(); + "Test").ConfigureAwait(false)).ShouldBeNull(); await _permissionAppService.UpdateAsync("Test", "Test", new UpdatePermissionsDto() @@ -56,10 +56,10 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan Name = "MyPermission1" } } - }); + }).ConfigureAwait(false); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test")).ShouldNotBeNull(); + "Test").ConfigureAwait(false)).ShouldNotBeNull(); } [Fact] @@ -67,14 +67,14 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan { await _permissionGrantRepository.InsertAsync( new PermissionGrant( - Guid.NewGuid(), + Guid.NewGuid(), "MyPermission1", "Test", "Test" ) - ); + ).ConfigureAwait(false); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test")).ShouldNotBeNull(); + "Test").ConfigureAwait(false)).ShouldNotBeNull(); await _permissionAppService.UpdateAsync("Test", "Test", new UpdatePermissionsDto() @@ -87,10 +87,10 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan Name = "MyPermission1" } } - }); + }).ConfigureAwait(false); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test")).ShouldBeNull(); + "Test").ConfigureAwait(false)).ShouldBeNull(); } } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionGrantRepository_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionGrantRepository_Tests.cs index e27be7e426..217b81361b 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionGrantRepository_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionGrantRepository_Tests.cs @@ -19,16 +19,16 @@ namespace Volo.Abp.PermissionManagement [Fact] public async Task FindAsync() { - (await PermissionGrantRepository.FindAsync("MyPermission1", UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString())).ShouldNotBeNull(); + (await PermissionGrantRepository.FindAsync("MyPermission1", UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false)).ShouldNotBeNull(); - (await PermissionGrantRepository.FindAsync("Undefined-Permission", UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString())).ShouldBeNull(); - (await PermissionGrantRepository.FindAsync("MyPermission1", "Undefined-Provider", "Unknown-Id")).ShouldBeNull(); + (await PermissionGrantRepository.FindAsync("Undefined-Permission", UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false)).ShouldBeNull(); + (await PermissionGrantRepository.FindAsync("MyPermission1", "Undefined-Provider", "Unknown-Id").ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task GetListAsync() { - var permissionGrants = await PermissionGrantRepository.GetListAsync(UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString()); + var permissionGrants = await PermissionGrantRepository.GetListAsync(UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); permissionGrants.ShouldContain(p => p.Name == "MyPermission1"); } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionManagementTestBase.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionManagementTestBase.cs index c90537d159..d64369978b 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionManagementTestBase.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionManagementTestBase.cs @@ -1,4 +1,5 @@ using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace Volo.Abp.PermissionManagement { diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs index 662d0b17c8..d6e89741c4 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.PermissionManagement UserPermissionValueProvider.ProviderName, User1Id.ToString() ) - ); + ).ConfigureAwait(false); await _permissionGrantRepository.InsertAsync( new PermissionGrant( @@ -38,7 +38,7 @@ namespace Volo.Abp.PermissionManagement UserPermissionValueProvider.ProviderName, User1Id.ToString() ) - ); + ).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_Basic_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_Basic_Tests.cs index 1fb52c13a1..b2125dbf02 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_Basic_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_Basic_Tests.cs @@ -19,13 +19,13 @@ namespace Volo.Abp.PermissionManagement { await Assert.ThrowsAsync(async () => await _permissionChecker.IsGrantedAsync("UndefinedPermissionName") - ); +.ConfigureAwait(false)).ConfigureAwait(false); } [Fact] public async Task Should_Return_False_As_Default_For_Any_Permission() { - (await _permissionChecker.IsGrantedAsync("MyPermission1")).ShouldBeFalse(); + (await _permissionChecker.IsGrantedAsync("MyPermission1").ConfigureAwait(false)).ShouldBeFalse(); } } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs index b49ff94f90..2a6f59af82 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.PermissionManagement (await _permissionChecker.IsGrantedAsync( CreatePrincipal(PermissionTestDataBuilder.User1Id), "MyPermission1" - )).ShouldBeTrue(); + ).ConfigureAwait(false)).ShouldBeTrue(); } [Fact] @@ -32,7 +32,7 @@ namespace Volo.Abp.PermissionManagement (await _permissionChecker.IsGrantedAsync( CreatePrincipal(PermissionTestDataBuilder.User2Id), "MyPermission1" - )).ShouldBeFalse(); + ).ConfigureAwait(false)).ShouldBeFalse(); } [Fact] @@ -41,7 +41,7 @@ namespace Volo.Abp.PermissionManagement (await _permissionChecker.IsGrantedAsync( CreatePrincipal(null), "MyPermission1" - )).ShouldBeFalse(); + ).ConfigureAwait(false)).ShouldBeFalse(); } [Fact] @@ -50,7 +50,7 @@ namespace Volo.Abp.PermissionManagement (await _permissionChecker.IsGrantedAsync( CreatePrincipal(PermissionTestDataBuilder.User1Id, Guid.NewGuid()), "MyPermission3" - )).ShouldBeFalse(); + ).ConfigureAwait(false)).ShouldBeFalse(); } private static ClaimsPrincipal CreatePrincipal(Guid? userId, Guid? tenantId = null) diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionDataSeeder_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionDataSeeder_Tests.cs index 6868421a8a..32ee6ff1cf 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionDataSeeder_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionDataSeeder_Tests.cs @@ -21,17 +21,17 @@ namespace Volo.Abp.PermissionManagement [Fact] public async Task SeedAsync() { - (await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test")).ShouldBeNull(); - (await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test")).ShouldBeNull(); + (await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test").ConfigureAwait(false)).ShouldBeNull(); + (await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test").ConfigureAwait(false)).ShouldBeNull(); await _permissionDataSeeder.SeedAsync("Test", "Test", new List() { "MyPermission1", "MyPermission2" - }); + }).ConfigureAwait(false); - (await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test")).ShouldNotBeNull(); - (await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test")).ShouldNotBeNull(); + (await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test").ConfigureAwait(false)).ShouldNotBeNull(); + (await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test").ConfigureAwait(false)).ShouldNotBeNull(); } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator_Tests.cs index 9d4248bb5a..7148fe9191 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator_Tests.cs @@ -28,17 +28,17 @@ namespace Volo.Abp.PermissionManagement { (await _cache.GetAsync(PermissionGrantCacheItem.CalculateCacheKey("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()))).ShouldBeNull(); + PermissionTestDataBuilder.User1Id.ToString())).ConfigureAwait(false)).ShouldBeNull(); await _permissionStore.IsGrantedAsync("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()); + PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); (await _cache.GetAsync(PermissionGrantCacheItem.CalculateCacheKey("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()))).ShouldNotBeNull(); + PermissionTestDataBuilder.User1Id.ToString())).ConfigureAwait(false)).ShouldNotBeNull(); } [Fact] @@ -47,17 +47,17 @@ namespace Volo.Abp.PermissionManagement // IsGrantedAsync will cache PermissionGrant await _permissionStore.IsGrantedAsync("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()); + PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); var permissionGrant = await _permissionGrantRepository.FindAsync("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()); + PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); permissionGrant.ShouldNotBeNull(); - await _permissionGrantRepository.DeleteAsync(permissionGrant); + await _permissionGrantRepository.DeleteAsync(permissionGrant).ConfigureAwait(false); (await _cache.GetAsync(PermissionGrantCacheItem.CalculateCacheKey("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()))).ShouldBeNull(); + PermissionTestDataBuilder.User1Id.ToString())).ConfigureAwait(false)).ShouldBeNull(); } } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManagementProvider_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManagementProvider_Tests.cs index aac1272ccd..1cbab007e3 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManagementProvider_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManagementProvider_Tests.cs @@ -29,11 +29,11 @@ namespace Volo.Abp.PermissionManagement "Test", "Test" ) - ); + ).ConfigureAwait(false); var permissionValueProviderGrantInfo = await _permissionManagementProvider.CheckAsync("MyPermission1", "Test", - "Test"); + "Test").ConfigureAwait(false); permissionValueProviderGrantInfo.IsGranted.ShouldBeTrue(); permissionValueProviderGrantInfo.ProviderKey.ShouldBe("Test"); @@ -44,7 +44,7 @@ namespace Volo.Abp.PermissionManagement { var permissionValueProviderGrantInfo = await _permissionManagementProvider.CheckAsync("MyPermission1", "TestNotExist", - "Test"); + "Test").ConfigureAwait(false); permissionValueProviderGrantInfo.IsGranted.ShouldBeFalse(); permissionValueProviderGrantInfo.ProviderKey.ShouldBeNull(); @@ -61,18 +61,18 @@ namespace Volo.Abp.PermissionManagement "Test", "Test" ) - ); + ).ConfigureAwait(false); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test")).ShouldNotBeNull(); + "Test").ConfigureAwait(false)).ShouldNotBeNull(); await _permissionManagementProvider.SetAsync("MyPermission1", "Test", - false); + false).ConfigureAwait(false); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test")).ShouldBeNull(); + "Test").ConfigureAwait(false)).ShouldBeNull(); } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs index b5fe647c89..6b838a4fc0 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs @@ -28,11 +28,11 @@ namespace Volo.Abp.PermissionManagement "MyPermission1", "Test", "Test") - ); + ).ConfigureAwait(false); var grantedProviders = await _permissionManager.GetAsync("MyPermission1", "Test", - "Test"); + "Test").ConfigureAwait(false); grantedProviders.ShouldNotBeNull(); grantedProviders.IsGranted.ShouldBeTrue(); @@ -46,7 +46,7 @@ namespace Volo.Abp.PermissionManagement await Assert.ThrowsAsync(async () => await _permissionManager.GetAsync( "MyPermission1NotExist", "Test", - "Test")); + "Test").ConfigureAwait(false)).ConfigureAwait(false); } [Fact] @@ -57,18 +57,18 @@ namespace Volo.Abp.PermissionManagement "MyPermission1", "Test", "Test") - ); + ).ConfigureAwait(false); await _permissionGrantRepository.InsertAsync(new PermissionGrant( Guid.NewGuid(), "MyPermission2", "Test", "Test") - ); + ).ConfigureAwait(false); var permissionWithGrantedProviders = await _permissionManager.GetAllAsync( "Test", - "Test"); + "Test").ConfigureAwait(false); permissionWithGrantedProviders.ShouldNotBeNull(); permissionWithGrantedProviders.ShouldContain(x => @@ -82,16 +82,16 @@ namespace Volo.Abp.PermissionManagement { (await _permissionGrantRepository.FindAsync("MyPermission2", "Test", - "Test")).ShouldBeNull(); + "Test").ConfigureAwait(false)).ShouldBeNull(); await _permissionManager.SetAsync( "MyPermission2", "Test", - "Test", true); + "Test", true).ConfigureAwait(false); (await _permissionGrantRepository.FindAsync("MyPermission2", "Test", - "Test")).ShouldNotBeNull(); + "Test").ConfigureAwait(false)).ShouldNotBeNull(); } [Fact] @@ -101,7 +101,7 @@ namespace Volo.Abp.PermissionManagement "MyPermission1NotExist", "Test", "Test", - true)); + true).ConfigureAwait(false)).ConfigureAwait(false); } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionStore_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionStore_Tests.cs index 965899ede9..f82b541e27 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionStore_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionStore_Tests.cs @@ -22,12 +22,12 @@ namespace Volo.Abp.PermissionManagement { (await _permissionStore.IsGrantedAsync("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString())).ShouldBeTrue(); + PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false)).ShouldBeTrue(); (await _permissionStore.IsGrantedAsync("MyPermission1NotExist", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString())).ShouldBeFalse(); + PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false)).ShouldBeFalse(); } } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItem.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItem.cs index a590775167..3511df204d 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItem.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItem.cs @@ -1,8 +1,10 @@ using System; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.SettingManagement { [Serializable] + [IgnoreMultiTenancy] public class SettingCacheItem { public string Value { get; set; } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItemInvalidator.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItemInvalidator.cs index 35d358a67d..419d0febcd 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItemInvalidator.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItemInvalidator.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.SettingManagement eventData.Entity.ProviderKey ); - await Cache.RemoveAsync(cacheKey); + await Cache.RemoveAsync(cacheKey).ConfigureAwait(false); } protected virtual string CalculateCacheKey(string name, string providerName, string providerKey) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementProvider.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementProvider.cs index 2859b2e7f4..b7410490f5 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementProvider.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementProvider.cs @@ -17,17 +17,17 @@ namespace Volo.Abp.SettingManagement public async Task GetOrNullAsync(SettingDefinition setting, string providerKey) { - return await SettingManagementStore.GetOrNullAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); + return await SettingManagementStore.GetOrNullAsync(setting.Name, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); } public virtual async Task SetAsync(SettingDefinition setting, string value, string providerKey) { - await SettingManagementStore.SetAsync(setting.Name, value, Name, NormalizeProviderKey(providerKey)); + await SettingManagementStore.SetAsync(setting.Name, value, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); } public virtual async Task ClearAsync(SettingDefinition setting, string providerKey) { - await SettingManagementStore.DeleteAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); + await SettingManagementStore.DeleteAsync(setting.Name, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); } protected virtual string NormalizeProviderKey(string providerKey) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementStore.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementStore.cs index 8c9cfc8684..622ea4a705 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementStore.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementStore.cs @@ -26,58 +26,58 @@ namespace Volo.Abp.SettingManagement public async Task GetOrNullAsync(string name, string providerName, string providerKey) { - var cacheItem = await GetCacheItemAsync(name, providerName, providerKey); + var cacheItem = await GetCacheItemAsync(name, providerName, providerKey).ConfigureAwait(false); return cacheItem.Value; } public async Task SetAsync(string name, string value, string providerName, string providerKey) { - var setting = await SettingRepository.FindAsync(name, providerName, providerKey); + var setting = await SettingRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); if (setting == null) { setting = new Setting(GuidGenerator.Create(), name, value, providerName, providerKey); - await SettingRepository.InsertAsync(setting); + await SettingRepository.InsertAsync(setting).ConfigureAwait(false); } else { setting.Value = value; - await SettingRepository.UpdateAsync(setting); + await SettingRepository.UpdateAsync(setting).ConfigureAwait(false); } } public async Task> GetListAsync(string providerName, string providerKey) { - var settings = await SettingRepository.GetListAsync(providerName, providerKey); + var settings = await SettingRepository.GetListAsync(providerName, providerKey).ConfigureAwait(false); return settings.Select(s => new SettingValue(s.Name, s.Value)).ToList(); } public async Task DeleteAsync(string name, string providerName, string providerKey) { - var setting = await SettingRepository.FindAsync(name, providerName, providerKey); + var setting = await SettingRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); if (setting != null) { - await SettingRepository.DeleteAsync(setting); + await SettingRepository.DeleteAsync(setting).ConfigureAwait(false); } } protected virtual async Task GetCacheItemAsync(string name, string providerName, string providerKey) { var cacheKey = CalculateCacheKey(name, providerName, providerKey); - var cacheItem = await Cache.GetAsync(cacheKey); + var cacheItem = await Cache.GetAsync(cacheKey).ConfigureAwait(false); if (cacheItem != null) { return cacheItem; } - var setting = await SettingRepository.FindAsync(name, providerName, providerKey); + var setting = await SettingRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); cacheItem = new SettingCacheItem(setting?.Value); await Cache.SetAsync( cacheKey, cacheItem - ); + ).ConfigureAwait(false); return cacheItem; } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs index cfb4cccbe3..e5cdcb4466 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs @@ -79,7 +79,7 @@ namespace Volo.Abp.SettingManagement var providerValue = await provider.GetOrNullAsync( setting, provider.Name == providerName ? providerKey : null - ); + ).ConfigureAwait(false); if (providerValue != null) { value = providerValue; @@ -91,7 +91,7 @@ namespace Volo.Abp.SettingManagement value = await providerList[0].GetOrNullAsync( setting, providerKey - ); + ).ConfigureAwait(false); } if (setting.IsEncrypted) @@ -132,7 +132,7 @@ namespace Volo.Abp.SettingManagement if (providers.Count > 1 && !forceToSet && setting.IsInherited && value != null) { - var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); + var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null).ConfigureAwait(false); if (fallbackValue == value) { //Clear the value if it's same as it's fallback value @@ -148,14 +148,14 @@ namespace Volo.Abp.SettingManagement { foreach (var provider in providers) { - await provider.ClearAsync(setting, providerKey); + await provider.ClearAsync(setting, providerKey).ConfigureAwait(false); } } else { foreach (var provider in providers) { - await provider.SetAsync(setting, value, providerKey); + await provider.SetAsync(setting, value, providerKey).ConfigureAwait(false); } } } @@ -182,7 +182,7 @@ namespace Volo.Abp.SettingManagement value = await provider.GetOrNullAsync( setting, provider.Name == providerName ? providerKey : null - ); + ).ConfigureAwait(false); if (value != null) { diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs index 86b31036d1..bd848ce076 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.SettingManagement.EntityFrameworkCore return await DbSet .FirstOrDefaultAsync( s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey - ); + ).ConfigureAwait(false); } public async Task> GetListAsync(string providerName, string providerKey) @@ -28,7 +28,7 @@ namespace Volo.Abp.SettingManagement.EntityFrameworkCore return await DbSet .Where( s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(); + ).ToListAsync().ConfigureAwait(false); } } } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs index 56516dcbd0..e08c099eaa 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs @@ -18,12 +18,12 @@ namespace Volo.Abp.SettingManagement.MongoDB public async Task FindAsync(string name, string providerName, string providerKey) { - return await GetMongoQueryable().FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey); + return await GetMongoQueryable().FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey).ConfigureAwait(false); } public async Task> GetListAsync(string providerName, string providerKey) { - return await GetMongoQueryable().Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey).ToListAsync(); + return await GetMongoQueryable().Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey).ToListAsync().ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs index 8aee74c56c..1dc8030bd8 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.SettingManagement.Web.Navigation var settingPageCreationContext = new SettingPageCreationContext(context.ServiceProvider); if ( !settingManagementPageOptions.Contributors.Any() || - !(await CheckAnyOfPagePermissionsGranted(settingManagementPageOptions, settingPageCreationContext)) + !(await CheckAnyOfPagePermissionsGranted(settingManagementPageOptions, settingPageCreationContext).ConfigureAwait(false)) ) { return; @@ -49,7 +49,7 @@ namespace Volo.Abp.SettingManagement.Web.Navigation { foreach (var contributor in settingManagementPageOptions.Contributors) { - if (await contributor.CheckPermissionsAsync(settingPageCreationContext)) + if (await contributor.CheckPermissionsAsync(settingPageCreationContext).ConfigureAwait(false)) { return true; } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs index 1fdba05707..401d845039 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement foreach (var contributor in _options.Contributors) { - await contributor.ConfigureAsync(SettingPageCreationContext); + await contributor.ConfigureAsync(SettingPageCreationContext).ConfigureAwait(false); } } } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingManagementTestBase.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingManagementTestBase.cs index c6deeba0fc..002c1b95da 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingManagementTestBase.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingManagementTestBase.cs @@ -1,4 +1,5 @@ using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace Volo.Abp.SettingManagement { diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs index 5dad99a0ca..6d8be6fe8a 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs @@ -26,25 +26,25 @@ namespace Volo.Abp.SettingManagement "MySetting1", GlobalSettingValueProvider.ProviderName, null - )).Value.ShouldBe("42"); + ).ConfigureAwait(false)).Value.ShouldBe("42"); (await SettingRepository.FindAsync( "MySetting2", UserSettingValueProvider.ProviderName, TestData.User1Id.ToString() - )).Value.ShouldBe("user1-store-value"); + ).ConfigureAwait(false)).Value.ShouldBe("user1-store-value"); (await SettingRepository.FindAsync( "Undefined-Setting", GlobalSettingValueProvider.ProviderName, null - )).ShouldBeNull(); + ).ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task GetListAsync() { - var settings = await SettingRepository.GetListAsync(GlobalSettingValueProvider.ProviderName, null); + var settings = await SettingRepository.GetListAsync(GlobalSettingValueProvider.ProviderName, null).ConfigureAwait(false); settings.Any().ShouldBeTrue(); settings.ShouldContain(s => s.Name == "MySetting1" && s.Value == "42"); settings.ShouldContain(s => s.Name == "MySetting2" && s.Value == "default-store-value"); diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs index a4a0b32a03..d89111bd82 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.SettingManagement "42", GlobalSettingValueProvider.ProviderName ) - ); + ).ConfigureAwait(false); await _settingRepository.InsertAsync( new Setting( @@ -39,7 +39,7 @@ namespace Volo.Abp.SettingManagement "default-store-value", GlobalSettingValueProvider.ProviderName ) - ); + ).ConfigureAwait(false); await _settingRepository.InsertAsync( new Setting( @@ -49,7 +49,7 @@ namespace Volo.Abp.SettingManagement UserSettingValueProvider.ProviderName, _testData.User1Id.ToString() ) - ); + ).ConfigureAwait(false); await _settingRepository.InsertAsync( new Setting( @@ -59,7 +59,7 @@ namespace Volo.Abp.SettingManagement UserSettingValueProvider.ProviderName, _testData.User2Id.ToString() ) - ); + ).ConfigureAwait(false); await _settingRepository.InsertAsync( new Setting( @@ -68,7 +68,7 @@ namespace Volo.Abp.SettingManagement "default-store-value", GlobalSettingValueProvider.ProviderName ) - ); + ).ConfigureAwait(false); await _settingRepository.InsertAsync( new Setting( @@ -78,7 +78,7 @@ namespace Volo.Abp.SettingManagement UserSettingValueProvider.ProviderName, _testData.User1Id.ToString() ) - ); + ).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/DefaultValueSettingManagementProvider_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/DefaultValueSettingManagementProvider_Tests.cs index 20263a73c9..216ebf6283 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/DefaultValueSettingManagementProvider_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/DefaultValueSettingManagementProvider_Tests.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.SettingManagement var defaultValueSettingManagementProvider = new DefaultValueSettingManagementProvider(); (await defaultValueSettingManagementProvider - .GetOrNullAsync(mySetting3, DefaultValueSettingValueProvider.ProviderName)).ShouldBe("123"); + .GetOrNullAsync(mySetting3, DefaultValueSettingValueProvider.ProviderName).ConfigureAwait(false)).ShouldBe("123"); } [Fact] @@ -30,7 +30,7 @@ namespace Volo.Abp.SettingManagement var mySetting3 = _settingDefinitionManager.Get("MySetting3"); await Assert.ThrowsAsync(async () => await new DefaultValueSettingManagementProvider().SetAsync(mySetting3, "123", - DefaultValueSettingValueProvider.ProviderName)); + DefaultValueSettingValueProvider.ProviderName).ConfigureAwait(false)).ConfigureAwait(false); } [Fact] @@ -40,7 +40,7 @@ namespace Volo.Abp.SettingManagement await Assert.ThrowsAsync(async () => await new DefaultValueSettingManagementProvider().ClearAsync(mySetting3, - DefaultValueSettingValueProvider.ProviderName)); + DefaultValueSettingValueProvider.ProviderName).ConfigureAwait(false)).ConfigureAwait(false); } } } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs index 2a458a1739..cf2c610b79 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs @@ -1,10 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System; using System.Threading.Tasks; -using Castle.DynamicProxy.Generators; using Shouldly; using Volo.Abp.Caching; +using Volo.Abp.MultiTenancy; using Volo.Abp.Settings; using Xunit; @@ -16,6 +14,7 @@ namespace Volo.Abp.SettingManagement private readonly ISettingManagementStore _settingManagementStore; private readonly ISettingRepository _settingRepository; private readonly SettingTestData _testData; + private readonly ICurrentTenant _currentTenant; public SettingCacheItemInvalidator_Tests() { @@ -23,15 +22,16 @@ namespace Volo.Abp.SettingManagement _cache = GetRequiredService>(); _settingRepository = GetRequiredService(); _testData = GetRequiredService(); + _currentTenant = GetRequiredService(); } [Fact] public async Task GetOrNullAsync_Should_Cached() { // Act - (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()))).ShouldBeNull(); - await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()); - (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()))).ShouldNotBeNull(); + (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString())).ConfigureAwait(false)).ShouldBeNull(); + await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()).ConfigureAwait(false); + (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString())).ConfigureAwait(false)).ShouldNotBeNull(); } [Fact] @@ -39,15 +39,45 @@ namespace Volo.Abp.SettingManagement { // Arrange // GetOrNullAsync will cache language. - await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()); + await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()).ConfigureAwait(false); // Act - var lang = await _settingRepository.FindAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()); - await _settingRepository.DeleteAsync(lang); + var lang = await _settingRepository.FindAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()).ConfigureAwait(false); + await _settingRepository.DeleteAsync(lang).ConfigureAwait(false); // Assert (await _cache.GetAsync( - SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()))).ShouldBeNull(); + SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString())).ConfigureAwait(false)).ShouldBeNull(); + } + + [Fact] + public async Task Cache_Should_Invalidator_WhenSettingChanged_Between_Tenant_And_Host() + { + var tenantId = Guid.NewGuid(); + + using (_currentTenant.Change(tenantId)) + { + // GetOrNullAsync will cache language. + await _settingManagementStore + .GetOrNullAsync("MySetting2", GlobalSettingValueProvider.ProviderName, null) + .ConfigureAwait(false); + } + + using (_currentTenant.Change(null)) + { + // SetAsync will make cache invalid. + await _settingManagementStore + .SetAsync("MySetting2", "MySetting2Value", GlobalSettingValueProvider.ProviderName, null) + .ConfigureAwait(false); + } + + using (_currentTenant.Change(tenantId)) + { + // Assert + (await _cache.GetAsync( + SettingCacheItem.CalculateCacheKey("MySetting2", GlobalSettingValueProvider.ProviderName, null)) + .ConfigureAwait(false)).ShouldBeNull(); + } } } } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManagementStore_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManagementStore_Tests.cs index 753ba15054..99ca9e70da 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManagementStore_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManagementStore_Tests.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.SettingManagement public async Task GetOrNull_NotExist_Should_Be_Null() { var value = await _settingManagementStore.GetOrNullAsync("notExistName", "notExistProviderName", - "notExistProviderKey"); + "notExistProviderKey").ConfigureAwait(false); value.ShouldBeNull(); } @@ -33,7 +33,7 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task GetOrNullAsync() { - var value = await _settingManagementStore.GetOrNullAsync("MySetting1", GlobalSettingValueProvider.ProviderName, null); + var value = await _settingManagementStore.GetOrNullAsync("MySetting1", GlobalSettingValueProvider.ProviderName, null).ConfigureAwait(false); value.ShouldNotBeNull(); value.ShouldBe("42"); @@ -42,22 +42,22 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task SetAsync() { - var setting = await _settingRepository.FindAsync(_testData.SettingId); + var setting = await _settingRepository.FindAsync(_testData.SettingId).ConfigureAwait(false); setting.Value.ShouldBe("42"); - await _settingManagementStore.SetAsync("MySetting1", "43", GlobalSettingValueProvider.ProviderName, null); + await _settingManagementStore.SetAsync("MySetting1", "43", GlobalSettingValueProvider.ProviderName, null).ConfigureAwait(false); - (await _settingRepository.FindAsync(_testData.SettingId)).Value.ShouldBe("43"); + (await _settingRepository.FindAsync(_testData.SettingId).ConfigureAwait(false)).Value.ShouldBe("43"); } [Fact] public async Task DeleteAsync() { - (await _settingRepository.FindAsync(_testData.SettingId)).ShouldNotBeNull(); + (await _settingRepository.FindAsync(_testData.SettingId).ConfigureAwait(false)).ShouldNotBeNull(); - await _settingManagementStore.DeleteAsync("MySetting1", GlobalSettingValueProvider.ProviderName, null); + await _settingManagementStore.DeleteAsync("MySetting1", GlobalSettingValueProvider.ProviderName, null).ConfigureAwait(false); - (await _settingRepository.FindAsync(_testData.SettingId)).ShouldBeNull(); + (await _settingRepository.FindAsync(_testData.SettingId).ConfigureAwait(false)).ShouldBeNull(); } } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_Basic_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_Basic_Tests.cs index 1dafc31570..b9efa5640f 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_Basic_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_Basic_Tests.cs @@ -21,26 +21,26 @@ namespace Volo.Abp.SettingManagement { await Assert.ThrowsAsync( async () => await _settingProvider.GetOrNullAsync("UndefinedSetting") - ); +.ConfigureAwait(false)).ConfigureAwait(false); } [Fact] public async Task Should_Get_Default_Value_If_Not_Set_In_Store() { - var value = await _settingProvider.GetOrNullAsync("SettingNotSetInStore"); + var value = await _settingProvider.GetOrNullAsync("SettingNotSetInStore").ConfigureAwait(false); value.ShouldBe("default-value"); } [Fact] public async Task Should_Get_Base_Store_Value() { - (await _settingProvider.GetOrNullAsync("MySetting1")).ShouldBe("42"); + (await _settingProvider.GetOrNullAsync("MySetting1").ConfigureAwait(false)).ShouldBe("42"); } [Fact] public async Task Should_Get_All_Base_Store_Values() { - var settingValues = await _settingProvider.GetAllAsync(); + var settingValues = await _settingProvider.GetAllAsync().ConfigureAwait(false); settingValues.ShouldContain(sv => sv.Name == "MySetting1" && sv.Value == "42"); settingValues.ShouldContain(sv => sv.Name == "MySetting2" && sv.Value == "default-store-value"); settingValues.ShouldContain(sv => sv.Name == "SettingNotSetInStore" && sv.Value == "default-value"); @@ -49,10 +49,10 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Set_Global_Value() { - await _settingManager.SetGlobalAsync("MySetting1", "43"); + await _settingManager.SetGlobalAsync("MySetting1", "43").ConfigureAwait(false); - (await _settingManager.GetOrNullGlobalAsync("MySetting1")).ShouldBe("43"); - (await _settingProvider.GetOrNullAsync("MySetting1")).ShouldBe("43"); + (await _settingManager.GetOrNullGlobalAsync("MySetting1").ConfigureAwait(false)).ShouldBe("43"); + (await _settingProvider.GetOrNullAsync("MySetting1").ConfigureAwait(false)).ShouldBe("43"); } } } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_User_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_User_Tests.cs index 4b42572f0a..d49ca823f1 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_User_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_User_Tests.cs @@ -35,67 +35,67 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Get_From_Store_For_Given_User() { - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)).ShouldBe("user1-store-value"); - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User2Id)).ShouldBe("user2-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)).ShouldBe("user1-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User2Id).ConfigureAwait(false)).ShouldBe("user2-store-value"); } [Fact] public async Task Should_Fallback_To_Default_Store_Value_When_No_Value_For_Given_User() { - (await _settingManager.GetOrNullForUserAsync("MySetting2", Guid.NewGuid())).ShouldBe("default-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySetting2", Guid.NewGuid()).ConfigureAwait(false)).ShouldBe("default-store-value"); } [Fact] public async Task Should_Not_Fallback_To_Default_Store_Value_When_No_Value_For_Given_User_But_Specified_Fallback_As_False() { - (await _settingManager.GetOrNullForUserAsync("MySetting2", Guid.NewGuid(), fallback: false)).ShouldBeNull(); + (await _settingManager.GetOrNullForUserAsync("MySetting2", Guid.NewGuid(), fallback: false).ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task Should_Get_From_Store_For_Current_User() { _currentUserId = _testData.User1Id; - (await _settingProvider.GetOrNullAsync("MySetting2")).ShouldBe("user1-store-value"); + (await _settingProvider.GetOrNullAsync("MySetting2").ConfigureAwait(false)).ShouldBe("user1-store-value"); _currentUserId = _testData.User2Id; - (await _settingProvider.GetOrNullAsync("MySetting2")).ShouldBe("user2-store-value"); + (await _settingProvider.GetOrNullAsync("MySetting2").ConfigureAwait(false)).ShouldBe("user2-store-value"); } [Fact] public async Task Should_Fallback_To_Default_Store_Value_When_No_Value_For_Current_User() { _currentUserId = Guid.NewGuid(); - (await _settingProvider.GetOrNullAsync("MySetting2")).ShouldBe("default-store-value"); + (await _settingProvider.GetOrNullAsync("MySetting2").ConfigureAwait(false)).ShouldBe("default-store-value"); } [Fact] public async Task Should_Get_From_Store_For_Current_User_With_GetOrNullForCurrentUserAsync() { _currentUserId = _testData.User1Id; - (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2")).ShouldBe("user1-store-value"); + (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2").ConfigureAwait(false)).ShouldBe("user1-store-value"); _currentUserId = _testData.User2Id; - (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2")).ShouldBe("user2-store-value"); + (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2").ConfigureAwait(false)).ShouldBe("user2-store-value"); } [Fact] public async Task Should_Fallback_To_Default_Store_Value_When_No_Value_For_Current_User_With_GetOrNullForCurrentUserAsync() { _currentUserId = Guid.NewGuid(); - (await _settingProvider.GetOrNullAsync("MySetting2")).ShouldBe("default-store-value"); + (await _settingProvider.GetOrNullAsync("MySetting2").ConfigureAwait(false)).ShouldBe("default-store-value"); } [Fact] public async Task Should_Not_Fallback_To_Default_Store_Value_When_No_Value_For_Current_User_But_Specified_Fallback_As_False() { _currentUserId = Guid.NewGuid(); - (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2", fallback: false)).ShouldBeNull(); + (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2", fallback: false).ConfigureAwait(false)).ShouldBeNull(); } [Fact] public async Task Should_Get_All_From_Store_For_Given_User() { - var settingValues = await _settingManager.GetAllForUserAsync(_testData.User1Id); + var settingValues = await _settingManager.GetAllForUserAsync(_testData.User1Id).ConfigureAwait(false); settingValues.ShouldContain(sv => sv.Name == "MySetting1" && sv.Value == "42"); settingValues.ShouldContain(sv => sv.Name == "MySetting2" && sv.Value == "user1-store-value"); settingValues.ShouldContain(sv => sv.Name == "SettingNotSetInStore" && sv.Value == "default-value"); @@ -104,7 +104,7 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Get_All_From_Store_For_Given_User_Without_Fallback() { - var settingValues = await _settingManager.GetAllForUserAsync(_testData.User1Id, fallback: false); + var settingValues = await _settingManager.GetAllForUserAsync(_testData.User1Id, fallback: false).ConfigureAwait(false); settingValues.ShouldContain(sv => sv.Name == "MySetting2" && sv.Value == "user1-store-value"); settingValues.ShouldContain(sv => sv.Name == "MySettingWithoutInherit" && sv.Value == "user1-store-value"); settingValues.ShouldNotContain(sv => sv.Name == "MySetting1"); @@ -113,7 +113,7 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Delete_Setting_Record_When_Set_To_Null() { - await _settingManager.SetForUserAsync(_testData.User1Id, "MySetting2", null); + await _settingManager.SetForUserAsync(_testData.User1Id, "MySetting2", null).ConfigureAwait(false); GetSettingsFromDbContext( UserSettingValueProvider.ProviderName, @@ -125,12 +125,12 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Change_User_Setting() { - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)) + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)) .ShouldBe("user1-store-value"); - await _settingManager.SetForUserAsync(_testData.User1Id, "MySetting2", "user1-new-store-value"); + await _settingManager.SetForUserAsync(_testData.User1Id, "MySetting2", "user1-new-store-value").ConfigureAwait(false); - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)) + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)) .ShouldBe("user1-new-store-value"); GetSettingsFromDbContext( @@ -147,7 +147,7 @@ namespace Volo.Abp.SettingManagement _testData.User1Id, "MySetting2", "default-store-value" - ); + ).ConfigureAwait(false); GetSettingsFromDbContext( UserSettingValueProvider.ProviderName, @@ -155,7 +155,7 @@ namespace Volo.Abp.SettingManagement "MySetting2" ).Count.ShouldBe(0); - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)) + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)) .ShouldBe("default-store-value"); } @@ -167,7 +167,7 @@ namespace Volo.Abp.SettingManagement "MySetting2", "default-store-value", forceToSet: true - ); + ).ConfigureAwait(false); GetSettingsFromDbContext( UserSettingValueProvider.ProviderName, @@ -175,16 +175,16 @@ namespace Volo.Abp.SettingManagement "MySetting2" ).Single().Value.ShouldBe("default-store-value"); - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)) + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)) .ShouldBe("default-store-value"); } [Fact] public async Task Should_Get_For_Given_User_For_Non_Inherited_Setting() { - (await _settingManager.GetOrNullForUserAsync("MySettingWithoutInherit", _testData.User1Id)).ShouldBe("user1-store-value"); - (await _settingManager.GetOrNullForUserAsync("MySettingWithoutInherit", _testData.User2Id)).ShouldBeNull(); //Does not inherit! - (await _settingManager.GetOrNullGlobalAsync("MySettingWithoutInherit")).ShouldBe("default-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySettingWithoutInherit", _testData.User1Id).ConfigureAwait(false)).ShouldBe("user1-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySettingWithoutInherit", _testData.User2Id).ConfigureAwait(false)).ShouldBeNull(); //Does not inherit! + (await _settingManager.GetOrNullGlobalAsync("MySettingWithoutInherit").ConfigureAwait(false)).ShouldBe("default-store-value"); } } } \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantAppService.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantAppService.cs index b8a0d827ed..084c6c1920 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantAppService.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantAppService.cs @@ -27,14 +27,13 @@ namespace Volo.Abp.TenantManagement public virtual async Task GetAsync(Guid id) { return ObjectMapper.Map( - await TenantRepository.GetAsync(id) - ); + await TenantRepository.GetAsync(id).ConfigureAwait(false)); } public virtual async Task> GetListAsync(GetTenantsInput input) { - var count = await TenantRepository.GetCountAsync(input.Filter); - var list = await TenantRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); + var count = await TenantRepository.GetCountAsync(input.Filter).ConfigureAwait(false); + var list = await TenantRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter).ConfigureAwait(false); return new PagedResultDto( count, @@ -45,15 +44,15 @@ namespace Volo.Abp.TenantManagement [Authorize(TenantManagementPermissions.Tenants.Create)] public virtual async Task CreateAsync(TenantCreateDto input) { - var tenant = await TenantManager.CreateAsync(input.Name); - await TenantRepository.InsertAsync(tenant); + var tenant = await TenantManager.CreateAsync(input.Name).ConfigureAwait(false); + await TenantRepository.InsertAsync(tenant).ConfigureAwait(false); using (CurrentTenant.Change(tenant.Id, tenant.Name)) { //TODO: Handle database creation? //TODO: Set admin email & password..? - await DataSeeder.SeedAsync(tenant.Id); + await DataSeeder.SeedAsync(tenant.Id).ConfigureAwait(false); } return ObjectMapper.Map(tenant); @@ -62,45 +61,45 @@ namespace Volo.Abp.TenantManagement [Authorize(TenantManagementPermissions.Tenants.Update)] public virtual async Task UpdateAsync(Guid id, TenantUpdateDto input) { - var tenant = await TenantRepository.GetAsync(id); - await TenantManager.ChangeNameAsync(tenant, input.Name); - await TenantRepository.UpdateAsync(tenant); + var tenant = await TenantRepository.GetAsync(id).ConfigureAwait(false); + await TenantManager.ChangeNameAsync(tenant, input.Name).ConfigureAwait(false); + await TenantRepository.UpdateAsync(tenant).ConfigureAwait(false); return ObjectMapper.Map(tenant); } [Authorize(TenantManagementPermissions.Tenants.Delete)] public virtual async Task DeleteAsync(Guid id) { - var tenant = await TenantRepository.FindAsync(id); + var tenant = await TenantRepository.FindAsync(id).ConfigureAwait(false); if (tenant == null) { return; } - await TenantRepository.DeleteAsync(tenant); + await TenantRepository.DeleteAsync(tenant).ConfigureAwait(false); } [Authorize(TenantManagementPermissions.Tenants.ManageConnectionStrings)] public virtual async Task GetDefaultConnectionStringAsync(Guid id) { - var tenant = await TenantRepository.GetAsync(id); + var tenant = await TenantRepository.GetAsync(id).ConfigureAwait(false); return tenant?.FindDefaultConnectionString(); } [Authorize(TenantManagementPermissions.Tenants.ManageConnectionStrings)] public virtual async Task UpdateDefaultConnectionStringAsync(Guid id, string defaultConnectionString) { - var tenant = await TenantRepository.GetAsync(id); + var tenant = await TenantRepository.GetAsync(id).ConfigureAwait(false); tenant.SetDefaultConnectionString(defaultConnectionString); - await TenantRepository.UpdateAsync(tenant); + await TenantRepository.UpdateAsync(tenant).ConfigureAwait(false); } [Authorize(TenantManagementPermissions.Tenants.ManageConnectionStrings)] public virtual async Task DeleteDefaultConnectionStringAsync(Guid id) { - var tenant = await TenantRepository.GetAsync(id); + var tenant = await TenantRepository.GetAsync(id).ConfigureAwait(false); tenant.RemoveDefaultConnectionString(); - await TenantRepository.UpdateAsync(tenant); + await TenantRepository.UpdateAsync(tenant).ConfigureAwait(false); } } } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo.Abp.TenantManagement.Domain.Shared.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo.Abp.TenantManagement.Domain.Shared.csproj index dec1cabd46..5cdaa28369 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo.Abp.TenantManagement.Domain.Shared.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo.Abp.TenantManagement.Domain.Shared.csproj @@ -19,7 +19,7 @@ - + diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/AbpTenantManagementDomainSharedModule.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/AbpTenantManagementDomainSharedModule.cs index 2058ae5425..158a78b0cb 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/AbpTenantManagementDomainSharedModule.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/AbpTenantManagementDomainSharedModule.cs @@ -1,11 +1,13 @@ using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.TenantManagement.Localization; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.TenantManagement { + [DependsOn(typeof(AbpValidationModule))] public class AbpTenantManagementDomainSharedModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantManager.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantManager.cs index 79d7cf891e..fbc422c31a 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantManager.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantManager.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.TenantManagement { Check.NotNull(name, nameof(name)); - await ValidateNameAsync(name); + await ValidateNameAsync(name).ConfigureAwait(false); return new Tenant(GuidGenerator.Create(), name); } @@ -28,13 +28,13 @@ namespace Volo.Abp.TenantManagement Check.NotNull(tenant, nameof(tenant)); Check.NotNull(name, nameof(name)); - await ValidateNameAsync(name, tenant.Id); + await ValidateNameAsync(name, tenant.Id).ConfigureAwait(false); tenant.SetName(name); } protected virtual async Task ValidateNameAsync(string name, Guid? expectedId = null) { - var tenant = await _tenantRepository.FindByNameAsync(name); + var tenant = await _tenantRepository.FindByNameAsync(name).ConfigureAwait(false); if (tenant != null && tenant.Id != expectedId) { throw new UserFriendlyException("Duplicate tenancy name: " + name); //TODO: A domain exception would be better..? diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs index afa9af0cf2..234f23959a 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.TenantManagement { using (_currentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! { - var tenant = await _tenantRepository.FindByNameAsync(name); + var tenant = await _tenantRepository.FindByNameAsync(name).ConfigureAwait(false); if (tenant == null) { return null; @@ -42,7 +42,7 @@ namespace Volo.Abp.TenantManagement { using (_currentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! { - var tenant = await _tenantRepository.FindAsync(id); + var tenant = await _tenantRepository.FindAsync(id).ConfigureAwait(false); if (tenant == null) { return null; diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs index e211f81abf..a6deb69f4c 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore { return await DbSet .IncludeDetails(includeDetails) - .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public Tenant FindByName(string name, bool includeDetails = true) @@ -59,7 +59,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore ) .OrderBy(sorting ?? nameof(Tenant.Name)) .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs index 1d57652833..21e5ab9b1d 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.TenantManagement.MongoDB CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)); + .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public Tenant FindByName(string name, bool includeDetails = true) @@ -57,7 +57,7 @@ namespace Volo.Abp.TenantManagement.MongoDB .OrderBy(sorting ?? nameof(Tenant.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs index a3f066594e..0094b7d5ad 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs @@ -1,13 +1,9 @@ -using Localization.Resources.AbpUi; -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AutoMapper; using Volo.Abp.FeatureManagement; -using Volo.Abp.FeatureManagement.Localization; -using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.TenantManagement.Localization; using Volo.Abp.TenantManagement.Web.Navigation; diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs index b7ef9f277e..2ca66c1485 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.TenantManagement.Web.Navigation var tenantManagementMenuItem = new ApplicationMenuItem(TenantManagementMenuNames.GroupName, l["Menu:TenantManagement"], icon: "fa fa-users"); administrationMenu.AddItem(tenantManagementMenuItem); - if (await authorizationService.IsGrantedAsync(TenantManagementPermissions.Tenants.Default)) + if (await authorizationService.IsGrantedAsync(TenantManagementPermissions.Tenants.Default).ConfigureAwait(false)) { tenantManagementMenuItem.AddItem(new ApplicationMenuItem(TenantManagementMenuNames.Tenants, l["Tenants"], url: "/TenantManagement/Tenants")); } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs index 481cc6b7ca..7814d7c018 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants public async Task OnGetAsync(Guid id) { - var defaultConnectionString = await _tenantAppService.GetDefaultConnectionStringAsync(id); + var defaultConnectionString = await _tenantAppService.GetDefaultConnectionStringAsync(id).ConfigureAwait(false); Tenant = new TenantInfoModel { Id = id, @@ -35,11 +35,11 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants if (Tenant.UseSharedDatabase || Tenant.DefaultConnectionString.IsNullOrWhiteSpace()) { - await _tenantAppService.DeleteDefaultConnectionStringAsync(Tenant.Id); + await _tenantAppService.DeleteDefaultConnectionStringAsync(Tenant.Id).ConfigureAwait(false); } else { - await _tenantAppService.UpdateDefaultConnectionStringAsync(Tenant.Id, Tenant.DefaultConnectionString); + await _tenantAppService.UpdateDefaultConnectionStringAsync(Tenant.Id, Tenant.DefaultConnectionString).ConfigureAwait(false); } return NoContent(); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs index a602b12a65..1ac1e7b97d 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants ValidateModel(); var input = ObjectMapper.Map(Tenant); - await _tenantAppService.CreateAsync(input); + await _tenantAppService.CreateAsync(input).ConfigureAwait(false); return NoContent(); } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs index 58516e8ff7..f3bdb8f95f 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants { Tenant = ObjectMapper.Map( await _tenantAppService.GetAsync(id) - ); +.ConfigureAwait(false)); } public async Task OnPostAsync() @@ -30,7 +30,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants ValidateModel(); var input = ObjectMapper.Map(Tenant); - await _tenantAppService.UpdateAsync(Tenant.Id, input); + await _tenantAppService.UpdateAsync(Tenant.Id, input).ConfigureAwait(false); return NoContent(); } diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo/Abp/TenantManagement/TenantAppService_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo/Abp/TenantManagement/TenantAppService_Tests.cs index 3e44e7c8ea..99318e52e4 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo/Abp/TenantManagement/TenantAppService_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo/Abp/TenantManagement/TenantAppService_Tests.cs @@ -20,14 +20,14 @@ namespace Volo.Abp.TenantManagement public async Task GetAsync() { var tenantInDb = UsingDbContext(dbContext => dbContext.Tenants.First()); - var tenant = await _tenantAppService.GetAsync(tenantInDb.Id); + var tenant = await _tenantAppService.GetAsync(tenantInDb.Id).ConfigureAwait(false); tenant.Name.ShouldBe(tenantInDb.Name); } [Fact] public async Task GetListAsync() { - var result = await _tenantAppService.GetListAsync(new GetTenantsInput()); + var result = await _tenantAppService.GetListAsync(new GetTenantsInput()).ConfigureAwait(false); result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldContain(t => t.Name == "acme"); result.Items.ShouldContain(t => t.Name == "volosoft"); @@ -36,7 +36,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task GetListAsync_Filtered() { - var result = await _tenantAppService.GetListAsync(new GetTenantsInput { Filter = "volo" }); + var result = await _tenantAppService.GetListAsync(new GetTenantsInput { Filter = "volo" }).ConfigureAwait(false); result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldNotContain(t => t.Name == "acme"); result.Items.ShouldContain(t => t.Name == "volosoft"); @@ -45,7 +45,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task GetListAsync_Sorted_Descending_By_Name() { - var result = await _tenantAppService.GetListAsync(new GetTenantsInput { Sorting = "Name DESC" }); + var result = await _tenantAppService.GetListAsync(new GetTenantsInput { Sorting = "Name DESC" }).ConfigureAwait(false); result.TotalCount.ShouldBeGreaterThan(0); var tenants = result.Items.ToList(); @@ -59,7 +59,7 @@ namespace Volo.Abp.TenantManagement public async Task CreateAsync() { var tenancyName = Guid.NewGuid().ToString("N").ToLowerInvariant(); - var tenant = await _tenantAppService.CreateAsync(new TenantCreateDto { Name = tenancyName }); + var tenant = await _tenantAppService.CreateAsync(new TenantCreateDto { Name = tenancyName }).ConfigureAwait(false); tenant.Name.ShouldBe(tenancyName); tenant.Id.ShouldNotBe(default(Guid)); } @@ -69,8 +69,8 @@ namespace Volo.Abp.TenantManagement { await Assert.ThrowsAsync(async () => { - await _tenantAppService.CreateAsync(new TenantCreateDto { Name = "acme" }); - }); + await _tenantAppService.CreateAsync(new TenantCreateDto { Name = "acme" }).ConfigureAwait(false); + }).ConfigureAwait(false); } [Fact] @@ -78,7 +78,7 @@ namespace Volo.Abp.TenantManagement { var acme = UsingDbContext(dbContext => dbContext.Tenants.Single(t => t.Name == "acme")); - var result = await _tenantAppService.UpdateAsync(acme.Id, new TenantUpdateDto { Name = "acme-renamed" }); + var result = await _tenantAppService.UpdateAsync(acme.Id, new TenantUpdateDto { Name = "acme-renamed" }).ConfigureAwait(false); result.Id.ShouldBe(acme.Id); result.Name.ShouldBe("acme-renamed"); @@ -93,8 +93,8 @@ namespace Volo.Abp.TenantManagement await Assert.ThrowsAsync(async () => { - await _tenantAppService.UpdateAsync(acme.Id, new TenantUpdateDto { Name = "volosoft" }); - }); + await _tenantAppService.UpdateAsync(acme.Id, new TenantUpdateDto { Name = "volosoft" }).ConfigureAwait(false); + }).ConfigureAwait(false); } [Fact] @@ -102,7 +102,7 @@ namespace Volo.Abp.TenantManagement { var acme = UsingDbContext(dbContext => dbContext.Tenants.Single(t => t.Name == "acme")); - await _tenantAppService.DeleteAsync(acme.Id); + await _tenantAppService.DeleteAsync(acme.Id).ConfigureAwait(false); UsingDbContext(dbContext => { diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantManager_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantManager_Tests.cs index 8605047bbb..0e5eba4136 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantManager_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantManager_Tests.cs @@ -19,23 +19,23 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task CreateAsync() { - var tenant = await _tenantManager.CreateAsync("Test"); + var tenant = await _tenantManager.CreateAsync("Test").ConfigureAwait(false); tenant.Name.ShouldBe("Test"); } [Fact] public async Task Create_Tenant_Name_Can_Not_Duplicate() { - await Assert.ThrowsAsync(async () => await _tenantManager.CreateAsync("volosoft")); + await Assert.ThrowsAsync(async () => await _tenantManager.CreateAsync("volosoft").ConfigureAwait(false)).ConfigureAwait(false); } [Fact] public async Task ChangeNameAsync() { - var tenant = await _tenantRepository.FindByNameAsync("volosoft"); + var tenant = await _tenantRepository.FindByNameAsync("volosoft").ConfigureAwait(false); tenant.ShouldNotBeNull(); - await _tenantManager.ChangeNameAsync(tenant, "newVolosoft"); + await _tenantManager.ChangeNameAsync(tenant, "newVolosoft").ConfigureAwait(false); tenant.Name.ShouldBe("newVolosoft"); } @@ -43,10 +43,10 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task ChangeName_Tenant_Name_Can_Not_Duplicate() { - var tenant = await _tenantRepository.FindByNameAsync("acme"); + var tenant = await _tenantRepository.FindByNameAsync("acme").ConfigureAwait(false); tenant.ShouldNotBeNull(); - await Assert.ThrowsAsync(async () => await _tenantManager.ChangeNameAsync(tenant, "volosoft")); + await Assert.ThrowsAsync(async () => await _tenantManager.ChangeNameAsync(tenant, "volosoft").ConfigureAwait(false)).ConfigureAwait(false); } } } diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantStore_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantStore_Tests.cs index f199124bca..eb6f44068f 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantStore_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantStore_Tests.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindAsyncByName() { - var acme = await _tenantStore.FindAsync("acme"); + var acme = await _tenantStore.FindAsync("acme").ConfigureAwait(false); acme.ShouldNotBeNull(); acme.Name.ShouldBe("acme"); } @@ -27,10 +27,10 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindAsyncById() { - var acme = await _tenantRepository.FindByNameAsync("acme"); + var acme = await _tenantRepository.FindByNameAsync("acme").ConfigureAwait(false); acme.ShouldNotBeNull(); - (await _tenantStore.FindAsync(acme.Id)).ShouldNotBeNull(); + (await _tenantStore.FindAsync(acme.Id).ConfigureAwait(false)).ShouldNotBeNull(); } } } diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Tenant_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Tenant_Tests.cs index 5107d1a06d..6256007e57 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Tenant_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Tenant_Tests.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindDefaultConnectionString() { - var acme = await _tenantRepository.FindByNameAsync("acme"); + var acme = await _tenantRepository.FindByNameAsync("acme").ConfigureAwait(false); acme.ShouldNotBeNull(); acme.FindDefaultConnectionString().ShouldBe("DefaultConnString-Value"); @@ -25,7 +25,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindConnectionString() { - var acme = await _tenantRepository.FindByNameAsync("acme"); + var acme = await _tenantRepository.FindByNameAsync("acme").ConfigureAwait(false); acme.ShouldNotBeNull(); acme.FindConnectionString(Data.ConnectionStrings.DefaultConnectionStringName).ShouldBe("DefaultConnString-Value"); diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/AbpTenantManagementTestDataBuilder.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/AbpTenantManagementTestDataBuilder.cs index 45acc070d8..7127d902f5 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/AbpTenantManagementTestDataBuilder.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/AbpTenantManagementTestDataBuilder.cs @@ -25,13 +25,13 @@ namespace Volo.Abp.TenantManagement private async Task AddTenantsAsync() { - var acme = await _tenantManager.CreateAsync("acme"); + var acme = await _tenantManager.CreateAsync("acme").ConfigureAwait(false); acme.ConnectionStrings.Add(new TenantConnectionString(acme.Id, ConnectionStrings.DefaultConnectionStringName, "DefaultConnString-Value")); acme.ConnectionStrings.Add(new TenantConnectionString(acme.Id, "MyConnString", "MyConnString-Value")); - await _tenantRepository.InsertAsync(acme); + await _tenantRepository.InsertAsync(acme).ConfigureAwait(false); - var volosoft = await _tenantManager.CreateAsync("volosoft"); - await _tenantRepository.InsertAsync(volosoft); + var volosoft = await _tenantManager.CreateAsync("volosoft").ConfigureAwait(false); + await _tenantRepository.InsertAsync(volosoft).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/LazyLoad_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/LazyLoad_Tests.cs index 4ece524e0f..f055e8e9b5 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/LazyLoad_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/LazyLoad_Tests.cs @@ -22,11 +22,11 @@ namespace Volo.Abp.TenantManagement { using (var uow = GetRequiredService().Begin()) { - var role = await TenantRepository.FindByNameAsync("acme", includeDetails: false); + var role = await TenantRepository.FindByNameAsync("acme", includeDetails: false).ConfigureAwait(false); role.ConnectionStrings.ShouldNotBeNull(); role.ConnectionStrings.Any().ShouldBeTrue(); - await uow.CompleteAsync(); + await uow.CompleteAsync().ConfigureAwait(false); } } } diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantManagementTestBase.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantManagementTestBase.cs index eee575ba5f..a5e041c5f3 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantManagementTestBase.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantManagementTestBase.cs @@ -1,4 +1,5 @@ using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace Volo.Abp.TenantManagement { diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantRepository_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantRepository_Tests.cs index 06c75317fa..92ebf57353 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantRepository_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantRepository_Tests.cs @@ -20,13 +20,13 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindByNameAsync() { - var tenant = await TenantRepository.FindByNameAsync("acme"); + var tenant = await TenantRepository.FindByNameAsync("acme").ConfigureAwait(false); tenant.ShouldNotBeNull(); - tenant = await TenantRepository.FindByNameAsync("undefined-tenant"); + tenant = await TenantRepository.FindByNameAsync("undefined-tenant").ConfigureAwait(false); tenant.ShouldBeNull(); - tenant = await TenantRepository.FindByNameAsync("acme", includeDetails: true); + tenant = await TenantRepository.FindByNameAsync("acme", includeDetails: true).ConfigureAwait(false); tenant.ShouldNotBeNull(); tenant.ConnectionStrings.Count.ShouldBeGreaterThanOrEqualTo(2); } @@ -34,15 +34,15 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindAsync() { - var tenantId = (await TenantRepository.FindByNameAsync("acme")).Id; + var tenantId = (await TenantRepository.FindByNameAsync("acme").ConfigureAwait(false)).Id; - var tenant = await TenantRepository.FindAsync(tenantId); + var tenant = await TenantRepository.FindAsync(tenantId).ConfigureAwait(false); tenant.ShouldNotBeNull(); - tenant = await TenantRepository.FindAsync(Guid.NewGuid()); + tenant = await TenantRepository.FindAsync(Guid.NewGuid()).ConfigureAwait(false); tenant.ShouldBeNull(); - tenant = await TenantRepository.FindAsync(tenantId, includeDetails: true); + tenant = await TenantRepository.FindAsync(tenantId, includeDetails: true).ConfigureAwait(false); tenant.ShouldNotBeNull(); tenant.ConnectionStrings.Count.ShouldBeGreaterThanOrEqualTo(2); } @@ -50,7 +50,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task GetListAsync() { - var tenants = await TenantRepository.GetListAsync(); + var tenants = await TenantRepository.GetListAsync().ConfigureAwait(false); tenants.ShouldContain(t => t.Name == "acme"); tenants.ShouldContain(t => t.Name == "volosoft"); } @@ -58,7 +58,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task Should_Eager_Load_Tenant_Collections() { - var role = await TenantRepository.FindByNameAsync("acme"); + var role = await TenantRepository.FindByNameAsync("acme").ConfigureAwait(false); role.ConnectionStrings.ShouldNotBeNull(); role.ConnectionStrings.Any().ShouldBeTrue(); } diff --git a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs index 09979f00e1..a45bcec7ce 100644 --- a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs +++ b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs @@ -32,7 +32,7 @@ namespace Volo.Abp.Users public async Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default) { - var localUser = await _userRepository.FindAsync(id, cancellationToken: cancellationToken); + var localUser = await _userRepository.FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); if (ExternalUserLookupServiceProvider == null) { @@ -48,13 +48,13 @@ namespace Volo.Abp.Users try { - externalUser = await ExternalUserLookupServiceProvider.FindByIdAsync(id, cancellationToken); + externalUser = await ExternalUserLookupServiceProvider.FindByIdAsync(id, cancellationToken).ConfigureAwait(false); if (externalUser == null) { if (localUser != null) { //TODO: Instead of deleting, should be make it inactive or something like that? - await WithNewUowAsync(() => _userRepository.DeleteAsync(localUser, cancellationToken: cancellationToken)); + await WithNewUowAsync(() => _userRepository.DeleteAsync(localUser, cancellationToken: cancellationToken)).ConfigureAwait(false); } return null; @@ -68,25 +68,25 @@ namespace Volo.Abp.Users if (localUser == null) { - await WithNewUowAsync(() => _userRepository.InsertAsync(CreateUser(externalUser), cancellationToken: cancellationToken)); - return await _userRepository.FindAsync(id, cancellationToken: cancellationToken); + await WithNewUowAsync(() => _userRepository.InsertAsync(CreateUser(externalUser), cancellationToken: cancellationToken)).ConfigureAwait(false); + return await _userRepository.FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); } if (localUser is IUpdateUserData && ((IUpdateUserData)localUser).Update(externalUser)) { - await WithNewUowAsync(() => _userRepository.UpdateAsync(localUser, cancellationToken: cancellationToken)); + await WithNewUowAsync(() => _userRepository.UpdateAsync(localUser, cancellationToken: cancellationToken)).ConfigureAwait(false); } else { return localUser; } - return await _userRepository.FindAsync(id, cancellationToken: cancellationToken); + return await _userRepository.FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); } public async Task FindByUserNameAsync(string userName, CancellationToken cancellationToken = default) { - var localUser = await _userRepository.FindByUserNameAsync(userName, cancellationToken); + var localUser = await _userRepository.FindByUserNameAsync(userName, cancellationToken).ConfigureAwait(false); if (ExternalUserLookupServiceProvider == null) { @@ -102,13 +102,13 @@ namespace Volo.Abp.Users try { - externalUser = await ExternalUserLookupServiceProvider.FindByUserNameAsync(userName, cancellationToken); + externalUser = await ExternalUserLookupServiceProvider.FindByUserNameAsync(userName, cancellationToken).ConfigureAwait(false); if (externalUser == null) { if (localUser != null) { //TODO: Instead of deleting, should be make it passive or something like that? - await WithNewUowAsync(() => _userRepository.DeleteAsync(localUser, cancellationToken: cancellationToken)); + await WithNewUowAsync(() => _userRepository.DeleteAsync(localUser, cancellationToken: cancellationToken)).ConfigureAwait(false); } return null; @@ -122,20 +122,20 @@ namespace Volo.Abp.Users if (localUser == null) { - await WithNewUowAsync(() => _userRepository.InsertAsync(CreateUser(externalUser), cancellationToken: cancellationToken)); - return await _userRepository.FindAsync(externalUser.Id, cancellationToken: cancellationToken); + await WithNewUowAsync(() => _userRepository.InsertAsync(CreateUser(externalUser), cancellationToken: cancellationToken)).ConfigureAwait(false); + return await _userRepository.FindAsync(externalUser.Id, cancellationToken: cancellationToken).ConfigureAwait(false); } if (localUser is IUpdateUserData && ((IUpdateUserData)localUser).Update(externalUser)) { - await WithNewUowAsync(() => _userRepository.UpdateAsync(localUser, cancellationToken: cancellationToken)); + await WithNewUowAsync(() => _userRepository.UpdateAsync(localUser, cancellationToken: cancellationToken)).ConfigureAwait(false); } else { return localUser; } - return await _userRepository.FindAsync(externalUser.Id, cancellationToken: cancellationToken); + return await _userRepository.FindAsync(externalUser.Id, cancellationToken: cancellationToken).ConfigureAwait(false); } protected abstract TUser CreateUser(IUserData externalUser); @@ -144,8 +144,8 @@ namespace Volo.Abp.Users { using (var uow = _unitOfWorkManager.Begin(requiresNew: true)) { - await func(); - await uow.SaveChangesAsync(); + await func().ConfigureAwait(false); + await uow.SaveChangesAsync().ConfigureAwait(false); } } } diff --git a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupServiceExtensions.cs b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupServiceExtensions.cs index 88781ea026..a605db88bc 100644 --- a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupServiceExtensions.cs +++ b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupServiceExtensions.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.Users public static async Task GetByIdAsync(this IUserLookupService userLookupService, Guid id, CancellationToken cancellationToken = default) where TUser : class, IUser { - var user = await userLookupService.FindByIdAsync(id, cancellationToken); + var user = await userLookupService.FindByIdAsync(id, cancellationToken).ConfigureAwait(false); if (user == null) { throw new EntityNotFoundException(typeof(TUser), id); @@ -22,7 +22,7 @@ namespace Volo.Abp.Users public static async Task GetByUserNameAsync(this IUserLookupService userLookupService, string userName, CancellationToken cancellationToken = default) where TUser : class, IUser { - var user = await userLookupService.FindByUserNameAsync(userName, cancellationToken); + var user = await userLookupService.FindByUserNameAsync(userName, cancellationToken).ConfigureAwait(false); if (user == null) { throw new EntityNotFoundException(typeof(TUser), userName); diff --git a/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/EfCoreAbpUserRepositoryBase.cs b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/EfCoreAbpUserRepositoryBase.cs index 5d0958101c..6dbc5b7d0c 100644 --- a/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/EfCoreAbpUserRepositoryBase.cs +++ b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/EfCoreAbpUserRepositoryBase.cs @@ -21,12 +21,12 @@ namespace Volo.Abp.Users.EntityFrameworkCore public async Task FindByUserNameAsync(string userName, CancellationToken cancellationToken = default) { - return await this.FirstOrDefaultAsync(u => u.UserName == userName, GetCancellationToken(cancellationToken)); + return await this.FirstOrDefaultAsync(u => u.UserName == userName, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { - return await DbSet.Where(u => ids.Contains(u.Id)).ToListAsync(GetCancellationToken(cancellationToken)); + return await DbSet.Where(u => ids.Contains(u.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs b/modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs index 3c5bb66b25..a176db97b4 100644 --- a/modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs +++ b/modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs @@ -22,12 +22,12 @@ namespace Volo.Abp.Users.MongoDB public virtual async Task FindByUserNameAsync(string userName, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().FirstOrDefaultAsync(u => u.UserName == userName, GetCancellationToken(cancellationToken)); + return await GetMongoQueryable().FirstOrDefaultAsync(u => u.UserName == userName, GetCancellationToken(cancellationToken)).ConfigureAwait(false); } public virtual async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().Where(u => ids.Contains(u.Id)) .ToListAsync(GetCancellationToken(cancellationToken)); + return await GetMongoQueryable().Where(u => ids.Contains(u.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestBase.cs b/modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestBase.cs index 2d90e59d4a..e36f485a70 100644 --- a/modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestBase.cs +++ b/modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestBase.cs @@ -1,4 +1,5 @@ using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace Volo.Abp.Users { diff --git a/npm/ng-packs/README.md b/npm/ng-packs/README.md index 1d1e3b520c..220bc57f37 100644 --- a/npm/ng-packs/README.md +++ b/npm/ng-packs/README.md @@ -1,4 +1,10 @@ -

    Abp Ng Packages

    +# Abp Ng Packages + +![action badge](https://img.shields.io/github/workflow/status/abpframework/abp/Angular) +![issues](https://img.shields.io/github/issues/abpframework/abp/ui-angular) +![pull requests](https://img.shields.io/github/issues-pr-raw/abpframework/abp/ui-angular) +![npm](https://img.shields.io/npm/dm/@abp/ng.core) +![npm version](https://img.shields.io/npm/v/@abp/ng.core?label=version) ## Getting started diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index f66eb74303..c831267d7d 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -1,4 +1,9 @@ { + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "scripts": { "ng": "ng", "abpng": "abpng", @@ -7,7 +12,7 @@ "test": "ng test --watchAll --runInBand", "commit": "git-cz", "lint": "ng lint", - "scripts:build": "cd scripts && npm install && yarn build", + "scripts:build": "cd scripts && yarn && yarn build", "prepare:workspace": "yarn scripts:build", "ci": "yarn prepare:workspace && yarn ci:test && yarn ng lint && yarn ci:build", "ci:test": "ng test --coverage=false", @@ -30,11 +35,11 @@ "@abp/ng.theme.basic": "^1.1.1", "@abp/ng.theme.shared": "^1.1.1", "@angular-builders/jest": "^8.2.0", - "@angular-devkit/build-angular": "~0.803.20", - "@angular-devkit/build-ng-packagr": "~0.803.20", + "@angular-devkit/build-angular": "~0.803.21", + "@angular-devkit/build-ng-packagr": "~0.803.21", "@angular/animations": "~8.2.14", "@angular/cdk": "^8.2.3", - "@angular/cli": "~8.3.18", + "@angular/cli": "~8.3.21", "@angular/common": "~8.2.14", "@angular/compiler": "~8.2.14", "@angular/compiler-cli": "~8.2.14", diff --git a/npm/ng-packs/packages/account-config/package.json b/npm/ng-packs/packages/account-config/package.json index ccfc3cc841..aeb8d2b697 100644 --- a/npm/ng-packs/packages/account-config/package.json +++ b/npm/ng-packs/packages/account-config/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.account.config", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "publishConfig": { "access": "public" } diff --git a/npm/ng-packs/packages/account/package.json b/npm/ng-packs/packages/account/package.json index 81049e297d..88f866d5a4 100644 --- a/npm/ng-packs/packages/account/package.json +++ b/npm/ng-packs/packages/account/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.account", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "dependencies": { "@abp/ng.account.config": "^1.1.1", "@abp/ng.theme.shared": "^1.1.1" diff --git a/npm/ng-packs/packages/account/src/lib/account-routing.module.ts b/npm/ng-packs/packages/account/src/lib/account-routing.module.ts index 3df3001272..db4147f2a0 100644 --- a/npm/ng-packs/packages/account/src/lib/account-routing.module.ts +++ b/npm/ng-packs/packages/account/src/lib/account-routing.module.ts @@ -1,4 +1,9 @@ -import { DynamicLayoutComponent } from '@abp/ng.core'; +import { + DynamicLayoutComponent, + AuthGuard, + ReplaceableComponents, + ReplaceableRouteContainerComponent, +} from '@abp/ng.core'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { LoginComponent } from './components/login/login.component'; @@ -11,11 +16,36 @@ const routes: Routes = [ path: '', component: DynamicLayoutComponent, children: [ - { path: 'login', component: LoginComponent }, - { path: 'register', component: RegisterComponent }, + { + path: 'login', + component: ReplaceableRouteContainerComponent, + data: { + replaceableComponent: { + key: 'Account.LoginComponent', + defaultComponent: LoginComponent, + } as ReplaceableComponents.RouteData, + }, + }, + { + path: 'register', + component: ReplaceableRouteContainerComponent, + data: { + replaceableComponent: { + key: 'Account.RegisterComponent', + defaultComponent: RegisterComponent, + } as ReplaceableComponents.RouteData, + }, + }, { path: 'manage-profile', - component: ManageProfileComponent, + component: ReplaceableRouteContainerComponent, + canActivate: [AuthGuard], + data: { + replaceableComponent: { + key: 'Account.ManageProfileComponent', + defaultComponent: ManageProfileComponent, + } as ReplaceableComponents.RouteData, + }, }, ], }, diff --git a/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.html b/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.html index 3d210dad08..f25b6eae0c 100644 --- a/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.html +++ b/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.html @@ -1,6 +1,8 @@
    - +
    diff --git a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts index d9b602089c..444a014d6d 100644 --- a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts @@ -5,14 +5,20 @@ import { Select, Store } from '@ngxs/store'; import { Observable } from 'rxjs'; import { take, withLatestFrom, finalize } from 'rxjs/operators'; import { ToasterService } from '@abp/ng.theme.shared'; +import { Account } from '../../models/account'; const { maxLength, required, email } = Validators; @Component({ selector: 'abp-personal-settings-form', templateUrl: './personal-settings.component.html', + exportAs: 'abpPersonalSettingsForm', }) -export class PersonalSettingsComponent implements OnInit { +export class PersonalSettingsComponent + implements + OnInit, + Account.PersonalSettingsComponentInputs, + Account.PersonalSettingsComponentOutputs { @Select(ProfileState.getProfile) profile$: Observable; @@ -20,7 +26,11 @@ export class PersonalSettingsComponent implements OnInit { inProgress: boolean; - constructor(private fb: FormBuilder, private store: Store, private toasterService: ToasterService) {} + constructor( + private fb: FormBuilder, + private store: Store, + private toasterService: ToasterService, + ) {} ngOnInit() { this.buildForm(); @@ -29,10 +39,7 @@ export class PersonalSettingsComponent implements OnInit { buildForm() { this.store .dispatch(new GetProfile()) - .pipe( - withLatestFrom(this.profile$), - take(1), - ) + .pipe(withLatestFrom(this.profile$), take(1)) .subscribe(([, profile]) => { this.form = this.fb.group({ userName: [profile.userName, [required, maxLength(256)]], diff --git a/npm/ng-packs/packages/account/src/lib/components/register/register.component.html b/npm/ng-packs/packages/account/src/lib/components/register/register.component.html index 41d619a16a..4a0f75d010 100644 --- a/npm/ng-packs/packages/account/src/lib/components/register/register.component.html +++ b/npm/ng-packs/packages/account/src/lib/components/register/register.component.html @@ -1,32 +1,57 @@ - - -

    {{ 'AbpAccount::Register' | abpLocalization }}

    - - {{ 'AbpAccount::AlreadyRegistered' | abpLocalization }} - {{ 'AbpAccount::Login' | abpLocalization }} - -
    -
    - * -
    -
    - * -
    -
    - * -
    - - {{ 'AbpAccount::Register' | abpLocalization }} - -
    -
    + + +

    {{ 'AbpAccount::Register' | abpLocalization }}

    + + {{ 'AbpAccount::AlreadyRegistered' | abpLocalization }} + {{ + 'AbpAccount::Login' | abpLocalization + }} + +
    +
    + * +
    +
    + * +
    +
    + * +
    + + {{ 'AbpAccount::Register' | abpLocalization }} + +
    +
    diff --git a/npm/ng-packs/packages/account/src/lib/components/tenant-box/tenant-box.component.ts b/npm/ng-packs/packages/account/src/lib/components/tenant-box/tenant-box.component.ts index 9300b1d248..d8fe9762e1 100644 --- a/npm/ng-packs/packages/account/src/lib/components/tenant-box/tenant-box.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/tenant-box/tenant-box.component.ts @@ -6,12 +6,14 @@ import { throwError } from 'rxjs'; import { catchError, take, finalize } from 'rxjs/operators'; import snq from 'snq'; import { AccountService } from '../../services/account.service'; +import { Account } from '../../models/account'; @Component({ selector: 'abp-tenant-box', templateUrl: './tenant-box.component.html', }) -export class TenantBoxComponent implements OnInit { +export class TenantBoxComponent + implements OnInit, Account.TenantBoxComponentInputs, Account.TenantBoxComponentOutputs { tenant = {} as ABP.BasicItem; tenantName: string; @@ -20,7 +22,11 @@ export class TenantBoxComponent implements OnInit { inProgress: boolean; - constructor(private store: Store, private toasterService: ToasterService, private accountService: AccountService) {} + constructor( + private store: Store, + private toasterService: ToasterService, + private accountService: AccountService, + ) {} ngOnInit() { this.tenant = this.store.selectSnapshot(SessionState.getTenant) || ({} as ABP.BasicItem); @@ -56,9 +62,13 @@ export class TenantBoxComponent implements OnInit { this.tenantName = this.tenant.name; this.isModalVisible = false; } else { - this.toasterService.error('AbpUiMultiTenancy::GivenTenantIsNotAvailable', 'AbpUi::Error', { - messageLocalizationParams: [this.tenant.name], - }); + this.toasterService.error( + 'AbpUiMultiTenancy::GivenTenantIsNotAvailable', + 'AbpUi::Error', + { + messageLocalizationParams: [this.tenant.name], + }, + ); this.tenant = {} as ABP.BasicItem; } this.store.dispatch(new SetTenant(success ? this.tenant : null)); diff --git a/npm/ng-packs/packages/account/src/lib/models/account.ts b/npm/ng-packs/packages/account/src/lib/models/account.ts new file mode 100644 index 0000000000..04a37709c6 --- /dev/null +++ b/npm/ng-packs/packages/account/src/lib/models/account.ts @@ -0,0 +1,18 @@ +import { TemplateRef } from '@angular/core'; + +export namespace Account { + export interface AuthWrapperComponentInputs { + readonly mainContentRef: TemplateRef; + readonly cancelContentRef?: TemplateRef; + } + + //tslint:disable + export interface AuthWrapperComponentOutputs {} + export interface TenantBoxComponentInputs {} + export interface TenantBoxComponentOutputs {} + export interface PersonalSettingsComponentInputs {} + export interface PersonalSettingsComponentOutputs {} + export interface ChangePasswordComponentInputs {} + export interface ChangePasswordComponentOutputs {} + // tslint:enable +} diff --git a/npm/ng-packs/packages/account/src/lib/models/index.ts b/npm/ng-packs/packages/account/src/lib/models/index.ts index 4dcd63408e..25b28cb9a0 100644 --- a/npm/ng-packs/packages/account/src/lib/models/index.ts +++ b/npm/ng-packs/packages/account/src/lib/models/index.ts @@ -1,3 +1,4 @@ +export * from './account'; export * from './options'; export * from './user'; export * from './tenant'; diff --git a/npm/ng-packs/packages/core/package.json b/npm/ng-packs/packages/core/package.json index ff8ad4d268..10063989b5 100644 --- a/npm/ng-packs/packages/core/package.json +++ b/npm/ng-packs/packages/core/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.core", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "dependencies": { "@ngxs/router-plugin": "^3.5.1", "@ngxs/storage-plugin": "^3.5.1", diff --git a/npm/ng-packs/packages/core/src/lib/actions/index.ts b/npm/ng-packs/packages/core/src/lib/actions/index.ts index cf05aac81d..9ef0b1278a 100644 --- a/npm/ng-packs/packages/core/src/lib/actions/index.ts +++ b/npm/ng-packs/packages/core/src/lib/actions/index.ts @@ -1,5 +1,6 @@ export * from './config.actions'; export * from './loader.actions'; export * from './profile.actions'; +export * from './replaceable-components.actions'; export * from './rest.actions'; export * from './session.actions'; diff --git a/npm/ng-packs/packages/core/src/lib/actions/replaceable-components.actions.ts b/npm/ng-packs/packages/core/src/lib/actions/replaceable-components.actions.ts new file mode 100644 index 0000000000..e611459960 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/actions/replaceable-components.actions.ts @@ -0,0 +1,6 @@ +import { ReplaceableComponents } from '../models/replaceable-components'; + +export class AddReplaceableComponent { + static readonly type = '[ReplaceableComponents] Add'; + constructor(public payload: ReplaceableComponents.ReplaceableComponent) {} +} diff --git a/npm/ng-packs/packages/core/src/lib/components/index.ts b/npm/ng-packs/packages/core/src/lib/components/index.ts index d54b2d2175..da3c72a69f 100644 --- a/npm/ng-packs/packages/core/src/lib/components/index.ts +++ b/npm/ng-packs/packages/core/src/lib/components/index.ts @@ -1,2 +1,3 @@ export * from './dynamic-layout.component'; +export * from './replaceable-route-container.component'; export * from './router-outlet.component'; diff --git a/npm/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts b/npm/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts new file mode 100644 index 0000000000..32d2dadb76 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts @@ -0,0 +1,39 @@ +import { Component, OnDestroy, OnInit, Type } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { Store } from '@ngxs/store'; +import { distinctUntilChanged } from 'rxjs/operators'; +import { ABP } from '../models/common'; +import { ReplaceableComponents } from '../models/replaceable-components'; +import { ReplaceableComponentsState } from '../states/replaceable-components.state'; +import { takeUntilDestroy } from '../utils/rxjs-utils'; + +@Component({ + selector: 'abp-replaceable-route-container', + template: ` + + `, +}) +export class ReplaceableRouteContainerComponent implements OnInit, OnDestroy { + defaultComponent: Type; + + componentKey: string; + + externalComponent: Type; + + constructor(private route: ActivatedRoute, private store: Store) {} + + ngOnInit() { + this.defaultComponent = this.route.snapshot.data.replaceableComponent.defaultComponent; + this.componentKey = (this.route.snapshot.data + .replaceableComponent as ReplaceableComponents.RouteData).key; + + this.store + .select(ReplaceableComponentsState.getComponent(this.componentKey)) + .pipe(takeUntilDestroy(this), distinctUntilChanged()) + .subscribe((res = {} as ReplaceableComponents.ReplaceableComponent) => { + this.externalComponent = res.component; + }); + } + + ngOnDestroy() {} +} diff --git a/npm/ng-packs/packages/core/src/lib/core.module.ts b/npm/ng-packs/packages/core/src/lib/core.module.ts index ab24c6beff..a3fc08c7e2 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -29,10 +29,14 @@ import { ProfileState } from './states/profile.state'; import { SessionState } from './states/session.state'; import { getInitialData, localeInitializer } from './utils/initial-utils'; import './utils/date-extensions'; +import { ReplaceableRouteContainerComponent } from './components/replaceable-route-container.component'; +import { ReplaceableComponentsState } from './states/replaceable-components.state'; +import { InitDirective } from './directives/init.directive'; +import { ReplaceableTemplateDirective } from './directives/replaceable-template.directive'; @NgModule({ imports: [ - NgxsModule.forFeature([ProfileState, SessionState, ConfigState]), + NgxsModule.forFeature([ReplaceableComponentsState, ProfileState, SessionState, ConfigState]), NgxsRouterPluginModule.forRoot(), NgxsStoragePluginModule.forRoot({ key: ['SessionState'] }), OAuthModule.forRoot(), @@ -43,6 +47,7 @@ import './utils/date-extensions'; RouterModule, ], declarations: [ + ReplaceableRouteContainerComponent, RouterOutletComponent, DynamicLayoutComponent, AutofocusDirective, @@ -51,10 +56,12 @@ import './utils/date-extensions'; FormSubmitDirective, LocalizationPipe, SortPipe, + InitDirective, PermissionDirective, VisibilityDirective, InputEventDebounceDirective, StopPropagationDirective, + ReplaceableTemplateDirective, AbstractNgModelComponent, ], exports: [ @@ -65,21 +72,28 @@ import './utils/date-extensions'; RouterModule, RouterOutletComponent, DynamicLayoutComponent, + AbstractNgModelComponent, + ReplaceableRouteContainerComponent, AutofocusDirective, EllipsisDirective, ForDirective, FormSubmitDirective, - LocalizationPipe, - SortPipe, + InitDirective, PermissionDirective, VisibilityDirective, InputEventDebounceDirective, - LocalizationPipe, + ReplaceableTemplateDirective, StopPropagationDirective, - AbstractNgModelComponent, + LocalizationPipe, + SortPipe, + LocalizationPipe, ], providers: [LocalizationPipe], - entryComponents: [RouterOutletComponent, DynamicLayoutComponent], + entryComponents: [ + RouterOutletComponent, + DynamicLayoutComponent, + ReplaceableRouteContainerComponent, + ], }) export class CoreModule { static forRoot(options = {} as ABP.Root): ModuleWithProviders { diff --git a/npm/ng-packs/packages/core/src/lib/directives/index.ts b/npm/ng-packs/packages/core/src/lib/directives/index.ts index 7edf1b5f76..f191cfcef5 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/index.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/index.ts @@ -2,5 +2,7 @@ export * from './autofocus.directive'; export * from './ellipsis.directive'; export * from './for.directive'; export * from './form-submit.directive'; +export * from './init.directive'; export * from './permission.directive'; +export * from './replaceable-template.directive'; export * from './visibility.directive'; diff --git a/npm/ng-packs/packages/core/src/lib/directives/init.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/init.directive.ts new file mode 100644 index 0000000000..ba55523757 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/directives/init.directive.ts @@ -0,0 +1,12 @@ +import { Directive, Output, EventEmitter, ElementRef, AfterViewInit } from '@angular/core'; + +@Directive({ selector: '[abpInit]' }) +export class InitDirective implements AfterViewInit { + @Output('abpInit') readonly init = new EventEmitter>(); + + constructor(private elRef: ElementRef) {} + + ngAfterViewInit() { + this.init.emit(this.elRef); + } +} diff --git a/npm/ng-packs/packages/core/src/lib/directives/replaceable-template.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/replaceable-template.directive.ts new file mode 100644 index 0000000000..91f666137f --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/directives/replaceable-template.directive.ts @@ -0,0 +1,164 @@ +import { + ComponentFactoryResolver, + Directive, + Injector, + Input, + OnChanges, + OnDestroy, + OnInit, + SimpleChanges, + TemplateRef, + Type, + ViewContainerRef, +} from '@angular/core'; +import { Store } from '@ngxs/store'; +import { Subscription } from 'rxjs'; +import { filter } from 'rxjs/operators'; +import { ABP } from '../models/common'; +import { ReplaceableComponents } from '../models/replaceable-components'; +import { ReplaceableComponentsState } from '../states/replaceable-components.state'; +import { takeUntilDestroy } from '../utils/rxjs-utils'; +import compare from 'just-compare'; +import snq from 'snq'; + +@Directive({ selector: '[abpReplaceableTemplate]' }) +export class ReplaceableTemplateDirective implements OnInit, OnDestroy, OnChanges { + @Input('abpReplaceableTemplate') + data: ReplaceableComponents.ReplaceableTemplateDirectiveInput; + + providedData = { inputs: {}, outputs: {} } as ReplaceableComponents.ReplaceableTemplateData< + any, + any + >; + + context = {} as any; + + externalComponent: Type; + + defaultComponentRef: any; + + defaultComponentSubscriptions = {} as ABP.Dictionary; + + initialized = false; + + constructor( + private injector: Injector, + private templateRef: TemplateRef, + private cfRes: ComponentFactoryResolver, + private vcRef: ViewContainerRef, + private store: Store, + ) { + this.context = { + initTemplate: ref => { + this.resetDefaultComponent(); + this.defaultComponentRef = ref; + this.setDefaultComponentInputs(); + }, + }; + } + + ngOnInit() { + this.store + .select(ReplaceableComponentsState.getComponent(this.data.componentKey)) + .pipe( + filter( + (res = {} as ReplaceableComponents.ReplaceableComponent) => + !this.initialized || !compare(res.component, this.externalComponent), + ), + takeUntilDestroy(this), + ) + .subscribe((res = {} as ReplaceableComponents.ReplaceableComponent) => { + this.vcRef.clear(); + this.externalComponent = res.component; + if (this.defaultComponentRef) { + this.resetDefaultComponent(); + } + + if (res.component) { + this.setProvidedData(); + const customInjector = Injector.create({ + providers: [{ provide: 'REPLACEABLE_DATA', useValue: this.providedData }], + parent: this.injector, + }); + this.vcRef.createComponent( + this.cfRes.resolveComponentFactory(res.component), + 0, + customInjector, + ); + } else { + this.vcRef.createEmbeddedView(this.templateRef, this.context); + } + + this.initialized = true; + }); + } + + ngOnChanges(changes: SimpleChanges) { + if (snq(() => changes.data.currentValue.inputs) && this.defaultComponentRef) { + this.setDefaultComponentInputs(); + } + } + + ngOnDestroy() {} + + setDefaultComponentInputs() { + if (!this.defaultComponentRef || (!this.data.inputs && !this.data.outputs)) return; + + if (this.data.inputs) { + for (const key in this.data.inputs) { + if (this.data.inputs.hasOwnProperty(key)) { + if (!compare(this.defaultComponentRef[key], this.data.inputs[key].value)) { + this.defaultComponentRef[key] = this.data.inputs[key].value; + } + } + } + } + + if (this.data.outputs) { + for (const key in this.data.outputs) { + if (this.data.outputs.hasOwnProperty(key)) { + if (!this.defaultComponentSubscriptions[key]) { + this.defaultComponentSubscriptions[key] = this.defaultComponentRef[key].subscribe( + value => { + this.data.outputs[key](value); + }, + ); + } + } + } + } + } + + setProvidedData() { + this.providedData = { ...this.data, inputs: {} }; + + if (!this.data.inputs) return; + Object.defineProperties(this.providedData.inputs, { + ...Object.keys(this.data.inputs).reduce( + (acc, key) => ({ + ...acc, + [key]: { + enumerable: true, + configurable: true, + get: () => this.data.inputs[key].value, + ...(this.data.inputs[key].twoWay && { + set: newValue => { + this.data.inputs[key].value = newValue; + this.data.outputs[`${key}Change`](newValue); + }, + }), + }, + }), + {}, + ), + }); + } + + resetDefaultComponent() { + Object.keys(this.defaultComponentSubscriptions).forEach(key => { + this.defaultComponentSubscriptions[key].unsubscribe(); + }); + this.defaultComponentSubscriptions = {} as ABP.Dictionary; + this.defaultComponentRef = null; + } +} diff --git a/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts b/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts index e23eeb40c2..c4b70d0b7b 100644 --- a/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts +++ b/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; import { Store } from '@ngxs/store'; -import { Observable } from 'rxjs'; +import { Observable, of } from 'rxjs'; import { tap } from 'rxjs/operators'; import snq from 'snq'; import { RestOccurError } from '../actions'; @@ -14,11 +14,18 @@ export class PermissionGuard implements CanActivate { constructor(private store: Store) {} canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { - let resource = snq(() => route.data.routes.requiredPolicy) || snq(() => route.data.requiredPolicy as string); + let resource = + snq(() => route.data.routes.requiredPolicy) || snq(() => route.data.requiredPolicy as string); if (!resource) { resource = snq( - () => route.routeConfig.children.find(child => state.url.indexOf(child.path) > -1).data.requiredPolicy, + () => + route.routeConfig.children.find(child => state.url.indexOf(child.path) > -1).data + .requiredPolicy, ); + + if (!resource) { + return of(true); + } } return this.store.select(ConfigState.getGrantedPolicy(resource)).pipe( diff --git a/npm/ng-packs/packages/core/src/lib/models/common.ts b/npm/ng-packs/packages/core/src/lib/models/common.ts index 95bf490e91..8b4fb76cb0 100644 --- a/npm/ng-packs/packages/core/src/lib/models/common.ts +++ b/npm/ng-packs/packages/core/src/lib/models/common.ts @@ -1,5 +1,7 @@ -import { Config } from './config'; import { eLayoutType } from '../enums/common'; +import { Config } from './config'; +import { EventEmitter } from '@angular/core'; +import { Subject } from 'rxjs'; export namespace ABP { export interface Root { @@ -47,4 +49,8 @@ export namespace ABP { export interface Dictionary { [key: string]: T; } + + export type ExtractFromOutput< + T extends EventEmitter | Subject + > = T extends EventEmitter ? X : T extends Subject ? Y : never; } diff --git a/npm/ng-packs/packages/core/src/lib/models/index.ts b/npm/ng-packs/packages/core/src/lib/models/index.ts index 63302c9ab8..c19dcbc96a 100644 --- a/npm/ng-packs/packages/core/src/lib/models/index.ts +++ b/npm/ng-packs/packages/core/src/lib/models/index.ts @@ -1,6 +1,7 @@ export * from './application-configuration'; export * from './common'; export * from './config'; +export * from './profile'; +export * from './replaceable-components'; export * from './rest'; export * from './session'; -export * from './profile'; diff --git a/npm/ng-packs/packages/core/src/lib/models/replaceable-components.ts b/npm/ng-packs/packages/core/src/lib/models/replaceable-components.ts new file mode 100644 index 0000000000..1c59ff3a05 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/models/replaceable-components.ts @@ -0,0 +1,47 @@ +import { Type, EventEmitter } from '@angular/core'; +import { ABP } from './common'; +import { Subject, BehaviorSubject } from 'rxjs'; + +export namespace ReplaceableComponents { + export interface State { + replaceableComponents: ReplaceableComponent[]; + } + + export interface ReplaceableComponent { + component: Type; + key: string; + } + + export interface ReplaceableTemplateDirectiveInput< + I, + O extends { [K in keyof O]: EventEmitter | Subject } + > { + inputs: { -readonly [K in keyof I]: { value: I[K]; twoWay?: boolean } }; + outputs: { -readonly [K in keyof O]: (value: ABP.ExtractFromOutput) => void }; + componentKey: string; + } + + export interface ReplaceableTemplateData< + I, + O extends { [K in keyof O]: EventEmitter | Subject } + > { + inputs: ReplaceableTemplateInputs; + outputs: ReplaceableTemplateOutputs; + componentKey: string; + } + + export type ReplaceableTemplateInputs = { + [K in keyof T]: T[K]; + }; + + export type ReplaceableTemplateOutputs< + T extends { [K in keyof T]: EventEmitter | Subject } + > = { + [K in keyof T]: (value: ABP.ExtractFromOutput) => void; + }; + + export interface RouteData { + key: string; + defaultComponent: Type; + } +} diff --git a/npm/ng-packs/packages/core/src/lib/states/index.ts b/npm/ng-packs/packages/core/src/lib/states/index.ts index b7626c2842..7b48292caa 100644 --- a/npm/ng-packs/packages/core/src/lib/states/index.ts +++ b/npm/ng-packs/packages/core/src/lib/states/index.ts @@ -1,3 +1,4 @@ -export * from './profile.state'; +export * from './replaceable-components.state'; export * from './config.state'; +export * from './profile.state'; export * from './session.state'; diff --git a/npm/ng-packs/packages/core/src/lib/states/replaceable-components.state.ts b/npm/ng-packs/packages/core/src/lib/states/replaceable-components.state.ts new file mode 100644 index 0000000000..41c69df94f --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/states/replaceable-components.state.ts @@ -0,0 +1,50 @@ +import { State, Action, StateContext, Selector, createSelector } from '@ngxs/store'; +import { AddReplaceableComponent } from '../actions/replaceable-components.actions'; +import { ReplaceableComponents } from '../models/replaceable-components'; +import snq from 'snq'; + +@State({ + name: 'ReplaceableComponentsState', + defaults: { replaceableComponents: [] } as ReplaceableComponents.State, +}) +export class ReplaceableComponentsState { + @Selector() + static getAll({ + replaceableComponents, + }: ReplaceableComponents.State): ReplaceableComponents.ReplaceableComponent[] { + return replaceableComponents || []; + } + + static getComponent(key: string) { + const selector = createSelector( + [ReplaceableComponentsState], + (state: ReplaceableComponents.State): ReplaceableComponents.ReplaceableComponent => { + return snq(() => state.replaceableComponents.find(component => component.key === key)); + }, + ); + + return selector; + } + + @Action(AddReplaceableComponent) + replaceableComponentsAction( + { getState, patchState }: StateContext, + { payload }: AddReplaceableComponent, + ) { + let { replaceableComponents } = getState(); + + const index = snq( + () => replaceableComponents.findIndex(component => component.key === payload.key), + -1, + ); + if (index > -1) { + replaceableComponents[index] = payload; + } else { + replaceableComponents = [...replaceableComponents, payload]; + } + + patchState({ + replaceableComponents, + }); + } +} diff --git a/npm/ng-packs/packages/core/src/lib/tests/replaceable-components.state.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/replaceable-components.state.spec.ts new file mode 100644 index 0000000000..c294b131e1 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/replaceable-components.state.spec.ts @@ -0,0 +1,41 @@ +import { createHostFactory, SpectatorHost } from '@ngneat/spectator/jest'; +import { NgxsModule, Store } from '@ngxs/store'; +import { ReplaceableComponentsState } from '../states/replaceable-components.state'; +import { Component } from '@angular/core'; +import { AddReplaceableComponent } from '../actions'; + +@Component({ selector: 'abp-dummy', template: 'dummy works' }) +class DummyComponent {} + +describe('ReplaceableComponentsState', () => { + let spectator: SpectatorHost; + const createHost = createHostFactory({ + component: DummyComponent, + imports: [NgxsModule.forRoot([ReplaceableComponentsState])], + }); + + beforeEach(() => { + spectator = createHost(''); + }); + + it('should add a component to the state', () => { + const store = spectator.get(Store); + expect(store.selectSnapshot(ReplaceableComponentsState.getAll)).toEqual([]); + store.dispatch(new AddReplaceableComponent({ component: DummyComponent, key: 'Dummy' })); + expect(store.selectSnapshot(ReplaceableComponentsState.getComponent('Dummy'))).toEqual({ + component: DummyComponent, + key: 'Dummy', + }); + }); + + it('should replace a exist component', () => { + const store = spectator.get(Store); + store.dispatch(new AddReplaceableComponent({ component: DummyComponent, key: 'Dummy' })); + store.dispatch(new AddReplaceableComponent({ component: null, key: 'Dummy' })); + expect(store.selectSnapshot(ReplaceableComponentsState.getComponent('Dummy'))).toEqual({ + component: null, + key: 'Dummy', + }); + expect(store.selectSnapshot(ReplaceableComponentsState.getAll)).toHaveLength(1); + }); +}); diff --git a/npm/ng-packs/packages/core/src/lib/tests/replaceable-route-container.component.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/replaceable-route-container.component.spec.ts new file mode 100644 index 0000000000..f5874bca46 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/replaceable-route-container.component.spec.ts @@ -0,0 +1,66 @@ +import { createHostFactory, SpectatorHost } from '@ngneat/spectator/jest'; +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { Store } from '@ngxs/store'; +import { of, Subject, BehaviorSubject } from 'rxjs'; +import { ReplaceableRouteContainerComponent } from '../components/replaceable-route-container.component'; +import { ReplaceableComponentsState } from '../states'; + +@Component({ + selector: 'abp-external-component', + template: '

    external

    ', +}) +export class ExternalComponent {} + +@Component({ + selector: 'abp-default-component', + template: '

    default

    ', +}) +export class DefaultComponent {} + +const activatedRouteMock = { + snapshot: { + data: { + replaceableComponent: { + defaultComponent: DefaultComponent, + key: 'TestModule.TestComponent', + }, + }, + }, +}; + +describe('ReplaceableRouteContainerComponent', () => { + const selectResponse = new BehaviorSubject(undefined); + const mockSelect = jest.fn(() => selectResponse); + + let spectator: SpectatorHost; + const createHost = createHostFactory({ + component: ReplaceableRouteContainerComponent, + providers: [ + { provide: ActivatedRoute, useValue: activatedRouteMock }, + { provide: Store, useValue: { select: mockSelect } }, + ], + declarations: [ExternalComponent, DefaultComponent], + entryComponents: [DefaultComponent, ExternalComponent], + }); + + beforeEach(() => { + spectator = createHost('', { + detectChanges: true, + }); + }); + + it('should display the default component', () => { + expect(spectator.query('p')).toHaveText('default'); + }); + + it("should display the external component if it's available in store.", () => { + selectResponse.next({ component: ExternalComponent }); + spectator.detectChanges(); + expect(spectator.query('p')).toHaveText('external'); + + selectResponse.next({ component: null }); + spectator.detectChanges(); + expect(spectator.query('p')).toHaveText('default'); + }); +}); diff --git a/npm/ng-packs/packages/core/src/lib/tests/replaceable-template.directive.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/replaceable-template.directive.spec.ts new file mode 100644 index 0000000000..613508f56b --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/replaceable-template.directive.spec.ts @@ -0,0 +1,175 @@ +import { Component, EventEmitter, Inject, Input, OnInit, Optional, Output } from '@angular/core'; +import { createDirectiveFactory, SpectatorDirective } from '@ngneat/spectator/jest'; +import { Store } from '@ngxs/store'; +import { Subject } from 'rxjs'; +import { ReplaceableTemplateDirective } from '../directives'; +import { ReplaceableComponents } from '../models'; + +@Component({ + selector: 'abp-default-component', + template: ` +

    default

    + `, + exportAs: 'abpDefaultComponent', +}) +class DefaultComponent implements OnInit { + @Input() + oneWay; + + @Input() + twoWay: boolean; + + @Output() + readonly twoWayChange = new EventEmitter(); + + @Output() + readonly someOutput = new EventEmitter(); + + ngOnInit() {} + + setTwoWay(value) { + this.twoWay = value; + this.twoWayChange.emit(value); + } +} + +@Component({ + selector: 'abp-external-component', + template: ` +

    external

    + `, +}) +class ExternalComponent { + constructor( + @Optional() + @Inject('REPLACEABLE_DATA') + public data: ReplaceableComponents.ReplaceableTemplateData, + ) {} +} + +describe('ReplaceableTemplateDirective', () => { + const selectResponse = new Subject(); + const mockSelect = jest.fn(() => selectResponse); + + let spectator: SpectatorDirective; + const createDirective = createDirectiveFactory({ + directive: ReplaceableTemplateDirective, + providers: [{ provide: Store, useValue: { select: mockSelect } }], + declarations: [DefaultComponent, ExternalComponent], + entryComponents: [ExternalComponent], + }); + + describe('without external component', () => { + const twoWayChange = jest.fn(a => a); + const someOutput = jest.fn(a => a); + + beforeEach(() => { + spectator = createDirective( + ` +
    + +
    + `, + { hostProps: { oneWay: { label: 'Test' }, twoWay: false, twoWayChange, someOutput } }, + ); + selectResponse.next(undefined); + const component = spectator.query(DefaultComponent); + spectator.directive.context.initTemplate(component); + spectator.detectChanges(); + }); + + afterEach(() => twoWayChange.mockClear()); + + it('should display the default template when store response is undefined', () => { + expect(spectator.query('abp-default-component')).toBeTruthy(); + }); + + it('should be setted inputs and outputs', () => { + const component = spectator.query(DefaultComponent); + expect(component.oneWay).toEqual({ label: 'Test' }); + expect(component.twoWay).toEqual(false); + }); + + it('should change the component inputs', () => { + const component = spectator.query(DefaultComponent); + spectator.setHostInput({ oneWay: 'test' }); + component.setTwoWay(true); + component.someOutput.emit('someOutput emitted'); + expect(component.oneWay).toBe('test'); + expect(twoWayChange).toHaveBeenCalledWith(true); + expect(someOutput).toHaveBeenCalledWith('someOutput emitted'); + }); + }); + + describe('with external component', () => { + const twoWayChange = jest.fn(a => a); + const someOutput = jest.fn(a => a); + + beforeEach(() => { + spectator = createDirective( + ` +
    + +
    + `, + { hostProps: { oneWay: { label: 'Test' }, twoWay: false, twoWayChange, someOutput } }, + ); + selectResponse.next({ component: ExternalComponent, key: 'TestModule.TestComponent' }); + }); + + afterEach(() => twoWayChange.mockClear()); + + it('should display the external component', () => { + expect(spectator.query('p')).toHaveText('external'); + }); + + it('should be injected the data object', () => { + const externalComponent = spectator.query(ExternalComponent); + expect(externalComponent.data).toEqual({ + componentKey: 'TestModule.TestComponent', + inputs: { oneWay: { label: 'Test' }, twoWay: false }, + outputs: { someOutput, twoWayChange }, + }); + }); + + it('should be worked all data properties', () => { + const externalComponent = spectator.query(ExternalComponent); + spectator.setHostInput({ oneWay: 'test' }); + externalComponent.data.inputs.twoWay = true; + externalComponent.data.outputs.someOutput('someOutput emitted'); + expect(externalComponent.data.inputs.oneWay).toBe('test'); + expect(twoWayChange).toHaveBeenCalledWith(true); + expect(someOutput).toHaveBeenCalledWith('someOutput emitted'); + + spectator.setHostInput({ twoWay: 'twoWay test' }); + expect(externalComponent.data.inputs.twoWay).toBe('twoWay test'); + }); + + it('should be worked correctly the default component when the external component has been removed from store', () => { + expect(spectator.query('p')).toHaveText('external'); + const externalComponent = spectator.query(ExternalComponent); + spectator.setHostInput({ oneWay: 'test' }); + externalComponent.data.inputs.twoWay = true; + selectResponse.next({ component: null, key: 'TestModule.TestComponent' }); + spectator.detectChanges(); + const component = spectator.query(DefaultComponent); + spectator.directive.context.initTemplate(component); + expect(spectator.query('abp-default-component')).toBeTruthy(); + + expect(component.oneWay).toEqual('test'); + expect(component.twoWay).toEqual(true); + }); + + it('should reset default component subscriptions', () => { + selectResponse.next({ component: null, key: 'TestModule.TestComponent' }); + const component = spectator.query(DefaultComponent); + spectator.directive.context.initTemplate(component); + spectator.detectChanges(); + const unsubscribe = jest.fn(() => {}); + spectator.directive.defaultComponentSubscriptions.twoWayChange.unsubscribe = unsubscribe; + + selectResponse.next({ component: ExternalComponent, key: 'TestModule.TestComponent' }); + expect(unsubscribe).toHaveBeenCalled(); + }); + }); +}); diff --git a/npm/ng-packs/packages/feature-management/package.json b/npm/ng-packs/packages/feature-management/package.json index 036fc3a7cc..38cd5ffa9c 100644 --- a/npm/ng-packs/packages/feature-management/package.json +++ b/npm/ng-packs/packages/feature-management/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.feature-management", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "dependencies": { "@abp/ng.theme.shared": "^1.1.1" }, diff --git a/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts b/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts index 3a93380d39..b8aba035bd 100644 --- a/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts +++ b/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts @@ -10,8 +10,12 @@ import { pluck, finalize } from 'rxjs/operators'; @Component({ selector: 'abp-feature-management', templateUrl: './feature-management.component.html', + exportAs: 'abpFeatureManagement', }) -export class FeatureManagementComponent { +export class FeatureManagementComponent + implements + FeatureManagement.FeatureManagementComponentInputs, + FeatureManagement.FeatureManagementComponentOutputs { @Input() providerKey: string; diff --git a/npm/ng-packs/packages/feature-management/src/lib/models/feature-management.ts b/npm/ng-packs/packages/feature-management/src/lib/models/feature-management.ts index 05a0a28c99..fa0165ae2e 100644 --- a/npm/ng-packs/packages/feature-management/src/lib/models/feature-management.ts +++ b/npm/ng-packs/packages/feature-management/src/lib/models/feature-management.ts @@ -1,3 +1,5 @@ +import { EventEmitter } from '@angular/core'; + export namespace FeatureManagement { export interface State { features: Feature[]; @@ -26,4 +28,14 @@ export namespace FeatureManagement { providerName: string; providerKey: string; } + + export interface FeatureManagementComponentInputs { + visible: boolean; + readonly providerName: string; + readonly providerKey: string; + } + + export interface FeatureManagementComponentOutputs { + readonly visibleChange: EventEmitter; + } } diff --git a/npm/ng-packs/packages/identity-config/package.json b/npm/ng-packs/packages/identity-config/package.json index 2635e021b8..c4a75d9fec 100644 --- a/npm/ng-packs/packages/identity-config/package.json +++ b/npm/ng-packs/packages/identity-config/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.identity.config", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "publishConfig": { "access": "public" } diff --git a/npm/ng-packs/packages/identity/package.json b/npm/ng-packs/packages/identity/package.json index d6496e9266..0bebdd32b8 100644 --- a/npm/ng-packs/packages/identity/package.json +++ b/npm/ng-packs/packages/identity/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.identity", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "dependencies": { "@abp/ng.identity.config": "^1.1.1", "@abp/ng.permission-management": "^1.1.1", diff --git a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html index 0e8bd7ccd4..6c4f946c5a 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html @@ -163,9 +163,39 @@ + + + diff --git a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts index 5c6a38e12c..0bd4826699 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts +++ b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts @@ -49,6 +49,10 @@ export class RolesComponent implements OnInit { @ViewChild('formRef', { static: false, read: ElementRef }) formRef: ElementRef; + onVisiblePermissionChange = event => { + this.visiblePermissions = event; + }; + constructor( private confirmationService: ConfirmationService, private fb: FormBuilder, diff --git a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html index 9097ca87ea..e89d72ae72 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html @@ -78,7 +78,11 @@ {{ 'AbpIdentity::PhoneNumber' | abpLocalization }} - + @@ -259,8 +263,19 @@ diff --git a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts index b0cbacb324..1917113dc7 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts +++ b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts @@ -69,6 +69,10 @@ export class UsersComponent implements OnInit { trackByFn: TrackByFunction = (index, item) => Object.keys(item)[0] || index; + onVisiblePermissionChange = event => { + this.visiblePermissions = event; + }; + get roleGroups(): FormGroup[] { return snq(() => (this.form.get('roleNames') as FormArray).controls as FormGroup[], []); } diff --git a/npm/ng-packs/packages/identity/src/lib/identity-routing.module.ts b/npm/ng-packs/packages/identity/src/lib/identity-routing.module.ts index 96764a09ad..eff6a7ce98 100644 --- a/npm/ng-packs/packages/identity/src/lib/identity-routing.module.ts +++ b/npm/ng-packs/packages/identity/src/lib/identity-routing.module.ts @@ -1,6 +1,13 @@ -import { AuthGuard, DynamicLayoutComponent, PermissionGuard } from '@abp/ng.core'; -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; +import { + AuthGuard, + DynamicLayoutComponent, + PermissionGuard, + CoreModule, + ReplaceableRouteContainerComponent, + ReplaceableComponents, +} from '@abp/ng.core'; +import { NgModule, Type } from '@angular/core'; +import { RouterModule, Routes, Router, ActivatedRoute } from '@angular/router'; import { RolesComponent } from './components/roles/roles.component'; import { UsersComponent } from './components/users/users.component'; @@ -13,20 +20,32 @@ const routes: Routes = [ children: [ { path: 'roles', - component: RolesComponent, - data: { requiredPolicy: 'AbpIdentity.Roles' }, + component: ReplaceableRouteContainerComponent, + data: { + requiredPolicy: 'AbpIdentity.Roles', + replaceableComponent: { + key: 'Identity.RolesComponent', + defaultComponent: RolesComponent, + } as ReplaceableComponents.RouteData, + }, }, { path: 'users', - component: UsersComponent, - data: { requiredPolicy: 'AbpIdentity.Users' }, + component: ReplaceableRouteContainerComponent, + data: { + requiredPolicy: 'AbpIdentity.Users', + replaceableComponent: { + key: 'Identity.UsersComponent', + defaultComponent: UsersComponent, + } as ReplaceableComponents.RouteData, + }, }, ], }, ]; @NgModule({ - imports: [RouterModule.forChild(routes)], + imports: [RouterModule.forChild(routes), CoreModule], exports: [RouterModule], }) export class IdentityRoutingModule {} diff --git a/npm/ng-packs/packages/permission-management/package.json b/npm/ng-packs/packages/permission-management/package.json index c73b5ef95c..cc7fdddf2f 100644 --- a/npm/ng-packs/packages/permission-management/package.json +++ b/npm/ng-packs/packages/permission-management/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.permission-management", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "dependencies": { "@abp/ng.theme.shared": "^1.1.1" }, diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts index 6600c1bc7c..e61e838ff1 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts +++ b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts @@ -1,17 +1,7 @@ -import { - Component, - EventEmitter, - Input, - OnChanges, - OnInit, - Output, - Renderer2, - SimpleChanges, - TrackByFunction, -} from '@angular/core'; +import { Component, EventEmitter, Input, Output, Renderer2, TrackByFunction } from '@angular/core'; import { Select, Store } from '@ngxs/store'; -import { from, Observable } from 'rxjs'; -import { map, pluck, take, finalize } from 'rxjs/operators'; +import { Observable } from 'rxjs'; +import { finalize, map, pluck, take, tap } from 'rxjs/operators'; import { GetPermissions, UpdatePermissions } from '../actions/permission-management.actions'; import { PermissionManagement } from '../models/permission-management'; import { PermissionManagementState } from '../states/permission-management.state'; @@ -23,18 +13,22 @@ type PermissionWithMargin = PermissionManagement.Permission & { @Component({ selector: 'abp-permission-management', templateUrl: './permission-management.component.html', + exportAs: 'abpPermissionManagement', }) -export class PermissionManagementComponent implements OnInit, OnChanges { +export class PermissionManagementComponent + implements + PermissionManagement.PermissionManagementComponentInputs, + PermissionManagement.PermissionManagementComponentOutputs { @Input() - providerName: string; + readonly providerName: string; @Input() - providerKey: string; + readonly providerKey: string; @Input() - hideBadges = false; + readonly hideBadges = false; - protected _visible; + protected _visible = false; @Input() get visible(): boolean { @@ -42,13 +36,17 @@ export class PermissionManagementComponent implements OnInit, OnChanges { } set visible(value: boolean) { - if (!this.selectedGroup) return; + if (value === this._visible) return; - this._visible = value; - this.visibleChange.emit(value); - - if (!value) { + if (value) { + this.openModal().subscribe(() => { + this._visible = true; + this.visibleChange.emit(true); + }); + } else { this.selectedGroup = null; + this._visible = false; + this.visibleChange.emit(false); } } @@ -94,8 +92,6 @@ export class PermissionManagementComponent implements OnInit, OnChanges { constructor(private store: Store, private renderer: Renderer2) {} - ngOnInit(): void {} - getChecked(name: string) { return (this.permissions.find(per => per.name === name) || { isGranted: false }).isGranted; } @@ -237,36 +233,26 @@ export class PermissionManagementComponent implements OnInit, OnChanges { throw new Error('Provider Key and Provider Name are required.'); } - this.store + return this.store .dispatch( new GetPermissions({ providerKey: this.providerKey, providerName: this.providerName, }), ) - .pipe(pluck('PermissionManagementState', 'permissionRes')) - .subscribe((permissionRes: PermissionManagement.Response) => { - this.selectedGroup = permissionRes.groups[0]; - this.permissions = getPermissions(permissionRes.groups); - - this.visible = true; - }); + .pipe( + pluck('PermissionManagementState', 'permissionRes'), + tap((permissionRes: PermissionManagement.Response) => { + this.selectedGroup = permissionRes.groups[0]; + this.permissions = getPermissions(permissionRes.groups); + }), + ); } initModal() { this.setTabCheckboxState(); this.setGrantCheckboxState(); } - - ngOnChanges({ visible }: SimpleChanges): void { - if (!visible) return; - - if (visible.currentValue) { - this.openModal(); - } else if (visible.currentValue === false && this.visible) { - this.visible = false; - } - } } function findMargin( diff --git a/npm/ng-packs/packages/permission-management/src/lib/models/permission-management.ts b/npm/ng-packs/packages/permission-management/src/lib/models/permission-management.ts index cf5d3b2371..b1fe25dd44 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/models/permission-management.ts +++ b/npm/ng-packs/packages/permission-management/src/lib/models/permission-management.ts @@ -1,3 +1,5 @@ +import { EventEmitter } from '@angular/core'; + export namespace PermissionManagement { export interface State { permissionRes: Response; @@ -34,4 +36,15 @@ export namespace PermissionManagement { export interface UpdateRequest { permissions: MinimumPermission[]; } + + export interface PermissionManagementComponentInputs { + visible: boolean; + readonly providerName: string; + readonly providerKey: string; + readonly hideBadges: boolean; + } + + export interface PermissionManagementComponentOutputs { + readonly visibleChange: EventEmitter; + } } diff --git a/npm/ng-packs/packages/setting-management-config/package.json b/npm/ng-packs/packages/setting-management-config/package.json index 9ae896ed79..5f1606f414 100644 --- a/npm/ng-packs/packages/setting-management-config/package.json +++ b/npm/ng-packs/packages/setting-management-config/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.setting-management.config", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "publishConfig": { "access": "public" } diff --git a/npm/ng-packs/packages/setting-management/package.json b/npm/ng-packs/packages/setting-management/package.json index 237f712dbb..6144b81903 100644 --- a/npm/ng-packs/packages/setting-management/package.json +++ b/npm/ng-packs/packages/setting-management/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.setting-management", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "dependencies": { "@abp/ng.setting-management.config": "^1.1.1", "@abp/ng.theme.shared": "^1.1.1" diff --git a/npm/ng-packs/packages/setting-management/src/lib/setting-management-routing.module.ts b/npm/ng-packs/packages/setting-management/src/lib/setting-management-routing.module.ts index c3eb479d2d..d9a50073e1 100644 --- a/npm/ng-packs/packages/setting-management/src/lib/setting-management-routing.module.ts +++ b/npm/ng-packs/packages/setting-management/src/lib/setting-management-routing.module.ts @@ -1,14 +1,28 @@ +import { + DynamicLayoutComponent, + ReplaceableComponents, + ReplaceableRouteContainerComponent, +} from '@abp/ng.core'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { SettingManagementComponent } from './components/setting-management.component'; -import { DynamicLayoutComponent } from '@abp/ng.core'; const routes: Routes = [ { path: '', component: DynamicLayoutComponent, children: [ - { path: '', component: SettingManagementComponent, data: { requiredPolicy: 'AbpAccount.SettingManagement' } }, + { + path: '', + component: ReplaceableRouteContainerComponent, + data: { + requiredPolicy: 'AbpAccount.SettingManagement', + replaceableComponent: { + key: 'SettingManagement.SettingManagementComponent', + defaultComponent: SettingManagementComponent, + } as ReplaceableComponents.RouteData, + }, + }, ], }, ]; diff --git a/npm/ng-packs/packages/tenant-management-config/package.json b/npm/ng-packs/packages/tenant-management-config/package.json index d7751ef32c..9bbc6c48c7 100644 --- a/npm/ng-packs/packages/tenant-management-config/package.json +++ b/npm/ng-packs/packages/tenant-management-config/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.tenant-management.config", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "publishConfig": { "access": "public" } diff --git a/npm/ng-packs/packages/tenant-management/package.json b/npm/ng-packs/packages/tenant-management/package.json index de09a11ca4..0467507227 100644 --- a/npm/ng-packs/packages/tenant-management/package.json +++ b/npm/ng-packs/packages/tenant-management/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.tenant-management", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "dependencies": { "@abp/ng.feature-management": "^1.1.1", "@abp/ng.tenant-management.config": "^1.1.1", diff --git a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html index f4ac631533..6106ed7e1b 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html +++ b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html @@ -182,5 +182,18 @@ - + diff --git a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts index 402f37c280..0d77596270 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts @@ -94,6 +94,10 @@ export class TenantsComponent implements OnInit { } } + onVisibleFeaturesChange = (value: boolean) => { + this.visibleFeatures = value; + }; + constructor( private confirmationService: ConfirmationService, private tenantService: TenantManagementService, diff --git a/npm/ng-packs/packages/tenant-management/src/lib/tenant-management-routing.module.ts b/npm/ng-packs/packages/tenant-management/src/lib/tenant-management-routing.module.ts index 6723357c75..16e547e269 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/tenant-management-routing.module.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/tenant-management-routing.module.ts @@ -1,4 +1,10 @@ -import { AuthGuard, DynamicLayoutComponent, PermissionGuard } from '@abp/ng.core'; +import { + AuthGuard, + DynamicLayoutComponent, + PermissionGuard, + ReplaceableComponents, + ReplaceableRouteContainerComponent, +} from '@abp/ng.core'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { TenantsComponent } from './components/tenants/tenants.component'; @@ -6,11 +12,22 @@ import { TenantsComponent } from './components/tenants/tenants.component'; const routes: Routes = [ { path: '', redirectTo: 'tenants', pathMatch: 'full' }, { - path: 'tenants', + path: '', component: DynamicLayoutComponent, canActivate: [AuthGuard, PermissionGuard], - data: { requiredPolicy: 'AbpTenantManagement.Tenants' }, - children: [{ path: '', component: TenantsComponent }], + children: [ + { + path: 'tenants', + component: ReplaceableRouteContainerComponent, + data: { + requiredPolicy: 'AbpTenantManagement.Tenants', + replaceableComponent: { + key: 'TenantManagement.TenantsComponent', + defaultComponent: TenantsComponent, + } as ReplaceableComponents.RouteData, + }, + }, + ], }, ]; diff --git a/npm/ng-packs/packages/theme-basic/package.json b/npm/ng-packs/packages/theme-basic/package.json index 945be5c580..079b52ed22 100644 --- a/npm/ng-packs/packages/theme-basic/package.json +++ b/npm/ng-packs/packages/theme-basic/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.theme.basic", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "dependencies": { "@abp/ng.theme.shared": "^1.1.1" }, diff --git a/npm/ng-packs/packages/theme-shared/package.json b/npm/ng-packs/packages/theme-shared/package.json index 25806969b0..9972b3cfd1 100644 --- a/npm/ng-packs/packages/theme-shared/package.json +++ b/npm/ng-packs/packages/theme-shared/package.json @@ -1,6 +1,11 @@ { "name": "@abp/ng.theme.shared", "version": "1.1.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, "dependencies": { "@abp/ng.core": "^1.1.1", "@angular/cdk": "^8.2.3", diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts index 9ff4d1e24e..83bef06f26 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts @@ -19,9 +19,9 @@ import { ABP } from '@abp/ng.core'; [attr.type]="buttonType" [ngClass]="buttonClass" [disabled]="loading || disabled" - (click.stop)="abpClick.next($event)" - (focus)="abpFocus.next($event)" - (blur)="abpBlur.next($event)" + (click.stop)="click.next($event); abpClick.next($event)" + (focus)="focus.next($event); abpFocus.next($event)" + (blur)="blur.next($event); abpBlur.next($event)" > @@ -49,6 +49,14 @@ export class ButtonComponent implements OnInit { @Input() attributes: ABP.Dictionary; + // tslint:disable + @Output() readonly click = new EventEmitter(); + + @Output() readonly focus = new EventEmitter(); + + @Output() readonly blur = new EventEmitter(); + // tslint:enable + @Output() readonly abpClick = new EventEmitter(); @Output() readonly abpFocus = new EventEmitter(); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts b/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts index 99c651f736..30185ec6c6 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts @@ -45,13 +45,7 @@ export default ` } .modal-backdrop { - position: fixed; - top: 0; - left: 0; - width: calc(100% - 7px); - height: 100%; background-color: rgba(0, 0, 0, 0.6); - z-index: 1040; } .modal::-webkit-scrollbar { diff --git a/npm/ng-packs/scripts/build.js b/npm/ng-packs/scripts/build.ts similarity index 96% rename from npm/ng-packs/scripts/build.js rename to npm/ng-packs/scripts/build.ts index a38dd53a61..049b044033 100644 --- a/npm/ng-packs/scripts/build.js +++ b/npm/ng-packs/scripts/build.ts @@ -1,6 +1,4 @@ -// ESM syntax is supported. import execa from 'execa'; -import fse from 'fs-extra'; import program from 'commander'; (async () => { diff --git a/npm/ng-packs/scripts/index.js b/npm/ng-packs/scripts/index.js index a82d62f972..e69de29bb2 100644 --- a/npm/ng-packs/scripts/index.js +++ b/npm/ng-packs/scripts/index.js @@ -1,4 +0,0 @@ -// Set options as a parameter, environment variable, or rc file. -// eslint-disable-next-line no-global-assign -require = require('esm')(module /* , options */); -module.exports = require('./main.js'); diff --git a/npm/ng-packs/scripts/install-new-dependencies.js b/npm/ng-packs/scripts/install-new-dependencies.ts similarity index 97% rename from npm/ng-packs/scripts/install-new-dependencies.js rename to npm/ng-packs/scripts/install-new-dependencies.ts index c856631ffa..52f93f23d4 100644 --- a/npm/ng-packs/scripts/install-new-dependencies.js +++ b/npm/ng-packs/scripts/install-new-dependencies.ts @@ -1,4 +1,3 @@ -// ESM syntax is supported. import execa from 'execa'; import fse from 'fs-extra'; diff --git a/npm/ng-packs/scripts/package-lock.json b/npm/ng-packs/scripts/package-lock.json deleted file mode 100644 index fcce2fbb08..0000000000 --- a/npm/ng-packs/scripts/package-lock.json +++ /dev/null @@ -1,1382 +0,0 @@ -{ - "name": "scripts", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "ansi-bgblack": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-bgblack/-/ansi-bgblack-0.1.1.tgz", - "integrity": "sha1-poulAHiHcBtqr74/oNrf36juPKI=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-bgblue": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-bgblue/-/ansi-bgblue-0.1.1.tgz", - "integrity": "sha1-Z73ATtybm1J4lp2hlt6j11yMNhM=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-bgcyan": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-bgcyan/-/ansi-bgcyan-0.1.1.tgz", - "integrity": "sha1-WEiUJWAL3p9VBwaN2Wnr/bUP52g=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-bggreen": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-bggreen/-/ansi-bggreen-0.1.1.tgz", - "integrity": "sha1-TjGRJIUplD9DIelr8THRwTgWr0k=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-bgmagenta": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-bgmagenta/-/ansi-bgmagenta-0.1.1.tgz", - "integrity": "sha1-myhDLAduqpmUGGcqPvvhk5HCx6E=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-bgred": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-bgred/-/ansi-bgred-0.1.1.tgz", - "integrity": "sha1-p2+Sg4OCukMpCmwXeEJPmE1vEEE=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-bgwhite": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-bgwhite/-/ansi-bgwhite-0.1.1.tgz", - "integrity": "sha1-ZQRlE3elim7OzQMxmU5IAljhG6g=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-bgyellow": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-bgyellow/-/ansi-bgyellow-0.1.1.tgz", - "integrity": "sha1-w/4usIzUdmSAKeaHTRWgs49h1E8=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-black": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-black/-/ansi-black-0.1.1.tgz", - "integrity": "sha1-9hheiJNgslRaHsUMC/Bj/EMDJFM=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-blue": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-blue/-/ansi-blue-0.1.1.tgz", - "integrity": "sha1-FbgEmQ6S/JyoxUds6PaZd3wh7b8=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-bold": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-bold/-/ansi-bold-0.1.1.tgz", - "integrity": "sha1-PmOVCvWswq4uZw5vZ96xFdGl9QU=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-colors": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-0.2.0.tgz", - "integrity": "sha1-csMd4qDZoszQysMMyYI+6y9kNLU=", - "requires": { - "ansi-bgblack": "^0.1.1", - "ansi-bgblue": "^0.1.1", - "ansi-bgcyan": "^0.1.1", - "ansi-bggreen": "^0.1.1", - "ansi-bgmagenta": "^0.1.1", - "ansi-bgred": "^0.1.1", - "ansi-bgwhite": "^0.1.1", - "ansi-bgyellow": "^0.1.1", - "ansi-black": "^0.1.1", - "ansi-blue": "^0.1.1", - "ansi-bold": "^0.1.1", - "ansi-cyan": "^0.1.1", - "ansi-dim": "^0.1.1", - "ansi-gray": "^0.1.1", - "ansi-green": "^0.1.1", - "ansi-grey": "^0.1.1", - "ansi-hidden": "^0.1.1", - "ansi-inverse": "^0.1.1", - "ansi-italic": "^0.1.1", - "ansi-magenta": "^0.1.1", - "ansi-red": "^0.1.1", - "ansi-reset": "^0.1.1", - "ansi-strikethrough": "^0.1.1", - "ansi-underline": "^0.1.1", - "ansi-white": "^0.1.1", - "ansi-yellow": "^0.1.1", - "lazy-cache": "^2.0.1" - } - }, - "ansi-cyan": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", - "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-dim": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-dim/-/ansi-dim-0.1.1.tgz", - "integrity": "sha1-QN5MYDqoCG2Oeoa4/5mNXDbu/Ww=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-gray": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", - "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-green": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-green/-/ansi-green-0.1.1.tgz", - "integrity": "sha1-il2al55FjVfEDjNYCzc5C44Q0Pc=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-grey": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-grey/-/ansi-grey-0.1.1.tgz", - "integrity": "sha1-WdmLasK6GfilF5jphT+6eDOaM8E=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-hidden": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-hidden/-/ansi-hidden-0.1.1.tgz", - "integrity": "sha1-7WpMSY0rt8uyidvyqNHcyFZ/rg8=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-inverse": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-inverse/-/ansi-inverse-0.1.1.tgz", - "integrity": "sha1-tq9Fgm/oJr+1KKbHmIV5Q1XM0mk=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-italic": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-italic/-/ansi-italic-0.1.1.tgz", - "integrity": "sha1-EEdDRj9iXBQqA2c5z4XtpoiYbyM=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-magenta": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-magenta/-/ansi-magenta-0.1.1.tgz", - "integrity": "sha1-BjtboW+z8j4c/aKwfAqJ3hHkMK4=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-red": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", - "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "ansi-reset": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-reset/-/ansi-reset-0.1.1.tgz", - "integrity": "sha1-5+cSksPH3c1NYu9KbHwFmAkRw7c=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-strikethrough": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-strikethrough/-/ansi-strikethrough-0.1.1.tgz", - "integrity": "sha1-2Eh3FAss/wfRyT685pkE9oiF5Wg=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "ansi-underline": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-underline/-/ansi-underline-0.1.1.tgz", - "integrity": "sha1-38kg9Ml7WXfqFi34/7mIMIqqcaQ=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-white": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-white/-/ansi-white-0.1.1.tgz", - "integrity": "sha1-nHe3wZPF7pkuYBHTbsTJIbRXiUQ=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-wrap": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=" - }, - "ansi-yellow": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-yellow/-/ansi-yellow-0.1.1.tgz", - "integrity": "sha1-y5NW8vRscy8OMZnmEClVp32oPB0=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" - }, - "arr-swap": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arr-swap/-/arr-swap-1.0.1.tgz", - "integrity": "sha1-FHWQ7WX8gVvAf+8Jl8Llgj1kNTQ=", - "requires": { - "is-number": "^3.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "requires": { - "kind-of": "^3.0.2" - } - } - } - }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-syntax-trailing-function-commas": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", - "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=" - }, - "babel-plugin-transform-es2015-modules-commonjs": { - "version": "6.26.2", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz", - "integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==", - "requires": { - "babel-plugin-transform-strict-mode": "^6.24.1", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-types": "^6.26.0" - } - }, - "babel-plugin-transform-strict-mode": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", - "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-preset-node6": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/babel-preset-node6/-/babel-preset-node6-11.0.0.tgz", - "integrity": "sha1-CDWZRRckiYWinRj21GXasWu4p9g=", - "requires": { - "babel-plugin-syntax-trailing-function-commas": "^6.5.0", - "babel-plugin-transform-es2015-modules-commonjs": "^6.7.4" - } - }, - "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "babel-template": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", - "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", - "requires": { - "babel-runtime": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "lodash": "^4.17.4" - } - }, - "babel-traverse": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", - "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", - "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - } - }, - "babel-types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", - "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", - "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - } - }, - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "choices-separator": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/choices-separator/-/choices-separator-2.0.0.tgz", - "integrity": "sha1-kv0XYxgteQM/XFxR0Lo1LlVnxpY=", - "requires": { - "ansi-dim": "^0.1.1", - "debug": "^2.6.6", - "strip-color": "^0.1.0" - } - }, - "clone-deep": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-1.0.0.tgz", - "integrity": "sha512-hmJRX8x1QOJVV+GUjOBzi6iauhPqc9hIF6xitWRBbiPZOBb6vGo/mDRIK9P74RTKSQK7AE8B0DDWY/vpRrPmQw==", - "requires": { - "for-own": "^1.0.0", - "is-plain-object": "^2.0.4", - "kind-of": "^5.0.0", - "shallow-clone": "^1.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" - } - } - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "commander": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.0.1.tgz", - "integrity": "sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA==" - }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" - }, - "core-js": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", - "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==" - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "requires": { - "once": "^1.4.0" - } - }, - "error-symbol": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/error-symbol/-/error-symbol-0.1.0.tgz", - "integrity": "sha1-Ck2uN9YA0VopukU9jvkg8YRDM/Y=" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "esm": { - "version": "3.2.25", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", - "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" - }, - "execa": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/execa/-/execa-2.0.3.tgz", - "integrity": "sha512-iM124nlyGSrXmuyZF1EMe83ESY2chIYVyDRZKgmcDynid2Q2v/+GuE7gNMl6Sy9Niwf4MC0DDxagOxeMPjuLsw==", - "requires": { - "cross-spawn": "^6.0.5", - "get-stream": "^5.0.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^3.0.0", - "onetime": "^5.1.0", - "p-finally": "^2.0.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "requires": { - "is-extendable": "^0.1.0" - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" - }, - "for-own": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", - "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", - "requires": { - "for-in": "^1.0.1" - } - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", - "requires": { - "pump": "^3.0.0" - } - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==" - }, - "graceful-fs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", - "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==" - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "info-symbol": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/info-symbol/-/info-symbol-0.1.0.tgz", - "integrity": "sha1-J4QdcoZ920JCzWEtecEGM4gcang=" - }, - "invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "requires": { - "loose-envify": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "requires": { - "kind-of": "^6.0.0" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" - } - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "requires": { - "kind-of": "^6.0.0" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" - } - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" - } - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" - }, - "is-number": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-6.0.0.tgz", - "integrity": "sha512-Wu1VHeILBK8KAWJUAiSZQX94GmOE45Rg6/538fKwiloUu21KncEkYGPqob2oSZ5mUT73vLGrHQjKw3KMPwfDzg==" - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "requires": { - "isobject": "^3.0.1" - } - }, - "is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "^1.1.5" - } - }, - "koalas": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/koalas/-/koalas-1.0.2.tgz", - "integrity": "sha1-MYQz8HQjXbePrlZhoCqMpT7ilc0=" - }, - "lazy-cache": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", - "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", - "requires": { - "set-getter": "^0.1.0" - } - }, - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" - }, - "log-ok": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/log-ok/-/log-ok-0.1.1.tgz", - "integrity": "sha1-vqPdNqzQuKckDXhza1uXxlREozQ=", - "requires": { - "ansi-green": "^0.1.1", - "success-symbol": "^0.1.0" - } - }, - "log-utils": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/log-utils/-/log-utils-0.2.1.tgz", - "integrity": "sha1-pMIXoN2aUFFdm5ICBgkas9TgMc8=", - "requires": { - "ansi-colors": "^0.2.0", - "error-symbol": "^0.1.0", - "info-symbol": "^0.1.0", - "log-ok": "^0.1.1", - "success-symbol": "^0.1.0", - "time-stamp": "^1.0.1", - "warning-symbol": "^0.1.0" - } - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "requires": { - "object-visit": "^1.0.0" - } - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" - }, - "mixin-object": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", - "integrity": "sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4=", - "requires": { - "for-in": "^0.1.3", - "is-extendable": "^0.1.1" - }, - "dependencies": { - "for-in": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.8.tgz", - "integrity": "sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE=" - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" - }, - "npm-run-path": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-3.1.0.tgz", - "integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==", - "requires": { - "path-key": "^3.0.0" - }, - "dependencies": { - "path-key": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.0.tgz", - "integrity": "sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg==" - } - } - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" - } - } - } - } - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "requires": { - "isobject": "^3.0.0" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", - "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "p-finally": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", - "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==" - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" - }, - "pointer-symbol": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pointer-symbol/-/pointer-symbol-1.0.0.tgz", - "integrity": "sha1-YPkRAgTqepKbYmRKITFVQ8uz1Ec=" - }, - "prompt-actions": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/prompt-actions/-/prompt-actions-3.0.2.tgz", - "integrity": "sha512-dhz2Fl7vK+LPpmnQ/S/eSut4BnH4NZDLyddHKi5uTU/2PDn3grEMGkgsll16V5RpVUh/yxdiam0xsM0RD4xvtg==", - "requires": { - "debug": "^2.6.8" - } - }, - "prompt-base": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/prompt-base/-/prompt-base-4.1.0.tgz", - "integrity": "sha512-svGzgLUKZoqomz9SGMkf1hBG8Wl3K7JGuRCXc/Pv7xw8239hhaTBXrmjt7EXA9P/QZzdyT8uNWt9F/iJTXq75g==", - "requires": { - "component-emitter": "^1.2.1", - "debug": "^3.0.1", - "koalas": "^1.0.2", - "log-utils": "^0.2.1", - "prompt-actions": "^3.0.2", - "prompt-question": "^5.0.1", - "readline-ui": "^2.2.3", - "readline-utils": "^2.2.3", - "static-extend": "^0.1.2" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - } - } - }, - "prompt-choices": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/prompt-choices/-/prompt-choices-4.1.0.tgz", - "integrity": "sha512-ZNYLv6rW9z9n0WdwCkEuS+w5nUAGzRgtRt6GQ5aFNFz6MIcU7nHFlHOwZtzy7RQBk80KzUGPSRQphvMiQzB8pg==", - "requires": { - "arr-flatten": "^1.1.0", - "arr-swap": "^1.0.1", - "choices-separator": "^2.0.0", - "clone-deep": "^4.0.0", - "collection-visit": "^1.0.0", - "define-property": "^2.0.2", - "is-number": "^6.0.0", - "kind-of": "^6.0.2", - "koalas": "^1.0.2", - "log-utils": "^0.2.1", - "pointer-symbol": "^1.0.0", - "radio-symbol": "^2.0.0", - "set-value": "^3.0.0", - "strip-color": "^0.1.0", - "terminal-paginator": "^2.0.2", - "toggle-array": "^1.0.1" - }, - "dependencies": { - "clone-deep": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", - "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", - "requires": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - } - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" - }, - "shallow-clone": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", - "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", - "requires": { - "kind-of": "^6.0.2" - } - } - } - }, - "prompt-confirm": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/prompt-confirm/-/prompt-confirm-2.0.4.tgz", - "integrity": "sha512-X5lzbC8/kMNHdPOqQPfMKpH4VV2f7v2OTRJoN69ZYBirSwTeQaf9ZhmzPEO9ybMA0YV2Pha5MV27u2/U4ahWfg==", - "requires": { - "ansi-cyan": "^0.1.1", - "prompt-base": "^4.0.1" - } - }, - "prompt-question": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/prompt-question/-/prompt-question-5.0.2.tgz", - "integrity": "sha512-wreaLbbu8f5+7zXds199uiT11Ojp59Z4iBi6hONlSLtsKGTvL2UY8VglcxQ3t/X4qWIxsNCg6aT4O8keO65v6Q==", - "requires": { - "clone-deep": "^1.0.0", - "debug": "^3.0.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "kind-of": "^5.0.2", - "koalas": "^1.0.2", - "prompt-choices": "^4.0.5" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "requires": { - "ms": "^2.1.1" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - } - } - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "radio-symbol": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/radio-symbol/-/radio-symbol-2.0.0.tgz", - "integrity": "sha1-eqm/xQSFY21S3XbWqOYxspB5muE=", - "requires": { - "ansi-gray": "^0.1.1", - "ansi-green": "^0.1.1", - "is-windows": "^1.0.1" - } - }, - "readline-ui": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/readline-ui/-/readline-ui-2.2.3.tgz", - "integrity": "sha512-ix7jz0PxqQqcIuq3yQTHv1TOhlD2IHO74aNO+lSuXsRYm1d+pdyup1yF3zKyLK1wWZrVNGjkzw5tUegO2IDy+A==", - "requires": { - "component-emitter": "^1.2.1", - "debug": "^2.6.8", - "readline-utils": "^2.2.1", - "string-width": "^2.0.0" - } - }, - "readline-utils": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/readline-utils/-/readline-utils-2.2.3.tgz", - "integrity": "sha1-b4R9a48ZFcORtYHDZ81HhzhiNRo=", - "requires": { - "arr-flatten": "^1.1.0", - "extend-shallow": "^2.0.1", - "is-buffer": "^1.1.5", - "is-number": "^3.0.0", - "is-windows": "^1.0.1", - "koalas": "^1.0.2", - "mute-stream": "0.0.7", - "strip-color": "^0.1.0", - "window-size": "^1.1.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "requires": { - "kind-of": "^3.0.2" - } - } - } - }, - "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" - }, - "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" - }, - "set-getter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", - "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", - "requires": { - "to-object-path": "^0.3.0" - } - }, - "set-value": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-3.0.1.tgz", - "integrity": "sha512-w6n3GUPYAWQj4ZyHWzD7K2FnFXHx9OTwJYbWg+6nXjG8sCLfs9DGv+KlqglKIIJx+ks7MlFuwFW2RBPb+8V+xg==", - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "shallow-clone": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-1.0.0.tgz", - "integrity": "sha512-oeXreoKR/SyNJtRJMAKPDSvd28OqEwG4eR/xc856cRGBII7gX9lvAqDxusPm0846z/w/hWYjI1NpKwJ00NHzRA==", - "requires": { - "is-extendable": "^0.1.1", - "kind-of": "^5.0.0", - "mixin-object": "^2.0.1" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" - } - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" - } - } - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-color": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/strip-color/-/strip-color-0.1.0.tgz", - "integrity": "sha1-EG9l09PmotlAHKwOsM6LinArT3s=" - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" - }, - "success-symbol": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/success-symbol/-/success-symbol-0.1.0.tgz", - "integrity": "sha1-JAIuSG878c3KCUKDt2nEctO3KJc=" - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - }, - "terminal-paginator": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/terminal-paginator/-/terminal-paginator-2.0.2.tgz", - "integrity": "sha512-IZMT5ECF9p4s+sNCV8uvZSW9E1+9zy9Ji9xz2oee8Jfo7hUFpauyjxkhfRcIH6Lu3Wdepv5D1kVRc8Hx74/LfQ==", - "requires": { - "debug": "^2.6.6", - "extend-shallow": "^2.0.1", - "log-utils": "^0.2.1" - } - }, - "time-stamp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", - "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=" - }, - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=" - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "requires": { - "kind-of": "^3.0.2" - } - }, - "toggle-array": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toggle-array/-/toggle-array-1.0.1.tgz", - "integrity": "sha1-y/WEB5K9UJfzMReugkyTKv/ofVg=", - "requires": { - "isobject": "^3.0.0" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" - }, - "warning-symbol": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/warning-symbol/-/warning-symbol-0.1.0.tgz", - "integrity": "sha1-uzHdEbeg+dZ6su2V9Fe2WCW7rSE=" - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "requires": { - "isexe": "^2.0.0" - } - }, - "window-size": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-1.1.1.tgz", - "integrity": "sha512-5D/9vujkmVQ7pSmc0SCBmHXbkv6eaHwXEx65MywhmUMsI8sGqJ972APq1lotfcwMKPFLuCFfL8xGHLIp7jaBmA==", - "requires": { - "define-property": "^1.0.0", - "is-number": "^3.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "requires": { - "kind-of": "^3.0.2" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - } - } -} diff --git a/npm/ng-packs/scripts/package.json b/npm/ng-packs/scripts/package.json index 14e83b6d51..14550a8277 100644 --- a/npm/ng-packs/scripts/package.json +++ b/npm/ng-packs/scripts/package.json @@ -3,14 +3,12 @@ "version": "1.0.0", "description": "ABP helper scripts", "main": "index.js", - "modules": "[build.js, sync.js]", "scripts": { - "build": "node -r esm build.js", - "build:prod": "node -r esm prod-build.js", - "publish-packages": "node -r esm publish.js", - "install-new-dependencies": "node -r esm install-new-dependencies.js", - "sync": "node -r esm sync.js", - "test": "echo \"Error: no test specified\" && exit 1" + "build": "ts-node -r tsconfig-paths/register build.ts", + "build:prod": "ts-node -r tsconfig-paths/register prod-build.ts", + "publish-packages": "ts-node -r tsconfig-paths/register publish.ts", + "install-new-dependencies": "ts-node -r tsconfig-paths/register install-new-dependencies.ts", + "sync": "ts-node -r tsconfig-paths/register sync.ts" }, "author": "", "dependencies": { @@ -18,9 +16,13 @@ "commander": "^4.0.1", "execa": "^2.0.3", "fs-extra": "^8.1.0", - "prompt-confirm": "^2.0.4" + "prompt-confirm": "^2.0.4", + "typescript": "^3.7.4" }, "devDependencies": { - "esm": "^3.2.25" + "@types/node": "^13.1.2", + "esm": "^3.2.25", + "ts-node": "^8.5.4", + "tsconfig-paths": "^3.9.0" } } diff --git a/npm/ng-packs/scripts/prod-build.js b/npm/ng-packs/scripts/prod-build.ts similarity index 94% rename from npm/ng-packs/scripts/prod-build.js rename to npm/ng-packs/scripts/prod-build.ts index 2f204b11d7..a6bad4c8c9 100644 --- a/npm/ng-packs/scripts/prod-build.js +++ b/npm/ng-packs/scripts/prod-build.ts @@ -1,4 +1,3 @@ -// ESM syntax is supported. import execa from 'execa'; import fse from 'fs-extra'; diff --git a/npm/ng-packs/scripts/publish.js b/npm/ng-packs/scripts/publish.ts similarity index 98% rename from npm/ng-packs/scripts/publish.js rename to npm/ng-packs/scripts/publish.ts index f5698dedfa..04907b451f 100644 --- a/npm/ng-packs/scripts/publish.js +++ b/npm/ng-packs/scripts/publish.ts @@ -1,4 +1,3 @@ -// ESM syntax is supported. import execa from 'execa'; import fse from 'fs-extra'; diff --git a/npm/ng-packs/scripts/push.js b/npm/ng-packs/scripts/push.ts similarity index 100% rename from npm/ng-packs/scripts/push.js rename to npm/ng-packs/scripts/push.ts diff --git a/npm/ng-packs/scripts/sync.js b/npm/ng-packs/scripts/sync.ts similarity index 89% rename from npm/ng-packs/scripts/sync.js rename to npm/ng-packs/scripts/sync.ts index f2c08d0623..60615a1027 100644 --- a/npm/ng-packs/scripts/sync.js +++ b/npm/ng-packs/scripts/sync.ts @@ -1,4 +1,3 @@ -// ESM syntax is supported. import fse from 'fs-extra'; import execa from 'execa'; @@ -8,7 +7,9 @@ import execa from 'execa'; for (let i = 0; i < projectNames.length; i++) { const project = projectNames[i]; - const { dependencies: distDependencies, version } = await fse.readJson(`../dist/${project}/package.json`); + const { dependencies: distDependencies, version } = await fse.readJson( + `../dist/${project}/package.json`, + ); const srcPackagePath = `../packages/${project}/package.json`; const srcPackage = await fse.readJson(srcPackagePath); @@ -25,7 +26,9 @@ import execa from 'execa'; try { await execa('git', ['add', '../packages/*', '../package.json'], { stdout: 'inherit' }); - await execa('git', ['commit', '-m', 'Update source packages versions', '--no-verify'], { stdout: 'inherit' }); + await execa('git', ['commit', '-m', 'Update source packages versions', '--no-verify'], { + stdout: 'inherit', + }); } catch (error) { console.error(error.stderr); } diff --git a/npm/ng-packs/scripts/tsconfig.json b/npm/ng-packs/scripts/tsconfig.json new file mode 100644 index 0000000000..b8a62178eb --- /dev/null +++ b/npm/ng-packs/scripts/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es2017", + "sourceMap": true, + "outDir": "./dist", + "baseUrl": "./", + "incremental": true, + "esModuleInterop": true, + "types": ["node"] + }, + "exclude": ["node_modules", "dist"] +} diff --git a/npm/ng-packs/scripts/yarn.lock b/npm/ng-packs/scripts/yarn.lock new file mode 100644 index 0000000000..2e14671cb5 --- /dev/null +++ b/npm/ng-packs/scripts/yarn.lock @@ -0,0 +1,1203 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + +"@types/node@^13.1.2": + version "13.1.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.1.2.tgz#fe94285bf5e0782e1a9e5a8c482b1c34465fa385" + integrity sha512-B8emQA1qeKerqd1dmIsQYnXi+mmAzTB7flExjmy5X1aVAKFNNNDubkavwR13kR6JnpeLp3aLoJhwn9trWPAyFQ== + +ansi-bgblack@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgblack/-/ansi-bgblack-0.1.1.tgz#a68ba5007887701b6aafbe3fa0dadfdfa8ee3ca2" + integrity sha1-poulAHiHcBtqr74/oNrf36juPKI= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgblue@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgblue/-/ansi-bgblue-0.1.1.tgz#67bdc04edc9b9b5278969da196dea3d75c8c3613" + integrity sha1-Z73ATtybm1J4lp2hlt6j11yMNhM= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgcyan@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgcyan/-/ansi-bgcyan-0.1.1.tgz#58489425600bde9f5507068dd969ebfdb50fe768" + integrity sha1-WEiUJWAL3p9VBwaN2Wnr/bUP52g= + dependencies: + ansi-wrap "0.1.0" + +ansi-bggreen@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bggreen/-/ansi-bggreen-0.1.1.tgz#4e3191248529943f4321e96bf131d1c13816af49" + integrity sha1-TjGRJIUplD9DIelr8THRwTgWr0k= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgmagenta@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgmagenta/-/ansi-bgmagenta-0.1.1.tgz#9b28432c076eaa999418672a3efbe19391c2c7a1" + integrity sha1-myhDLAduqpmUGGcqPvvhk5HCx6E= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgred@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgred/-/ansi-bgred-0.1.1.tgz#a76f92838382ba43290a6c1778424f984d6f1041" + integrity sha1-p2+Sg4OCukMpCmwXeEJPmE1vEEE= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgwhite@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgwhite/-/ansi-bgwhite-0.1.1.tgz#6504651377a58a6ececd0331994e480258e11ba8" + integrity sha1-ZQRlE3elim7OzQMxmU5IAljhG6g= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgyellow@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgyellow/-/ansi-bgyellow-0.1.1.tgz#c3fe2eb08cd476648029e6874d15a0b38f61d44f" + integrity sha1-w/4usIzUdmSAKeaHTRWgs49h1E8= + dependencies: + ansi-wrap "0.1.0" + +ansi-black@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-black/-/ansi-black-0.1.1.tgz#f6185e889360b2545a1ec50c0bf063fc43032453" + integrity sha1-9hheiJNgslRaHsUMC/Bj/EMDJFM= + dependencies: + ansi-wrap "0.1.0" + +ansi-blue@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-blue/-/ansi-blue-0.1.1.tgz#15b804990e92fc9ca8c5476ce8f699777c21edbf" + integrity sha1-FbgEmQ6S/JyoxUds6PaZd3wh7b8= + dependencies: + ansi-wrap "0.1.0" + +ansi-bold@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bold/-/ansi-bold-0.1.1.tgz#3e63950af5acc2ae2e670e6f67deb115d1a5f505" + integrity sha1-PmOVCvWswq4uZw5vZ96xFdGl9QU= + dependencies: + ansi-wrap "0.1.0" + +ansi-colors@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-0.2.0.tgz#72c31de2a0d9a2ccd0cac30cc9823eeb2f6434b5" + integrity sha1-csMd4qDZoszQysMMyYI+6y9kNLU= + dependencies: + ansi-bgblack "^0.1.1" + ansi-bgblue "^0.1.1" + ansi-bgcyan "^0.1.1" + ansi-bggreen "^0.1.1" + ansi-bgmagenta "^0.1.1" + ansi-bgred "^0.1.1" + ansi-bgwhite "^0.1.1" + ansi-bgyellow "^0.1.1" + ansi-black "^0.1.1" + ansi-blue "^0.1.1" + ansi-bold "^0.1.1" + ansi-cyan "^0.1.1" + ansi-dim "^0.1.1" + ansi-gray "^0.1.1" + ansi-green "^0.1.1" + ansi-grey "^0.1.1" + ansi-hidden "^0.1.1" + ansi-inverse "^0.1.1" + ansi-italic "^0.1.1" + ansi-magenta "^0.1.1" + ansi-red "^0.1.1" + ansi-reset "^0.1.1" + ansi-strikethrough "^0.1.1" + ansi-underline "^0.1.1" + ansi-white "^0.1.1" + ansi-yellow "^0.1.1" + lazy-cache "^2.0.1" + +ansi-cyan@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873" + integrity sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM= + dependencies: + ansi-wrap "0.1.0" + +ansi-dim@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-dim/-/ansi-dim-0.1.1.tgz#40de4c603aa8086d8e7a86b8ff998d5c36eefd6c" + integrity sha1-QN5MYDqoCG2Oeoa4/5mNXDbu/Ww= + dependencies: + ansi-wrap "0.1.0" + +ansi-gray@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" + integrity sha1-KWLPVOyXksSFEKPetSRDaGHvclE= + dependencies: + ansi-wrap "0.1.0" + +ansi-green@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-green/-/ansi-green-0.1.1.tgz#8a5d9a979e458d57c40e33580b37390b8e10d0f7" + integrity sha1-il2al55FjVfEDjNYCzc5C44Q0Pc= + dependencies: + ansi-wrap "0.1.0" + +ansi-grey@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-grey/-/ansi-grey-0.1.1.tgz#59d98b6ac2ba19f8a51798e9853fba78339a33c1" + integrity sha1-WdmLasK6GfilF5jphT+6eDOaM8E= + dependencies: + ansi-wrap "0.1.0" + +ansi-hidden@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-hidden/-/ansi-hidden-0.1.1.tgz#ed6a4c498d2bb7cbb289dbf2a8d1dcc8567fae0f" + integrity sha1-7WpMSY0rt8uyidvyqNHcyFZ/rg8= + dependencies: + ansi-wrap "0.1.0" + +ansi-inverse@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-inverse/-/ansi-inverse-0.1.1.tgz#b6af45826fe826bfb528a6c79885794355ccd269" + integrity sha1-tq9Fgm/oJr+1KKbHmIV5Q1XM0mk= + dependencies: + ansi-wrap "0.1.0" + +ansi-italic@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-italic/-/ansi-italic-0.1.1.tgz#104743463f625c142a036739cf85eda688986f23" + integrity sha1-EEdDRj9iXBQqA2c5z4XtpoiYbyM= + dependencies: + ansi-wrap "0.1.0" + +ansi-magenta@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-magenta/-/ansi-magenta-0.1.1.tgz#063b5ba16fb3f23e1cfda2b07c0a89de11e430ae" + integrity sha1-BjtboW+z8j4c/aKwfAqJ3hHkMK4= + dependencies: + ansi-wrap "0.1.0" + +ansi-red@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c" + integrity sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw= + dependencies: + ansi-wrap "0.1.0" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-reset@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-reset/-/ansi-reset-0.1.1.tgz#e7e71292c3c7ddcd4d62ef4a6c7c05980911c3b7" + integrity sha1-5+cSksPH3c1NYu9KbHwFmAkRw7c= + dependencies: + ansi-wrap "0.1.0" + +ansi-strikethrough@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-strikethrough/-/ansi-strikethrough-0.1.1.tgz#d84877140b2cff07d1c93ebce69904f68885e568" + integrity sha1-2Eh3FAss/wfRyT685pkE9oiF5Wg= + dependencies: + ansi-wrap "0.1.0" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= + +ansi-underline@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-underline/-/ansi-underline-0.1.1.tgz#dfc920f4c97b5977ea162df8ffb988308aaa71a4" + integrity sha1-38kg9Ml7WXfqFi34/7mIMIqqcaQ= + dependencies: + ansi-wrap "0.1.0" + +ansi-white@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-white/-/ansi-white-0.1.1.tgz#9c77b7c193c5ee992e6011d36ec4c921b4578944" + integrity sha1-nHe3wZPF7pkuYBHTbsTJIbRXiUQ= + dependencies: + ansi-wrap "0.1.0" + +ansi-wrap@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" + integrity sha1-qCJQ3bABXponyoLoLqYDu/pF768= + +ansi-yellow@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-yellow/-/ansi-yellow-0.1.1.tgz#cb9356f2f46c732f0e3199e6102955a77da83c1d" + integrity sha1-y5NW8vRscy8OMZnmEClVp32oPB0= + dependencies: + ansi-wrap "0.1.0" + +arg@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.2.tgz#e70c90579e02c63d80e3ad4e31d8bfdb8bd50064" + integrity sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg== + +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-swap@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arr-swap/-/arr-swap-1.0.1.tgz#147590ed65fc815bc07fef0997c2e5823d643534" + integrity sha1-FHWQ7WX8gVvAf+8Jl8Llgj1kNTQ= + dependencies: + is-number "^3.0.0" + +babel-code-frame@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + integrity sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-syntax-trailing-function-commas@^6.5.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" + integrity sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM= + +babel-plugin-transform-es2015-modules-commonjs@^6.7.4: + version "6.26.2" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz#58a793863a9e7ca870bdc5a881117ffac27db6f3" + integrity sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q== + dependencies: + babel-plugin-transform-strict-mode "^6.24.1" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-types "^6.26.0" + +babel-plugin-transform-strict-mode@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" + integrity sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g= + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-preset-node6@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/babel-preset-node6/-/babel-preset-node6-11.0.0.tgz#0835994517248985a29d18f6d465dab16bb8a7d8" + integrity sha1-CDWZRRckiYWinRj21GXasWu4p9g= + dependencies: + babel-plugin-syntax-trailing-function-commas "^6.5.0" + babel-plugin-transform-es2015-modules-commonjs "^6.7.4" + +babel-runtime@^6.22.0, babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-template@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + integrity sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI= + dependencies: + babel-runtime "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + lodash "^4.17.4" + +babel-traverse@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + integrity sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-types@^6.24.1, babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +choices-separator@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/choices-separator/-/choices-separator-2.0.0.tgz#92fd1763182d79033f5c5c51d0ba352e5567c696" + integrity sha1-kv0XYxgteQM/XFxR0Lo1LlVnxpY= + dependencies: + ansi-dim "^0.1.1" + debug "^2.6.6" + strip-color "^0.1.0" + +clone-deep@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-1.0.0.tgz#b2f354444b5d4a0ce58faca337ef34da2b14a6c7" + integrity sha512-hmJRX8x1QOJVV+GUjOBzi6iauhPqc9hIF6xitWRBbiPZOBb6vGo/mDRIK9P74RTKSQK7AE8B0DDWY/vpRrPmQw== + dependencies: + for-own "^1.0.0" + is-plain-object "^2.0.4" + kind-of "^5.0.0" + shallow-clone "^1.0.0" + +clone-deep@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +commander@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.0.1.tgz#b67622721785993182e807f4883633e6401ba53c" + integrity sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA== + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js@^2.4.0: + version "2.6.11" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" + integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== + +cross-spawn@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" + integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +debug@^2.6.6, debug@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^3.0.1: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +diff@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" + integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +error-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/error-symbol/-/error-symbol-0.1.0.tgz#0a4dae37d600d15a29ba453d8ef920f1844333f6" + integrity sha1-Ck2uN9YA0VopukU9jvkg8YRDM/Y= + +escape-string-regexp@^1.0.2: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +esm@^3.2.25: + version "3.2.25" + resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" + integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +execa@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-2.1.0.tgz#e5d3ecd837d2a60ec50f3da78fd39767747bbe99" + integrity sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^3.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +for-in@^0.1.3: + version "0.1.8" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1" + integrity sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE= + +for-in@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +for-own@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-1.0.0.tgz#c63332f415cedc4b04dbfe70cf836494c53cb44b" + integrity sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs= + dependencies: + for-in "^1.0.1" + +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + +get-stream@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" + integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== + dependencies: + pump "^3.0.0" + +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== + +graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" + integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= + dependencies: + ansi-regex "^2.0.0" + +info-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/info-symbol/-/info-symbol-0.1.0.tgz#27841d72867ddb4242cd612d79c10633881c6a78" + integrity sha1-J4QdcoZ920JCzWEtecEGM4gcang= + +invariant@^2.2.2: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-number@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-6.0.0.tgz#e6d15ad31fc262887cccf217ae5f9316f81b1995" + integrity sha512-Wu1VHeILBK8KAWJUAiSZQX94GmOE45Rg6/538fKwiloUu21KncEkYGPqob2oSZ5mUT73vLGrHQjKw3KMPwfDzg== + +is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + +is-windows@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +"js-tokens@^3.0.0 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= + +json5@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" + integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + dependencies: + minimist "^1.2.0" + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + +kind-of@^3.0.2, kind-of@^3.0.3: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0, kind-of@^5.0.2: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + +koalas@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/koalas/-/koalas-1.0.2.tgz#318433f074235db78fae5661a02a8ca53ee295cd" + integrity sha1-MYQz8HQjXbePrlZhoCqMpT7ilc0= + +lazy-cache@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-2.0.2.tgz#b9190a4f913354694840859f8a8f7084d8822264" + integrity sha1-uRkKT5EzVGlIQIWfio9whNiCImQ= + dependencies: + set-getter "^0.1.0" + +lodash@^4.17.4: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + +log-ok@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/log-ok/-/log-ok-0.1.1.tgz#bea3dd36acd0b8a7240d78736b5b97c65444a334" + integrity sha1-vqPdNqzQuKckDXhza1uXxlREozQ= + dependencies: + ansi-green "^0.1.1" + success-symbol "^0.1.0" + +log-utils@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/log-utils/-/log-utils-0.2.1.tgz#a4c217a0dd9a50515d9b920206091ab3d4e031cf" + integrity sha1-pMIXoN2aUFFdm5ICBgkas9TgMc8= + dependencies: + ansi-colors "^0.2.0" + error-symbol "^0.1.0" + info-symbol "^0.1.0" + log-ok "^0.1.1" + success-symbol "^0.1.0" + time-stamp "^1.0.1" + warning-symbol "^0.1.0" + +loose-envify@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +make-error@^1.1.1: + version "1.3.5" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" + integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + +mixin-object@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/mixin-object/-/mixin-object-2.0.1.tgz#4fb949441dab182540f1fe035ba60e1947a5e57e" + integrity sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4= + dependencies: + for-in "^0.1.3" + is-extendable "^0.1.1" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + +npm-run-path@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-3.1.0.tgz#7f91be317f6a466efed3c9f2980ad8a4ee8b0fa5" + integrity sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg== + dependencies: + path-key "^3.0.0" + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== + dependencies: + mimic-fn "^2.1.0" + +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +pointer-symbol@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pointer-symbol/-/pointer-symbol-1.0.0.tgz#60f9110204ea7a929b62644a21315543cbb3d447" + integrity sha1-YPkRAgTqepKbYmRKITFVQ8uz1Ec= + +prompt-actions@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/prompt-actions/-/prompt-actions-3.0.2.tgz#537eee52241c940379f354a06eae8528e44ceeba" + integrity sha512-dhz2Fl7vK+LPpmnQ/S/eSut4BnH4NZDLyddHKi5uTU/2PDn3grEMGkgsll16V5RpVUh/yxdiam0xsM0RD4xvtg== + dependencies: + debug "^2.6.8" + +prompt-base@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/prompt-base/-/prompt-base-4.1.0.tgz#7b88e4c01b096c83d2f4e501a7e85f0d369ecd1f" + integrity sha512-svGzgLUKZoqomz9SGMkf1hBG8Wl3K7JGuRCXc/Pv7xw8239hhaTBXrmjt7EXA9P/QZzdyT8uNWt9F/iJTXq75g== + dependencies: + component-emitter "^1.2.1" + debug "^3.0.1" + koalas "^1.0.2" + log-utils "^0.2.1" + prompt-actions "^3.0.2" + prompt-question "^5.0.1" + readline-ui "^2.2.3" + readline-utils "^2.2.3" + static-extend "^0.1.2" + +prompt-choices@^4.0.5: + version "4.1.0" + resolved "https://registry.yarnpkg.com/prompt-choices/-/prompt-choices-4.1.0.tgz#6094202c4e55d0762e49c1e53735727e53fd484f" + integrity sha512-ZNYLv6rW9z9n0WdwCkEuS+w5nUAGzRgtRt6GQ5aFNFz6MIcU7nHFlHOwZtzy7RQBk80KzUGPSRQphvMiQzB8pg== + dependencies: + arr-flatten "^1.1.0" + arr-swap "^1.0.1" + choices-separator "^2.0.0" + clone-deep "^4.0.0" + collection-visit "^1.0.0" + define-property "^2.0.2" + is-number "^6.0.0" + kind-of "^6.0.2" + koalas "^1.0.2" + log-utils "^0.2.1" + pointer-symbol "^1.0.0" + radio-symbol "^2.0.0" + set-value "^3.0.0" + strip-color "^0.1.0" + terminal-paginator "^2.0.2" + toggle-array "^1.0.1" + +prompt-confirm@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/prompt-confirm/-/prompt-confirm-2.0.4.tgz#42c06907333e876f2ae8867281e0b9521a4796ca" + integrity sha512-X5lzbC8/kMNHdPOqQPfMKpH4VV2f7v2OTRJoN69ZYBirSwTeQaf9ZhmzPEO9ybMA0YV2Pha5MV27u2/U4ahWfg== + dependencies: + ansi-cyan "^0.1.1" + prompt-base "^4.0.1" + +prompt-question@^5.0.1: + version "5.0.2" + resolved "https://registry.yarnpkg.com/prompt-question/-/prompt-question-5.0.2.tgz#81a479f38f0bafecc758e5d6f7bc586e599610b3" + integrity sha512-wreaLbbu8f5+7zXds199uiT11Ojp59Z4iBi6hONlSLtsKGTvL2UY8VglcxQ3t/X4qWIxsNCg6aT4O8keO65v6Q== + dependencies: + clone-deep "^1.0.0" + debug "^3.0.1" + define-property "^1.0.0" + isobject "^3.0.1" + kind-of "^5.0.2" + koalas "^1.0.2" + prompt-choices "^4.0.5" + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +radio-symbol@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/radio-symbol/-/radio-symbol-2.0.0.tgz#7aa9bfc50485636d52dd76d6a8e631b290799ae1" + integrity sha1-eqm/xQSFY21S3XbWqOYxspB5muE= + dependencies: + ansi-gray "^0.1.1" + ansi-green "^0.1.1" + is-windows "^1.0.1" + +readline-ui@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/readline-ui/-/readline-ui-2.2.3.tgz#9e873a7668bbd8ca8a5573ce810a6bafb70a5089" + integrity sha512-ix7jz0PxqQqcIuq3yQTHv1TOhlD2IHO74aNO+lSuXsRYm1d+pdyup1yF3zKyLK1wWZrVNGjkzw5tUegO2IDy+A== + dependencies: + component-emitter "^1.2.1" + debug "^2.6.8" + readline-utils "^2.2.1" + string-width "^2.0.0" + +readline-utils@^2.2.1, readline-utils@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/readline-utils/-/readline-utils-2.2.3.tgz#6f847d6b8f1915c391b581c367cd47873862351a" + integrity sha1-b4R9a48ZFcORtYHDZ81HhzhiNRo= + dependencies: + arr-flatten "^1.1.0" + extend-shallow "^2.0.1" + is-buffer "^1.1.5" + is-number "^3.0.0" + is-windows "^1.0.1" + koalas "^1.0.2" + mute-stream "0.0.7" + strip-color "^0.1.0" + window-size "^1.1.0" + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + +set-getter@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" + integrity sha1-12nBgsnVpR9AkUXy+6guXoboA3Y= + dependencies: + to-object-path "^0.3.0" + +set-value@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-3.0.1.tgz#52c82af7653ba69eb1db92e81f5cdb32739b9e95" + integrity sha512-w6n3GUPYAWQj4ZyHWzD7K2FnFXHx9OTwJYbWg+6nXjG8sCLfs9DGv+KlqglKIIJx+ks7MlFuwFW2RBPb+8V+xg== + dependencies: + is-plain-object "^2.0.4" + +shallow-clone@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-1.0.0.tgz#4480cd06e882ef68b2ad88a3ea54832e2c48b571" + integrity sha512-oeXreoKR/SyNJtRJMAKPDSvd28OqEwG4eR/xc856cRGBII7gX9lvAqDxusPm0846z/w/hWYjI1NpKwJ00NHzRA== + dependencies: + is-extendable "^0.1.1" + kind-of "^5.0.0" + mixin-object "^2.0.1" + +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +source-map-support@^0.5.6: + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +static-extend@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +string-width@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + +strip-color@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/strip-color/-/strip-color-0.1.0.tgz#106f65d3d3e6a2d9401cac0eb0ce8b8a702b4f7b" + integrity sha1-EG9l09PmotlAHKwOsM6LinArT3s= + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +success-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/success-symbol/-/success-symbol-0.1.0.tgz#24022e486f3bf1cdca094283b769c472d3b72897" + integrity sha1-JAIuSG878c3KCUKDt2nEctO3KJc= + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= + +terminal-paginator@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/terminal-paginator/-/terminal-paginator-2.0.2.tgz#967e66056f28fe8f55ba7c1eebfb7c3ef371c1d3" + integrity sha512-IZMT5ECF9p4s+sNCV8uvZSW9E1+9zy9Ji9xz2oee8Jfo7hUFpauyjxkhfRcIH6Lu3Wdepv5D1kVRc8Hx74/LfQ== + dependencies: + debug "^2.6.6" + extend-shallow "^2.0.1" + log-utils "^0.2.1" + +time-stamp@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" + integrity sha1-dkpaEa9QVhkhsTPztE5hhofg9cM= + +to-fast-properties@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +toggle-array@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toggle-array/-/toggle-array-1.0.1.tgz#cbf5840792bd5097f33117ae824c932affe87d58" + integrity sha1-y/WEB5K9UJfzMReugkyTKv/ofVg= + dependencies: + isobject "^3.0.0" + +ts-node@^8.5.4: + version "8.5.4" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.5.4.tgz#a152add11fa19c221d0b48962c210cf467262ab2" + integrity sha512-izbVCRV68EasEPQ8MSIGBNK9dc/4sYJJKYA+IarMQct1RtEot6Xp0bXuClsbUSnKpg50ho+aOAx8en5c+y4OFw== + dependencies: + arg "^4.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.6" + yn "^3.0.0" + +tsconfig-paths@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" + integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + +typescript@^3.7.4: + version "3.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19" + integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw== + +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +warning-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/warning-symbol/-/warning-symbol-0.1.0.tgz#bb31dd11b7a0f9d67ab2ed95f457b65825bbad21" + integrity sha1-uzHdEbeg+dZ6su2V9Fe2WCW7rSE= + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +window-size@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-1.1.1.tgz#9858586580ada78ab26ecd6978a6e03115c1af20" + integrity sha512-5D/9vujkmVQ7pSmc0SCBmHXbkv6eaHwXEx65MywhmUMsI8sGqJ972APq1lotfcwMKPFLuCFfL8xGHLIp7jaBmA== + dependencies: + define-property "^1.0.0" + is-number "^3.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +yn@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== diff --git a/npm/ng-packs/yarn.lock b/npm/ng-packs/yarn.lock index e1eb7b85f3..e0af31cd07 100644 --- a/npm/ng-packs/yarn.lock +++ b/npm/ng-packs/yarn.lock @@ -132,26 +132,26 @@ jest-preset-angular "^7.1.1" lodash "^4.17.10" -"@angular-devkit/architect@0.803.20": - version "0.803.20" - resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.803.20.tgz#792093259d69012c0763aa9176181b255d8795c8" - integrity sha512-NjyDJ61i9kh8J+qXt0E2j+P5Xsmi2mPasBzwcQyrZZGiho4zC0IFxcdxyzcsXFEupmilJKkjdt2g4QQRC5rUDQ== +"@angular-devkit/architect@0.803.21": + version "0.803.21" + resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.803.21.tgz#0e76b6f646ebdbd9bb88d3972b2ca66fed950f7d" + integrity sha512-E2K/YexIWVyKM/xmyxvDjkJf+wX9u4c8YYpNaK4htsRzA06juc7N1MhlL/jURZiRl5b/K9sapYeq3tMX76saxA== dependencies: - "@angular-devkit/core" "8.3.20" + "@angular-devkit/core" "8.3.21" rxjs "6.4.0" -"@angular-devkit/build-angular@~0.803.20": - version "0.803.20" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-0.803.20.tgz#b19b0d82c75cbdd939b589a33ccb60e2c9f6eec9" - integrity sha512-JDZkZjOqPbOtCMsSKxQf9C+uSTZ7fQGlKGsCpJMzfa4iQ0WrmrhZvnRKQeEpMTTZTpuou/HQeQjyDV+Sx3yumw== - dependencies: - "@angular-devkit/architect" "0.803.20" - "@angular-devkit/build-optimizer" "0.803.20" - "@angular-devkit/build-webpack" "0.803.20" - "@angular-devkit/core" "8.3.20" - "@babel/core" "7.5.5" - "@babel/preset-env" "7.5.5" - "@ngtools/webpack" "8.3.20" +"@angular-devkit/build-angular@~0.803.21": + version "0.803.21" + resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-0.803.21.tgz#f3d12ea09748b05eb2d835a7de7997599fb6b752" + integrity sha512-flfgflvfpwdsm3x/U7QnfbtyZPEbsVipzQAoao1Zo58Beq1a+NsKsWbjrF/x4TSoI2czt0OVWXNytlfXM7LMhg== + dependencies: + "@angular-devkit/architect" "0.803.21" + "@angular-devkit/build-optimizer" "0.803.21" + "@angular-devkit/build-webpack" "0.803.21" + "@angular-devkit/core" "8.3.21" + "@babel/core" "7.7.5" + "@babel/preset-env" "7.7.6" + "@ngtools/webpack" "8.3.21" ajv "6.10.2" autoprefixer "9.6.1" browserslist "4.6.6" @@ -159,7 +159,7 @@ caniuse-lite "1.0.30000989" circular-dependency-plugin "5.2.0" clean-css "4.2.1" - copy-webpack-plugin "5.0.4" + copy-webpack-plugin "5.1.1" core-js "3.2.1" file-loader "4.2.0" find-cache-dir "3.0.0" @@ -192,7 +192,7 @@ stylus "0.54.5" stylus-loader "3.0.2" terser "4.3.9" - terser-webpack-plugin "1.4.1" + terser-webpack-plugin "1.4.3" tree-kill "1.2.1" webpack "4.39.2" webpack-dev-middleware "3.7.2" @@ -202,18 +202,18 @@ webpack-subresource-integrity "1.1.0-rc.6" worker-plugin "3.2.0" -"@angular-devkit/build-ng-packagr@~0.803.20": - version "0.803.20" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-ng-packagr/-/build-ng-packagr-0.803.20.tgz#d5fcef89580b4077a27c77be078cfeb0c77e71f7" - integrity sha512-4ccjjxfBFUDtz+P0tlxWaPgxlnZZmDAVDocbLPb0tba4f5onbKDn6cnoLxn/gEDRiXOTYuUhSvIH3BI9GcCDiw== +"@angular-devkit/build-ng-packagr@~0.803.21": + version "0.803.21" + resolved "https://registry.yarnpkg.com/@angular-devkit/build-ng-packagr/-/build-ng-packagr-0.803.21.tgz#6c71d9ddfb005176385b71b45ed463451ea0f55b" + integrity sha512-GqBq06pSvEu3szJQExnpNI3P0XGl2lk1ud1FXzSWuMBKEmU+IfSanlFsLBOqCKhtbSHjTz0mkV0DjVFyaBKmrg== dependencies: - "@angular-devkit/architect" "0.803.20" + "@angular-devkit/architect" "0.803.21" rxjs "6.4.0" -"@angular-devkit/build-optimizer@0.803.20": - version "0.803.20" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-optimizer/-/build-optimizer-0.803.20.tgz#36f92c350c1cb3d3d7f1e0f0086feed726478902" - integrity sha512-Vzxf1g1EuzaPBoScDYUhyxemi5chlgnpWmObNo5dzVAVzjxo5gJeDIGpiyDqHvr6LBkprqb6XHcZhMWqIcdIHg== +"@angular-devkit/build-optimizer@0.803.21": + version "0.803.21" + resolved "https://registry.yarnpkg.com/@angular-devkit/build-optimizer/-/build-optimizer-0.803.21.tgz#ecb3b6bba4b13ffbfbdbefb5997f690aa3635203" + integrity sha512-gNN6kPaF4phZco3TmsrNr9tIEKXYsoSeoaUiDUfgmCYwa7fAqM8Ojh7HX6IQuB2PpVmEwKGlCcSh6xDtB33NjA== dependencies: loader-utils "1.2.3" source-map "0.7.3" @@ -221,13 +221,13 @@ typescript "3.5.3" webpack-sources "1.4.3" -"@angular-devkit/build-webpack@0.803.20": - version "0.803.20" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.803.20.tgz#c03bd23a9f147c07201db681bf9fc3bfad95f9d9" - integrity sha512-35af8kD3KG/cIv7AB09YNER5HIPlx55ipBxdVk8D+X3MuUcTmD6fFvqXcV0EPlD1vQephthfzSgtNpvuPv4xuA== +"@angular-devkit/build-webpack@0.803.21": + version "0.803.21" + resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.803.21.tgz#fd45754c0123f44fcde8fa6411ebea52d98054f0" + integrity sha512-zCFVla/Xdk8qGVybvnHtoKml2h0/ShasSjT55VNZO1XaTCMqYkQEwwqSGEiVajpauafWjKrKxxBhsmWoI4efAA== dependencies: - "@angular-devkit/architect" "0.803.20" - "@angular-devkit/core" "8.3.20" + "@angular-devkit/architect" "0.803.21" + "@angular-devkit/core" "8.3.21" rxjs "6.4.0" "@angular-devkit/core@7.3.9", "@angular-devkit/core@^7.3.6": @@ -252,12 +252,23 @@ rxjs "6.4.0" source-map "0.7.3" -"@angular-devkit/schematics@8.3.20", "@angular-devkit/schematics@^8.0.6": - version "8.3.20" - resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-8.3.20.tgz#80e7c31ebfd8f7f8500bfa1cae5c39980b962d6a" - integrity sha512-sDHZakh4e3A5WenR9zr1x6Va9GNRqQlRhqT3xcbkG88v2M0YqEt7dHB7YwnOhm7zSxiWQM8PdWEQHiQ4iu9NyQ== +"@angular-devkit/core@8.3.21": + version "8.3.21" + resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-8.3.21.tgz#447022813e46333e930816c287722d06b9c4dd3a" + integrity sha512-BYyVbrbys535FplX0+GVOlYBg/cyk1U5SRhSxRRFZYi9epVlEBBPk8/6wV4cQPGb6EwXkVj7YtPWXjXcGfzWmA== dependencies: - "@angular-devkit/core" "8.3.20" + ajv "6.10.2" + fast-json-stable-stringify "2.0.0" + magic-string "0.25.3" + rxjs "6.4.0" + source-map "0.7.3" + +"@angular-devkit/schematics@8.3.21": + version "8.3.21" + resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-8.3.21.tgz#80d515f480180be18a4130ea691f90153bcab3ea" + integrity sha512-+wH0362CRr/SijVX4w2baY2ANZ4scQ1k2xO8lT+NMeZQkw3IJQPOfwk1IaqiAs2xuBJZcSDH1Gn80+Jh4Dit7w== + dependencies: + "@angular-devkit/core" "8.3.21" rxjs "6.4.0" "@angular-devkit/schematics@^7.3.6": @@ -268,6 +279,14 @@ "@angular-devkit/core" "7.3.9" rxjs "6.3.3" +"@angular-devkit/schematics@^8.0.6": + version "8.3.20" + resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-8.3.20.tgz#80e7c31ebfd8f7f8500bfa1cae5c39980b962d6a" + integrity sha512-sDHZakh4e3A5WenR9zr1x6Va9GNRqQlRhqT3xcbkG88v2M0YqEt7dHB7YwnOhm7zSxiWQM8PdWEQHiQ4iu9NyQ== + dependencies: + "@angular-devkit/core" "8.3.20" + rxjs "6.4.0" + "@angular/animations@~8.2.14": version "8.2.14" resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-8.2.14.tgz#76736b21e56165e6ca4925fb69605bdcc56aba7d" @@ -284,16 +303,16 @@ optionalDependencies: parse5 "^5.0.0" -"@angular/cli@~8.3.18": - version "8.3.20" - resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-8.3.20.tgz#63e8f626e7dcf37e73cda820ab38bcac13423326" - integrity sha512-bCo8zVFZ6iPc1EnHmVCmKvIcV7YkvalBKGNU7LtVHq6qZBI+ZmFtuyL5obKvFg1vJcminjKcY/UcMr9uGcAQrQ== +"@angular/cli@~8.3.21": + version "8.3.21" + resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-8.3.21.tgz#cbb05b86b7f34ecd81d52ccad922359e66a16a15" + integrity sha512-ZZpA7mMfIobFT06rBNxm8vucAh8W2s0huJZ4iL0BPujnhIr71PL+gDwssySWDEz2q6i4CkH9QRH76DHhtL6VSQ== dependencies: - "@angular-devkit/architect" "0.803.20" - "@angular-devkit/core" "8.3.20" - "@angular-devkit/schematics" "8.3.20" - "@schematics/angular" "8.3.20" - "@schematics/update" "0.803.20" + "@angular-devkit/architect" "0.803.21" + "@angular-devkit/core" "8.3.21" + "@angular-devkit/schematics" "8.3.21" + "@schematics/angular" "8.3.21" + "@schematics/update" "0.803.21" "@yarnpkg/lockfile" "1.1.0" ansi-colors "4.1.1" debug "^4.1.1" @@ -387,19 +406,19 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/core@7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" - integrity sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg== +"@babel/core@7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.5.tgz#ae1323cd035b5160293307f50647e83f8ba62f7e" + integrity sha512-M42+ScN4+1S9iB6f+TL7QBpoQETxbclx+KNoKJABghnKYE+fMzSGqst0BZJc8CpI625bwPwYgUyRvxZ+0mZzpw== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.5.5" - "@babel/helpers" "^7.5.5" - "@babel/parser" "^7.5.5" - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" - convert-source-map "^1.1.0" + "@babel/generator" "^7.7.4" + "@babel/helpers" "^7.7.4" + "@babel/parser" "^7.7.5" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + convert-source-map "^1.7.0" debug "^4.1.0" json5 "^2.1.0" lodash "^4.17.13" @@ -427,7 +446,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.4.0", "@babel/generator@^7.5.5", "@babel/generator@^7.7.4": +"@babel/generator@^7.4.0", "@babel/generator@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369" integrity sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg== @@ -516,7 +535,7 @@ dependencies: "@babel/types" "^7.7.4" -"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.7.4": +"@babel/helper-module-imports@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.7.4.tgz#e5a92529f8888bf319a6376abfbd1cebc491ad91" integrity sha512-dGcrX6K9l8258WFjyDLJwuVKxR4XZfU0/vTUgOQYWEnRD8mgr+p4d6fCUMq/ys0h4CCt/S5JhbvtyErjWouAUQ== @@ -535,6 +554,18 @@ "@babel/types" "^7.7.4" lodash "^4.17.13" +"@babel/helper-module-transforms@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.5.tgz#d044da7ffd91ec967db25cd6748f704b6b244835" + integrity sha512-A7pSxyJf1gN5qXVcidwLWydjftUN878VkalhXX5iQDuGyiGK3sOrrKKHF4/A4fwHtnsotv/NipwAeLzY4KQPvw== + dependencies: + "@babel/helper-module-imports" "^7.7.4" + "@babel/helper-simple-access" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/types" "^7.7.4" + lodash "^4.17.13" + "@babel/helper-optimise-call-expression@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.4.tgz#034af31370d2995242aa4df402c3b7794b2dcdf2" @@ -600,7 +631,7 @@ "@babel/traverse" "^7.7.4" "@babel/types" "^7.7.4" -"@babel/helpers@^7.5.5", "@babel/helpers@^7.7.4": +"@babel/helpers@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.7.4.tgz#62c215b9e6c712dadc15a9a0dcab76c92a940302" integrity sha512-ak5NGZGJ6LV85Q1Zc9gn2n+ayXOizryhjSUBTdu5ih1tlVCJeuQENzc4ItyCVhINVXvIT/ZQ4mheGIsfBkpskg== @@ -618,12 +649,17 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.5.5", "@babel/parser@^7.7.4": +"@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.4.tgz#75ab2d7110c2cf2fa949959afb05fa346d2231bb" integrity sha512-jIwvLO0zCL+O/LmEJQjWA75MQTWwx3c3u2JOTDK5D3/9egrWRRA0/0hk9XXywYnXZVVpzrBYeIQTmhwUaePI9g== -"@babel/plugin-proposal-async-generator-functions@^7.2.0": +"@babel/parser@^7.7.5": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.7.tgz#1b886595419cf92d811316d5b715a53ff38b4937" + integrity sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw== + +"@babel/plugin-proposal-async-generator-functions@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.7.4.tgz#0351c5ac0a9e927845fffd5b82af476947b7ce6d" integrity sha512-1ypyZvGRXriY/QP668+s8sFr2mqinhkRDMPSQLNghCQE+GAkFtp+wkHVvg2+Hdki8gwP+NFzJBJ/N1BfzCCDEw== @@ -632,7 +668,7 @@ "@babel/helper-remap-async-to-generator" "^7.7.4" "@babel/plugin-syntax-async-generators" "^7.7.4" -"@babel/plugin-proposal-dynamic-import@^7.5.0": +"@babel/plugin-proposal-dynamic-import@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.7.4.tgz#dde64a7f127691758cbfed6cf70de0fa5879d52d" integrity sha512-StH+nGAdO6qDB1l8sZ5UBV8AC3F2VW2I8Vfld73TMKyptMU9DY5YsJAS8U81+vEtxcH3Y/La0wG0btDrhpnhjQ== @@ -640,7 +676,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-dynamic-import" "^7.7.4" -"@babel/plugin-proposal-json-strings@^7.2.0": +"@babel/plugin-proposal-json-strings@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.7.4.tgz#7700a6bfda771d8dc81973249eac416c6b4c697d" integrity sha512-wQvt3akcBTfLU/wYoqm/ws7YOAQKu8EVJEvHip/mzkNtjaclQoCCIqKXFP5/eyfnfbQCDV3OLRIK3mIVyXuZlw== @@ -648,15 +684,15 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-json-strings" "^7.7.4" -"@babel/plugin-proposal-object-rest-spread@^7.5.5": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.4.tgz#cc57849894a5c774214178c8ab64f6334ec8af71" - integrity sha512-rnpnZR3/iWKmiQyJ3LKJpSwLDcX/nSXhdLk4Aq/tXOApIvyu7qoabrige0ylsAJffaUC51WiBu209Q0U+86OWQ== +"@babel/plugin-proposal-object-rest-spread@^7.7.4": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.7.tgz#9f27075004ab99be08c5c1bd653a2985813cb370" + integrity sha512-3qp9I8lelgzNedI3hrhkvhaEYree6+WHnyA/q4Dza9z7iEIs1eyhWyJnetk3jJ69RT0AT4G0UhEGwyGFJ7GUuQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.7.4" -"@babel/plugin-proposal-optional-catch-binding@^7.2.0": +"@babel/plugin-proposal-optional-catch-binding@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.7.4.tgz#ec21e8aeb09ec6711bc0a39ca49520abee1de379" integrity sha512-DyM7U2bnsQerCQ+sejcTNZh8KQEUuC3ufzdnVnSiUv/qoGJp2Z3hanKL18KDhsBT5Wj6a7CMT5mdyCNJsEaA9w== @@ -664,57 +700,64 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-optional-catch-binding" "^7.7.4" -"@babel/plugin-proposal-unicode-property-regex@^7.4.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.4.tgz#7c239ccaf09470dbe1d453d50057460e84517ebb" - integrity sha512-cHgqHgYvffluZk85dJ02vloErm3Y6xtH+2noOBOJ2kXOJH3aVCDnj5eR/lVNlTnYu4hndAPJD3rTFjW3qee0PA== +"@babel/plugin-proposal-unicode-property-regex@^7.7.4": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.7.tgz#433fa9dac64f953c12578b29633f456b68831c4e" + integrity sha512-80PbkKyORBUVm1fbTLrHpYdJxMThzM1UqFGh0ALEhO9TYbG86Ah9zQYAB/84axz2vcxefDLdZwWwZNlYARlu9w== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-async-generators@^7.2.0", "@babel/plugin-syntax-async-generators@^7.7.4": +"@babel/plugin-syntax-async-generators@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.7.4.tgz#331aaf310a10c80c44a66b238b6e49132bd3c889" integrity sha512-Li4+EjSpBgxcsmeEF8IFcfV/+yJGxHXDirDkEoyFjumuwbmfCVHUt0HuowD/iGM7OhIRyXJH9YXxqiH6N815+g== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-dynamic-import@^7.2.0", "@babel/plugin-syntax-dynamic-import@^7.7.4": +"@babel/plugin-syntax-dynamic-import@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.7.4.tgz#29ca3b4415abfe4a5ec381e903862ad1a54c3aec" integrity sha512-jHQW0vbRGvwQNgyVxwDh4yuXu4bH1f5/EICJLAhl1SblLs2CDhrsmCk+v5XLdE9wxtAFRyxx+P//Iw+a5L/tTg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-json-strings@^7.2.0", "@babel/plugin-syntax-json-strings@^7.7.4": +"@babel/plugin-syntax-json-strings@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.7.4.tgz#86e63f7d2e22f9e27129ac4e83ea989a382e86cc" integrity sha512-QpGupahTQW1mHRXddMG5srgpHWqRLwJnJZKXTigB9RPFCCGbDGCgBeM/iC82ICXp414WeYx/tD54w7M2qRqTMg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0", "@babel/plugin-syntax-object-rest-spread@^7.7.4": +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.7.4.tgz#47cf220d19d6d0d7b154304701f468fc1cc6ff46" integrity sha512-mObR+r+KZq0XhRVS2BrBKBpr5jqrqzlPvS9C9vuOf5ilSwzloAl7RPWLrgKdWS6IreaVrjHxTjtyqFiOisaCwg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-optional-catch-binding@^7.2.0", "@babel/plugin-syntax-optional-catch-binding@^7.7.4": +"@babel/plugin-syntax-optional-catch-binding@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.7.4.tgz#a3e38f59f4b6233867b4a92dcb0ee05b2c334aa6" integrity sha512-4ZSuzWgFxqHRE31Glu+fEr/MirNZOMYmD/0BhBWyLyOOQz/gTAl7QmWm2hX1QxEIXsr2vkdlwxIzTyiYRC4xcQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-arrow-functions@^7.2.0": +"@babel/plugin-syntax-top-level-await@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.4.tgz#bd7d8fa7b9fee793a36e4027fd6dd1aa32f946da" + integrity sha512-wdsOw0MvkL1UIgiQ/IFr3ETcfv1xb8RMM0H9wbiDyLaJFyiDg5oZvDLCXosIXmFeIlweML5iOBXAkqddkYNizg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-arrow-functions@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.7.4.tgz#76309bd578addd8aee3b379d809c802305a98a12" integrity sha512-zUXy3e8jBNPiffmqkHRNDdZM2r8DWhCB7HhcoyZjiK1TxYEluLHAvQuYnTT+ARqRpabWqy/NHkO6e3MsYB5YfA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-async-to-generator@^7.5.0": +"@babel/plugin-transform-async-to-generator@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.4.tgz#694cbeae6d613a34ef0292713fa42fb45c4470ba" integrity sha512-zpUTZphp5nHokuy8yLlyafxCJ0rSlFoSHypTUWgpdwoDXWQcseaect7cJ8Ppk6nunOM6+5rPMkod4OYKPR5MUg== @@ -723,14 +766,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-remap-async-to-generator" "^7.7.4" -"@babel/plugin-transform-block-scoped-functions@^7.2.0": +"@babel/plugin-transform-block-scoped-functions@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.7.4.tgz#d0d9d5c269c78eaea76227ace214b8d01e4d837b" integrity sha512-kqtQzwtKcpPclHYjLK//3lH8OFsCDuDJBaFhVwf8kqdnF6MN4l618UDlcA7TfRs3FayrHj+svYnSX8MC9zmUyQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.5.5": +"@babel/plugin-transform-block-scoping@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.7.4.tgz#200aad0dcd6bb80372f94d9e628ea062c58bf224" integrity sha512-2VBe9u0G+fDt9B5OV5DQH4KBf5DoiNkwFKOz0TCvBWvdAN2rOykCTkrL+jTLxfCAm76l9Qo5OqL7HBOx2dWggg== @@ -738,7 +781,7 @@ "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.13" -"@babel/plugin-transform-classes@^7.5.5": +"@babel/plugin-transform-classes@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.4.tgz#c92c14be0a1399e15df72667067a8f510c9400ec" integrity sha512-sK1mjWat7K+buWRuImEzjNf68qrKcrddtpQo3swi9j7dUcG6y6R6+Di039QN2bD1dykeswlagupEmpOatFHHUg== @@ -752,36 +795,36 @@ "@babel/helper-split-export-declaration" "^7.7.4" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.2.0": +"@babel/plugin-transform-computed-properties@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.7.4.tgz#e856c1628d3238ffe12d668eb42559f79a81910d" integrity sha512-bSNsOsZnlpLLyQew35rl4Fma3yKWqK3ImWMSC/Nc+6nGjC9s5NFWAer1YQ899/6s9HxO2zQC1WoFNfkOqRkqRQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-destructuring@^7.5.0": +"@babel/plugin-transform-destructuring@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.7.4.tgz#2b713729e5054a1135097b6a67da1b6fe8789267" integrity sha512-4jFMXI1Cu2aXbcXXl8Lr6YubCn6Oc7k9lLsu8v61TZh+1jny2BWmdtvY9zSUlLdGUvcy9DMAWyZEOqjsbeg/wA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-dotall-regex@^7.4.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.4.tgz#f7ccda61118c5b7a2599a72d5e3210884a021e96" - integrity sha512-mk0cH1zyMa/XHeb6LOTXTbG7uIJ8Rrjlzu91pUx/KS3JpcgaTDwMS8kM+ar8SLOvlL2Lofi4CGBAjCo3a2x+lw== +"@babel/plugin-transform-dotall-regex@^7.7.4": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.7.tgz#3e9713f1b69f339e87fa796b097d73ded16b937b" + integrity sha512-b4in+YlTeE/QmTgrllnb3bHA0HntYvjz8O3Mcbx75UBPJA2xhb5A8nle498VhxSXJHQefjtQxpnLPehDJ4TRlg== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-duplicate-keys@^7.5.0": +"@babel/plugin-transform-duplicate-keys@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.7.4.tgz#3d21731a42e3f598a73835299dd0169c3b90ac91" integrity sha512-g1y4/G6xGWMD85Tlft5XedGaZBCIVN+/P0bs6eabmcPP9egFleMAo65OOjlhcz1njpwagyY3t0nsQC9oTFegJA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-exponentiation-operator@^7.2.0": +"@babel/plugin-transform-exponentiation-operator@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.7.4.tgz#dd30c0191e3a1ba19bcc7e389bdfddc0729d5db9" integrity sha512-MCqiLfCKm6KEA1dglf6Uqq1ElDIZwFuzz1WH5mTf8k2uQSxEJMbOIEh7IZv7uichr7PMfi5YVSrr1vz+ipp7AQ== @@ -789,14 +832,14 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-for-of@^7.4.4": +"@babel/plugin-transform-for-of@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.7.4.tgz#248800e3a5e507b1f103d8b4ca998e77c63932bc" integrity sha512-zZ1fD1B8keYtEcKF+M1TROfeHTKnijcVQm0yO/Yu1f7qoDoxEIc/+GX6Go430Bg84eM/xwPFp0+h4EbZg7epAA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-function-name@^7.4.4": +"@babel/plugin-transform-function-name@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.4.tgz#75a6d3303d50db638ff8b5385d12451c865025b1" integrity sha512-E/x09TvjHNhsULs2IusN+aJNRV5zKwxu1cpirZyRPw+FyyIKEHPXTsadj48bVpc1R5Qq1B5ZkzumuFLytnbT6g== @@ -804,40 +847,40 @@ "@babel/helper-function-name" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-literals@^7.2.0": +"@babel/plugin-transform-literals@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.7.4.tgz#27fe87d2b5017a2a5a34d1c41a6b9f6a6262643e" integrity sha512-X2MSV7LfJFm4aZfxd0yLVFrEXAgPqYoDG53Br/tCKiKYfX0MjVjQeWPIhPHHsCqzwQANq+FLN786fF5rgLS+gw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-member-expression-literals@^7.2.0": +"@babel/plugin-transform-member-expression-literals@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.7.4.tgz#aee127f2f3339fc34ce5e3055d7ffbf7aa26f19a" integrity sha512-9VMwMO7i69LHTesL0RdGy93JU6a+qOPuvB4F4d0kR0zyVjJRVJRaoaGjhtki6SzQUu8yen/vxPKN6CWnCUw6bA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-modules-amd@^7.5.0": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.7.4.tgz#276b3845ca2b228f2995e453adc2e6f54d72fb71" - integrity sha512-/542/5LNA18YDtg1F+QHvvUSlxdvjZoD/aldQwkq+E3WCkbEjNSN9zdrOXaSlfg3IfGi22ijzecklF/A7kVZFQ== +"@babel/plugin-transform-modules-amd@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.7.5.tgz#39e0fb717224b59475b306402bb8eedab01e729c" + integrity sha512-CT57FG4A2ZUNU1v+HdvDSDrjNWBrtCmSH6YbbgN3Lrf0Di/q/lWRxZrE72p3+HCCz9UjfZOEBdphgC0nzOS6DQ== dependencies: - "@babel/helper-module-transforms" "^7.7.4" + "@babel/helper-module-transforms" "^7.7.5" "@babel/helper-plugin-utils" "^7.0.0" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-commonjs@^7.5.0": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.4.tgz#bee4386e550446343dd52a571eda47851ff857a3" - integrity sha512-k8iVS7Jhc367IcNF53KCwIXtKAH7czev866ThsTgy8CwlXjnKZna2VHwChglzLleYrcHz1eQEIJlGRQxB53nqA== +"@babel/plugin-transform-modules-commonjs@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.5.tgz#1d27f5eb0bcf7543e774950e5b2fa782e637b345" + integrity sha512-9Cq4zTFExwFhQI6MT1aFxgqhIsMWQWDVwOgLzl7PTWJHsNaqFvklAU+Oz6AQLAS0dJKTwZSOCo20INwktxpi3Q== dependencies: - "@babel/helper-module-transforms" "^7.7.4" + "@babel/helper-module-transforms" "^7.7.5" "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-simple-access" "^7.7.4" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-systemjs@^7.5.0": +"@babel/plugin-transform-modules-systemjs@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.4.tgz#cd98152339d3e763dfe838b7d4273edaf520bb30" integrity sha512-y2c96hmcsUi6LrMqvmNDPBBiGCiQu0aYqpHatVVu6kD4mFEXKjyNxd/drc18XXAf9dv7UXjrZwBVmTTGaGP8iw== @@ -846,7 +889,7 @@ "@babel/helper-plugin-utils" "^7.0.0" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-umd@^7.2.0": +"@babel/plugin-transform-modules-umd@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.7.4.tgz#1027c355a118de0aae9fee00ad7813c584d9061f" integrity sha512-u2B8TIi0qZI4j8q4C51ktfO7E3cQ0qnaXFI1/OXITordD40tt17g/sXqgNNCcMTcBFKrUPcGDx+TBJuZxLx7tw== @@ -854,21 +897,21 @@ "@babel/helper-module-transforms" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-named-capturing-groups-regex@^7.4.5": +"@babel/plugin-transform-named-capturing-groups-regex@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.7.4.tgz#fb3bcc4ee4198e7385805007373d6b6f42c98220" integrity sha512-jBUkiqLKvUWpv9GLSuHUFYdmHg0ujC1JEYoZUfeOOfNydZXp1sXObgyPatpcwjWgsdBGsagWW0cdJpX/DO2jMw== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.7.4" -"@babel/plugin-transform-new-target@^7.4.4": +"@babel/plugin-transform-new-target@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.7.4.tgz#4a0753d2d60639437be07b592a9e58ee00720167" integrity sha512-CnPRiNtOG1vRodnsyGX37bHQleHE14B9dnnlgSeEs3ek3fHN1A1SScglTCg1sfbe7sRQ2BUcpgpTpWSfMKz3gg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-object-super@^7.5.5": +"@babel/plugin-transform-object-super@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.7.4.tgz#48488937a2d586c0148451bf51af9d7dda567262" integrity sha512-ho+dAEhC2aRnff2JCA0SAK7V2R62zJd/7dmtoe7MHcso4C2mS+vZjn1Pb1pCVZvJs1mgsvv5+7sT+m3Bysb6eg== @@ -876,51 +919,51 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-replace-supers" "^7.7.4" -"@babel/plugin-transform-parameters@^7.4.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.4.tgz#da4555c97f39b51ac089d31c7380f03bca4075ce" - integrity sha512-VJwhVePWPa0DqE9vcfptaJSzNDKrWU/4FbYCjZERtmqEs05g3UMXnYMZoXja7JAJ7Y7sPZipwm/pGApZt7wHlw== +"@babel/plugin-transform-parameters@^7.7.4": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.7.tgz#7a884b2460164dc5f194f668332736584c760007" + integrity sha512-OhGSrf9ZBrr1fw84oFXj5hgi8Nmg+E2w5L7NhnG0lPvpDtqd7dbyilM2/vR8CKbJ907RyxPh2kj6sBCSSfI9Ew== dependencies: "@babel/helper-call-delegate" "^7.7.4" "@babel/helper-get-function-arity" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-property-literals@^7.2.0": +"@babel/plugin-transform-property-literals@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.7.4.tgz#2388d6505ef89b266103f450f9167e6bd73f98c2" integrity sha512-MatJhlC4iHsIskWYyawl53KuHrt+kALSADLQQ/HkhTjX954fkxIEh4q5slL4oRAnsm/eDoZ4q0CIZpcqBuxhJQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-regenerator@^7.4.5": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.4.tgz#d18eac0312a70152d7d914cbed2dc3999601cfc0" - integrity sha512-e7MWl5UJvmPEwFJTwkBlPmqixCtr9yAASBqff4ggXTNicZiwbF8Eefzm6NVgfiBp7JdAGItecnctKTgH44q2Jw== +"@babel/plugin-transform-regenerator@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.5.tgz#3a8757ee1a2780f390e89f246065ecf59c26fce9" + integrity sha512-/8I8tPvX2FkuEyWbjRCt4qTAgZK0DVy8QRguhA524UH48RfGJy94On2ri+dCuwOpcerPRl9O4ebQkRcVzIaGBw== dependencies: regenerator-transform "^0.14.0" -"@babel/plugin-transform-reserved-words@^7.2.0": +"@babel/plugin-transform-reserved-words@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.7.4.tgz#6a7cf123ad175bb5c69aec8f6f0770387ed3f1eb" integrity sha512-OrPiUB5s5XvkCO1lS7D8ZtHcswIC57j62acAnJZKqGGnHP+TIc/ljQSrgdX/QyOTdEK5COAhuc820Hi1q2UgLQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-shorthand-properties@^7.2.0": +"@babel/plugin-transform-shorthand-properties@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.7.4.tgz#74a0a9b2f6d67a684c6fbfd5f0458eb7ba99891e" integrity sha512-q+suddWRfIcnyG5YiDP58sT65AJDZSUhXQDZE3r04AuqD6d/XLaQPPXSBzP2zGerkgBivqtQm9XKGLuHqBID6Q== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-spread@^7.2.0": +"@babel/plugin-transform-spread@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.7.4.tgz#aa673b356fe6b7e70d69b6e33a17fef641008578" integrity sha512-8OSs0FLe5/80cndziPlg4R0K6HcWSM0zyNhHhLsmw/Nc5MaA49cAsnoJ/t/YZf8qkG7fD+UjTRaApVDB526d7Q== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-sticky-regex@^7.2.0": +"@babel/plugin-transform-sticky-regex@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.7.4.tgz#ffb68c05090c30732076b1285dc1401b404a123c" integrity sha512-Ls2NASyL6qtVe1H1hXts9yuEeONV2TJZmplLONkMPUG158CtmnrzW5Q5teibM5UVOFjG0D3IC5mzXR6pPpUY7A== @@ -928,7 +971,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-regex" "^7.0.0" -"@babel/plugin-transform-template-literals@^7.4.4": +"@babel/plugin-transform-template-literals@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.7.4.tgz#1eb6411736dd3fe87dbd20cc6668e5121c17d604" integrity sha512-sA+KxLwF3QwGj5abMHkHgshp9+rRz+oY9uoRil4CyLtgEuE/88dpkeWgNk5qKVsJE9iSfly3nvHapdRiIS2wnQ== @@ -936,14 +979,14 @@ "@babel/helper-annotate-as-pure" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-typeof-symbol@^7.2.0": +"@babel/plugin-transform-typeof-symbol@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.7.4.tgz#3174626214f2d6de322882e498a38e8371b2140e" integrity sha512-KQPUQ/7mqe2m0B8VecdyaW5XcQYaePyl9R7IsKd+irzj6jvbhoGnRE+M0aNkyAzI07VfUQ9266L5xMARitV3wg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-unicode-regex@^7.4.4": +"@babel/plugin-transform-unicode-regex@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.7.4.tgz#a3c0f65b117c4c81c5b6484f2a5e7b95346b83ae" integrity sha512-N77UUIV+WCvE+5yHw+oks3m18/umd7y392Zv7mYTpFqHtkpcc+QUz+gLJNTWVlWROIWeLqY0f3OjZxV5TcXnRw== @@ -951,58 +994,59 @@ "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/preset-env@7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.5.tgz#bc470b53acaa48df4b8db24a570d6da1fef53c9a" - integrity sha512-GMZQka/+INwsMz1A5UEql8tG015h5j/qjptpKY2gJ7giy8ohzU710YciJB5rcKsWGWHiW3RUnHib0E5/m3Tp3A== +"@babel/preset-env@7.7.6": + version "7.7.6" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.6.tgz#39ac600427bbb94eec6b27953f1dfa1d64d457b2" + integrity sha512-k5hO17iF/Q7tR9Jv8PdNBZWYW6RofxhnxKjBMc0nG4JTaWvOTiPoO/RLFwAKcA4FpmuBFm6jkoqaRJLGi0zdaQ== dependencies: - "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-module-imports" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.2.0" - "@babel/plugin-proposal-dynamic-import" "^7.5.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.5.5" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.5.0" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.5.5" - "@babel/plugin-transform-classes" "^7.5.5" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.5.0" - "@babel/plugin-transform-dotall-regex" "^7.4.4" - "@babel/plugin-transform-duplicate-keys" "^7.5.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.4.4" - "@babel/plugin-transform-function-name" "^7.4.4" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-member-expression-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.5.0" - "@babel/plugin-transform-modules-commonjs" "^7.5.0" - "@babel/plugin-transform-modules-systemjs" "^7.5.0" - "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" - "@babel/plugin-transform-new-target" "^7.4.4" - "@babel/plugin-transform-object-super" "^7.5.5" - "@babel/plugin-transform-parameters" "^7.4.4" - "@babel/plugin-transform-property-literals" "^7.2.0" - "@babel/plugin-transform-regenerator" "^7.4.5" - "@babel/plugin-transform-reserved-words" "^7.2.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.2.0" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.4.4" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.4.4" - "@babel/types" "^7.5.5" + "@babel/plugin-proposal-async-generator-functions" "^7.7.4" + "@babel/plugin-proposal-dynamic-import" "^7.7.4" + "@babel/plugin-proposal-json-strings" "^7.7.4" + "@babel/plugin-proposal-object-rest-spread" "^7.7.4" + "@babel/plugin-proposal-optional-catch-binding" "^7.7.4" + "@babel/plugin-proposal-unicode-property-regex" "^7.7.4" + "@babel/plugin-syntax-async-generators" "^7.7.4" + "@babel/plugin-syntax-dynamic-import" "^7.7.4" + "@babel/plugin-syntax-json-strings" "^7.7.4" + "@babel/plugin-syntax-object-rest-spread" "^7.7.4" + "@babel/plugin-syntax-optional-catch-binding" "^7.7.4" + "@babel/plugin-syntax-top-level-await" "^7.7.4" + "@babel/plugin-transform-arrow-functions" "^7.7.4" + "@babel/plugin-transform-async-to-generator" "^7.7.4" + "@babel/plugin-transform-block-scoped-functions" "^7.7.4" + "@babel/plugin-transform-block-scoping" "^7.7.4" + "@babel/plugin-transform-classes" "^7.7.4" + "@babel/plugin-transform-computed-properties" "^7.7.4" + "@babel/plugin-transform-destructuring" "^7.7.4" + "@babel/plugin-transform-dotall-regex" "^7.7.4" + "@babel/plugin-transform-duplicate-keys" "^7.7.4" + "@babel/plugin-transform-exponentiation-operator" "^7.7.4" + "@babel/plugin-transform-for-of" "^7.7.4" + "@babel/plugin-transform-function-name" "^7.7.4" + "@babel/plugin-transform-literals" "^7.7.4" + "@babel/plugin-transform-member-expression-literals" "^7.7.4" + "@babel/plugin-transform-modules-amd" "^7.7.5" + "@babel/plugin-transform-modules-commonjs" "^7.7.5" + "@babel/plugin-transform-modules-systemjs" "^7.7.4" + "@babel/plugin-transform-modules-umd" "^7.7.4" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.7.4" + "@babel/plugin-transform-new-target" "^7.7.4" + "@babel/plugin-transform-object-super" "^7.7.4" + "@babel/plugin-transform-parameters" "^7.7.4" + "@babel/plugin-transform-property-literals" "^7.7.4" + "@babel/plugin-transform-regenerator" "^7.7.5" + "@babel/plugin-transform-reserved-words" "^7.7.4" + "@babel/plugin-transform-shorthand-properties" "^7.7.4" + "@babel/plugin-transform-spread" "^7.7.4" + "@babel/plugin-transform-sticky-regex" "^7.7.4" + "@babel/plugin-transform-template-literals" "^7.7.4" + "@babel/plugin-transform-typeof-symbol" "^7.7.4" + "@babel/plugin-transform-unicode-regex" "^7.7.4" + "@babel/types" "^7.7.4" browserslist "^4.6.0" - core-js-compat "^3.1.1" + core-js-compat "^3.4.7" invariant "^2.2.2" js-levenshtein "^1.1.3" semver "^5.5.0" @@ -1022,7 +1066,7 @@ dependencies: regenerator-runtime "^0.13.2" -"@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.7.4": +"@babel/template@^7.4.0", "@babel/template@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.4.tgz#428a7d9eecffe27deac0a98e23bf8e3675d2a77b" integrity sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw== @@ -1031,7 +1075,7 @@ "@babel/parser" "^7.7.4" "@babel/types" "^7.7.4" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.5.5", "@babel/traverse@^7.7.4": +"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.4.tgz#9c1e7c60fb679fe4fcfaa42500833333c2058558" integrity sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw== @@ -1046,7 +1090,7 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.5.5", "@babel/types@^7.7.4": +"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.4.tgz#516570d539e44ddf308c07569c258ff94fde9193" integrity sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA== @@ -2009,12 +2053,12 @@ schematics-utilities "^1.1.1" tslib "^1.9.0" -"@ngtools/webpack@8.3.20": - version "8.3.20" - resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-8.3.20.tgz#a5288171b67c96e8d3b219f5108f1d6cd962d6a3" - integrity sha512-2e9Kat6PQEzqtNsZZpnOIvoDzyGwMELiuBYBa9keZeaXOD6TxjSyCRzHHXAldAXqvh4Uj2qjTid54Sy14CxtsQ== +"@ngtools/webpack@8.3.21": + version "8.3.21" + resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-8.3.21.tgz#d28f2b66a8aeced5260c42ae722192ec5d5e4e56" + integrity sha512-DGqmFQ52sV4uB3y3spQTNLa69oU5cwd1yIqMB4GSM+Qp+hozdzrPA2gVH90N2DDhWe8icsSQHAtZQiR9+BDL8g== dependencies: - "@angular-devkit/core" "8.3.20" + "@angular-devkit/core" "8.3.21" enhanced-resolve "4.1.0" rxjs "6.4.0" tree-kill "1.2.1" @@ -2129,21 +2173,21 @@ dependencies: "@types/node" ">= 8" -"@schematics/angular@8.3.20": - version "8.3.20" - resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-8.3.20.tgz#737d0a73e891446899a2267c4cc348b6c5a78ca8" - integrity sha512-Y20pSJhQ0KQd8Tk2kPQlmpRDNDaoIKMeOOGLT2FgCFrumxZXuIbBgN9fGDgW40iI2sq80bccOeo24RKkn3QpcA== +"@schematics/angular@8.3.21": + version "8.3.21" + resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-8.3.21.tgz#4902e0b6e8be47006859009bf96a026e3d39dd27" + integrity sha512-KahQ+dHvTsGOZwY6IdzqJZLDEn0G89rrK3OY+7okZujoaLM+LXhxlPoznW1udnZJVTa3VNxYGx11fkgLtRJRqA== dependencies: - "@angular-devkit/core" "8.3.20" - "@angular-devkit/schematics" "8.3.20" + "@angular-devkit/core" "8.3.21" + "@angular-devkit/schematics" "8.3.21" -"@schematics/update@0.803.20": - version "0.803.20" - resolved "https://registry.yarnpkg.com/@schematics/update/-/update-0.803.20.tgz#f6cce4f0ee435d8a4071817ac43e418f2b51d22a" - integrity sha512-MseLreuHdnSLUEnRxZFVSHKKK+3mGXH12SgOSeirwATIL22Df74+Q5BYvsge/Kd2k6s9ak/NCuRXG7FAo8mkMA== +"@schematics/update@0.803.21": + version "0.803.21" + resolved "https://registry.yarnpkg.com/@schematics/update/-/update-0.803.21.tgz#572c955bb132348bca03a128491ae264b0068a0a" + integrity sha512-D3BRvEBF2cJEgogvFaNOfqtTFHHv/ctSRfOeAYWjUxILtb+2DpuZ9h5QYDFhN9MPgz/vRaOqFORa3sEZCRkX4g== dependencies: - "@angular-devkit/core" "8.3.20" - "@angular-devkit/schematics" "8.3.20" + "@angular-devkit/core" "8.3.21" + "@angular-devkit/schematics" "8.3.21" "@yarnpkg/lockfile" "1.1.0" ini "1.3.5" pacote "9.5.5" @@ -2578,6 +2622,11 @@ acorn@^7.1.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== +add-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa" + integrity sha1-anmQQ3ynNtXhKI25K9MmbV9csqo= + adm-zip@^0.4.9: version "0.4.13" resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.13.tgz#597e2f8cc3672151e1307d3e95cddbc75672314a" @@ -3347,6 +3396,15 @@ browserslist@^4.0.0, browserslist@^4.6.0, browserslist@^4.6.3, browserslist@^4.8 electron-to-chromium "^1.3.317" node-releases "^1.1.41" +browserslist@^4.8.2: + version "4.8.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.2.tgz#b45720ad5fbc8713b7253c20766f701c9a694289" + integrity sha512-+M4oeaTplPm/f1pXDw84YohEv7B1i/2Aisei8s4s6k3QsoSHa7i5sz8u/cGQkkatCPxMASKxPualR4wwYgVboA== + dependencies: + caniuse-lite "^1.0.30001015" + electron-to-chromium "^1.3.322" + node-releases "^1.1.42" + browserstack@^1.5.1: version "1.5.3" resolved "https://registry.yarnpkg.com/browserstack/-/browserstack-1.5.3.tgz#93ab48799a12ef99dbd074dd595410ddb196a7ac" @@ -3458,26 +3516,6 @@ cacache@12.0.2: unique-filename "^1.1.1" y18n "^4.0.0" -cacache@^11.3.3: - version "11.3.3" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.3.tgz#8bd29df8c6a718a6ebd2d010da4d7972ae3bbadc" - integrity sha512-p8WcneCytvzPxhDvYp31PD039vi77I12W+/KfR9S8AZbaiARFBCpsPJS+9uhWfeBfeAtW7o/4vt3MUqLkbY6nA== - dependencies: - bluebird "^3.5.5" - chownr "^1.1.1" - figgy-pudding "^3.5.1" - glob "^7.1.4" - graceful-fs "^4.1.15" - lru-cache "^5.1.1" - mississippi "^3.0.0" - mkdirp "^0.5.1" - move-concurrently "^1.0.1" - promise-inflight "^1.0.1" - rimraf "^2.6.3" - ssri "^6.0.1" - unique-filename "^1.1.1" - y18n "^4.0.0" - cacache@^12.0.0, cacache@^12.0.2, cacache@^12.0.3: version "12.0.3" resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.3.tgz#be99abba4e1bf5df461cd5a2c1071fc432573390" @@ -3603,6 +3641,11 @@ caniuse-lite@^1.0.30000980, caniuse-lite@^1.0.30000984, caniuse-lite@^1.0.300010 resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001013.tgz#da2440d4d266a17d40eb79bd19c0c8cc1d029c72" integrity sha512-hOAXaWKuq/UVFgYawxIOdPdyMQdYcwOCDOjnZcKn7wCgFUrhP7smuNZjGLuJlPSgE6aRA4cRJ+bGSrhtEt7ZAg== +caniuse-lite@^1.0.30001015: + version "1.0.30001017" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001017.tgz#d3ad6ec18148b9bd991829958d9d7e562bb78cd6" + integrity sha512-EDnZyOJ6eYh6lHmCvCdHAFbfV4KJ9lSdfv4h/ppEhrU/Yudkl7jujwMZ1we6RX7DXqBfT04pVMQ4J+1wcTlsKA== + canonical-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/canonical-path/-/canonical-path-1.0.0.tgz#fcb470c23958def85081856be7a86e904f180d1d" @@ -4063,7 +4106,7 @@ content-type@~1.0.4: resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== -conventional-changelog-angular@^5.0.3: +conventional-changelog-angular@^5.0.3, conventional-changelog-angular@^5.0.6: version "5.0.6" resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.6.tgz#269540c624553aded809c29a3508fdc2b544c059" integrity sha512-QDEmLa+7qdhVIv8sFZfVxU1VSyVvnXPsxq8Vam49mKUcO1Z8VTLEJk9uI21uiJUsnmm0I4Hrsdc9TgkOQo9WSA== @@ -4071,6 +4114,40 @@ conventional-changelog-angular@^5.0.3: compare-func "^1.3.1" q "^1.5.1" +conventional-changelog-atom@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-atom/-/conventional-changelog-atom-2.0.3.tgz#3bd14280aa09fe3ec49a0e8fe97b5002db02aad4" + integrity sha512-szZe2ut97qNO6vCCMkm1I/tWu6ol4Rr8a9Lx0y/VlpDnpY0PNp+oGpFgU55lplhx+I3Lro9Iv4/gRj0knfgjzg== + dependencies: + q "^1.5.1" + +conventional-changelog-cli@^2.0.31: + version "2.0.31" + resolved "https://registry.yarnpkg.com/conventional-changelog-cli/-/conventional-changelog-cli-2.0.31.tgz#3345581170fbb540416946e460fef519a64aef43" + integrity sha512-nMINylKAamBLM3OmD7/44d9TPZ3V58IDTXoGC/QtXxve+1Sj37BQTzIEW3TNaviZ2ZV/b5Dqg0eSk4DNP5fBdA== + dependencies: + add-stream "^1.0.0" + conventional-changelog "^3.1.18" + lodash "^4.17.15" + meow "^5.0.0" + tempfile "^3.0.0" + +conventional-changelog-codemirror@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-codemirror/-/conventional-changelog-codemirror-2.0.3.tgz#ebc088154684f8f5171446b8d546ba6b460d46f2" + integrity sha512-t2afackdgFV2yBdHhWPqrKbpaQeVnz2hSJKdWqjasPo5EpIB6TBL0er3cOP1mnGQmuzk9JSvimNSuqjWGDtU5Q== + dependencies: + q "^1.5.1" + +conventional-changelog-conventionalcommits@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.2.3.tgz#22855b32d57d0328951c1c2dc01b172a5f24ea37" + integrity sha512-atGa+R4vvEhb8N/8v3IoW59gCBJeeFiX6uIbPu876ENAmkMwsenyn0R21kdDHJFLQdy6zW4J6b4xN8KI3b9oww== + dependencies: + compare-func "^1.3.1" + lodash "^4.17.15" + q "^1.5.1" + conventional-changelog-core@^3.1.6: version "3.2.3" resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.2.3.tgz#b31410856f431c847086a7dcb4d2ca184a7d88fb" @@ -4090,12 +4167,68 @@ conventional-changelog-core@^3.1.6: read-pkg-up "^3.0.0" through2 "^3.0.0" -conventional-changelog-preset-loader@^2.1.1: +conventional-changelog-core@^4.1.4: + version "4.1.4" + resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-4.1.4.tgz#39be27fca6ef20a0f998d7a3a1e97cfa8a055cb6" + integrity sha512-LO58ZbEpp1Ul+y/vOI8rJRsWkovsYkCFbOCVgi6UnVfU8WC0F8K8VQQwaBZWWUpb6JvEiN4GBR5baRP2txZ+Vg== + dependencies: + add-stream "^1.0.0" + conventional-changelog-writer "^4.0.11" + conventional-commits-parser "^3.0.8" + dateformat "^3.0.0" + get-pkg-repo "^1.0.0" + git-raw-commits "2.0.0" + git-remote-origin-url "^2.0.0" + git-semver-tags "^3.0.1" + lodash "^4.17.15" + normalize-package-data "^2.3.5" + q "^1.5.1" + read-pkg "^3.0.0" + read-pkg-up "^3.0.0" + through2 "^3.0.0" + +conventional-changelog-ember@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/conventional-changelog-ember/-/conventional-changelog-ember-2.0.4.tgz#c29b78e4af7825cbecb6c3fd6086ca5c09471ac1" + integrity sha512-q1u73sO9uCnxN4TSw8xu6MRU8Y1h9kpwtcdJuNRwu/LSKI1IE/iuNSH5eQ6aLlQ3HTyrIpTfUuVybW4W0F17rA== + dependencies: + q "^1.5.1" + +conventional-changelog-eslint@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/conventional-changelog-eslint/-/conventional-changelog-eslint-3.0.4.tgz#8f4736a23e0cd97e890e76fccc287db2f205f2ff" + integrity sha512-CPwTUENzhLGl3auunrJxiIEWncAGaby7gOFCdj2gslIuOFJ0KPJVOUhRz4Da/I53sdo/7UncUJkiLg94jEsjxg== + dependencies: + q "^1.5.1" + +conventional-changelog-express@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/conventional-changelog-express/-/conventional-changelog-express-2.0.1.tgz#fea2231d99a5381b4e6badb0c1c40a41fcacb755" + integrity sha512-G6uCuCaQhLxdb4eEfAIHpcfcJ2+ao3hJkbLrw/jSK/eROeNfnxCJasaWdDAfFkxsbpzvQT4W01iSynU3OoPLIw== + dependencies: + q "^1.5.1" + +conventional-changelog-jquery@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/conventional-changelog-jquery/-/conventional-changelog-jquery-3.0.6.tgz#460236ad8fb1d29ff932a14fe4e3a45379b63c5e" + integrity sha512-gHAABCXUNA/HjnZEm+vxAfFPJkgtrZvCDIlCKfdPVXtCIo/Q0lN5VKpx8aR5p8KdVRQFF3OuTlvv5kv6iPuRqA== + dependencies: + q "^1.5.1" + +conventional-changelog-jshint@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-jshint/-/conventional-changelog-jshint-2.0.3.tgz#ef6e2caf2ee6ffdfda78fcdf7ce87cf6c512d728" + integrity sha512-Pc2PnMPcez634ckzr4EOWviwRSpZcURaK7bjyD9oK6N5fsC/a+3G7LW5m/JpcHPhA9ZxsfIbm7uqZ3ZDGsQ/sw== + dependencies: + compare-func "^1.3.1" + q "^1.5.1" + +conventional-changelog-preset-loader@^2.1.1, conventional-changelog-preset-loader@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.0.tgz#580fa8ab02cef22c24294d25e52d7ccd247a9a6a" integrity sha512-/rHb32J2EJnEXeK4NpDgMaAVTFZS3o1ExmjKMtYVgIC4MQn0vkNSbYpdGRotkfGGRWiqk3Ri3FBkiZGbAfIfOQ== -conventional-changelog-writer@^4.0.6: +conventional-changelog-writer@^4.0.11, conventional-changelog-writer@^4.0.6: version "4.0.11" resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.11.tgz#9f56d2122d20c96eb48baae0bf1deffaed1edba4" integrity sha512-g81GQOR392I+57Cw3IyP1f+f42ME6aEkbR+L7v1FBBWolB0xkjKTeCWVguzRrp6UiT1O6gBpJbEy2eq7AnV1rw== @@ -4111,6 +4244,23 @@ conventional-changelog-writer@^4.0.6: split "^1.0.0" through2 "^3.0.0" +conventional-changelog@^3.1.18: + version "3.1.18" + resolved "https://registry.yarnpkg.com/conventional-changelog/-/conventional-changelog-3.1.18.tgz#7da0a5ab34a604b920b8bf71c6cf5d952f0e805e" + integrity sha512-aN6a3rjgV8qwAJj3sC/Lme2kvswWO7fFSGQc32gREcwIOsaiqBaO6f2p0NomFaPDnTqZ+mMZFLL3hlzvEnZ0mQ== + dependencies: + conventional-changelog-angular "^5.0.6" + conventional-changelog-atom "^2.0.3" + conventional-changelog-codemirror "^2.0.3" + conventional-changelog-conventionalcommits "^4.2.3" + conventional-changelog-core "^4.1.4" + conventional-changelog-ember "^2.0.4" + conventional-changelog-eslint "^3.0.4" + conventional-changelog-express "^2.0.1" + conventional-changelog-jquery "^3.0.6" + conventional-changelog-jshint "^2.0.3" + conventional-changelog-preset-loader "^2.3.0" + conventional-commit-types@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/conventional-commit-types/-/conventional-commit-types-2.3.0.tgz#bc3c8ebba0a9e4b3ecc548f1d0674e251ab8be22" @@ -4124,7 +4274,7 @@ conventional-commits-filter@^2.0.2: lodash.ismatch "^4.4.0" modify-values "^1.0.0" -conventional-commits-parser@^3.0.3: +conventional-commits-parser@^3.0.3, conventional-commits-parser@^3.0.8: version "3.0.8" resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.8.tgz#23310a9bda6c93c874224375e72b09fb275fe710" integrity sha512-YcBSGkZbYp7d+Cr3NWUeXbPDFUN6g3SaSIzOybi8bjHL5IJ5225OSCxJJ4LgziyEJ7AaJtE9L2/EU6H7Nt/DDQ== @@ -4151,7 +4301,7 @@ conventional-recommended-bump@^5.0.0: meow "^4.0.0" q "^1.5.1" -convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1, convert-source-map@^1.7.0: +convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== @@ -4185,12 +4335,12 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= -copy-webpack-plugin@5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-5.0.4.tgz#c78126f604e24f194c6ec2f43a64e232b5d43655" - integrity sha512-YBuYGpSzoCHSSDGyHy6VJ7SHojKp6WHT4D7ItcQFNAYx2hrwkMe56e97xfVR0/ovDuMTrMffXUiltvQljtAGeg== +copy-webpack-plugin@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-5.1.1.tgz#5481a03dea1123d88a988c6ff8b78247214f0b88" + integrity sha512-P15M5ZC8dyCjQHWwd4Ia/dm0SgVvZJMYeykVIVYXbGyqO4dWB5oyPHp9i7wjwo5LhtlhKbiBCdS2NvM07Wlybg== dependencies: - cacache "^11.3.3" + cacache "^12.0.3" find-cache-dir "^2.1.0" glob-parent "^3.1.0" globby "^7.1.1" @@ -4198,18 +4348,18 @@ copy-webpack-plugin@5.0.4: loader-utils "^1.2.3" minimatch "^3.0.4" normalize-path "^3.0.0" - p-limit "^2.2.0" + p-limit "^2.2.1" schema-utils "^1.0.0" - serialize-javascript "^1.7.0" + serialize-javascript "^2.1.2" webpack-log "^2.0.0" -core-js-compat@^3.1.1: - version "3.4.7" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.4.7.tgz#39f8080b1d92a524d6d90505c42b9c5c1eb90611" - integrity sha512-57+mgz/P/xsGdjwQYkwtBZR3LuISaxD1dEwVDtbk8xJMqAmwqaxLOvnNT7kdJ7jYE/NjNptyzXi+IQFMi/2fCw== +core-js-compat@^3.4.7: + version "3.6.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.1.tgz#39638c935c83c93a793abb628b252ec43e85783a" + integrity sha512-2Tl1EuxZo94QS2VeH28Ebf5g3xbPZG/hj/N5HDDy4XMP/ImR0JIer/nggQRiMN91Q54JVkGbytf42wO29oXVHg== dependencies: - browserslist "^4.8.0" - semver "^6.3.0" + browserslist "^4.8.2" + semver "7.0.0" core-js-pure@^3.0.0: version "3.4.7" @@ -4820,7 +4970,7 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -electron-to-chromium@^1.3.191, electron-to-chromium@^1.3.317: +electron-to-chromium@^1.3.191, electron-to-chromium@^1.3.317, electron-to-chromium@^1.3.322: version "1.3.322" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.322.tgz#a6f7e1c79025c2b05838e8e344f6e89eb83213a8" integrity sha512-Tc8JQEfGQ1MzfSzI/bTlSr7btJv/FFO7Yh6tanqVmIWOuNCu6/D1MilIEgLtmWqIrsv+o4IjpLAhgMBr/ncNAA== @@ -5642,6 +5792,14 @@ git-semver-tags@^2.0.3: meow "^4.0.0" semver "^6.0.0" +git-semver-tags@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-3.0.1.tgz#9cb9e4974437de1f71f32da3bfe74f4d35afb1b9" + integrity sha512-Hzd1MOHXouITfCasrpVJbRDg9uvW7LfABk3GQmXYZByerBDrfrEMP9HXpNT7RxAbieiocP6u+xq20DkvjwxnCA== + dependencies: + meow "^5.0.0" + semver "^6.0.0" + git-up@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.1.tgz#cb2ef086653640e721d2042fe3104857d89007c0" @@ -8471,6 +8629,13 @@ node-releases@^1.1.25, node-releases@^1.1.41: dependencies: semver "^6.3.0" +node-releases@^1.1.42: + version "1.1.44" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.44.tgz#cd66438a6eb875e3eb012b6a12e48d9f4326ffd7" + integrity sha512-NwbdvJyR7nrcGrXvKAvzc5raj/NkoJudkarh2yIpJ4t0NH4aqjUDz/486P+ynIW5eokKOfzGNRdYoLfBlomruw== + dependencies: + semver "^6.3.0" + node-sass-tilde-importer@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/node-sass-tilde-importer/-/node-sass-tilde-importer-1.0.2.tgz#1a15105c153f648323b4347693fdb0f331bad1ce" @@ -8917,7 +9082,7 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" -p-limit@^2.0.0, p-limit@^2.2.0: +p-limit@^2.0.0, p-limit@^2.2.0, p-limit@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== @@ -10478,6 +10643,11 @@ semver@6.3.0, semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" + integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== + semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -10507,6 +10677,11 @@ serialize-javascript@^1.7.0: resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.9.1.tgz#cfc200aef77b600c47da9bb8149c943e798c2fdb" integrity sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A== +serialize-javascript@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61" + integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ== + serve-index@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" @@ -11273,6 +11448,11 @@ temp-dir@^1.0.0: resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d" integrity sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0= +temp-dir@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-2.0.0.tgz#bde92b05bdfeb1516e804c9c00ad45177f31321e" + integrity sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg== + temp-write@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/temp-write/-/temp-write-3.4.0.tgz#8cff630fb7e9da05f047c74ce4ce4d685457d492" @@ -11285,6 +11465,14 @@ temp-write@^3.4.0: temp-dir "^1.0.0" uuid "^3.0.1" +tempfile@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/tempfile/-/tempfile-3.0.0.tgz#5376a3492de7c54150d0cc0612c3f00e2cdaf76c" + integrity sha512-uNFCg478XovRi85iD42egu+eSFUmmka750Jy7L5tfHI5hQKKtbPnxaSaXAbBqCDYrw3wx4tXjKwci4/QmsZJxw== + dependencies: + temp-dir "^2.0.0" + uuid "^3.3.2" + term-size@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/term-size/-/term-size-1.2.0.tgz#458b83887f288fc56d6fffbfad262e26638efa69" @@ -11292,7 +11480,22 @@ term-size@^1.2.0: dependencies: execa "^0.7.0" -terser-webpack-plugin@1.4.1, terser-webpack-plugin@^1.4.1: +terser-webpack-plugin@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz#5ecaf2dbdc5fb99745fd06791f46fc9ddb1c9a7c" + integrity sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA== + dependencies: + cacache "^12.0.2" + find-cache-dir "^2.1.0" + is-wsl "^1.1.0" + schema-utils "^1.0.0" + serialize-javascript "^2.1.2" + source-map "^0.6.1" + terser "^4.1.2" + webpack-sources "^1.4.0" + worker-farm "^1.7.0" + +terser-webpack-plugin@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz#61b18e40eaee5be97e771cdbb10ed1280888c2b4" integrity sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg== diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.TestBase/BookStoreTestBase.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.TestBase/BookStoreTestBase.cs index 225ab01776..0f44532e7a 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.TestBase/BookStoreTestBase.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.TestBase/BookStoreTestBase.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; using Volo.Abp.Uow; +using Volo.Abp.Testing; namespace Acme.BookStore { diff --git a/samples/BookStore-Modular/application/test/Acme.BookStore.TestBase/BookStoreTestBase.cs b/samples/BookStore-Modular/application/test/Acme.BookStore.TestBase/BookStoreTestBase.cs index 225ab01776..0f44532e7a 100644 --- a/samples/BookStore-Modular/application/test/Acme.BookStore.TestBase/BookStoreTestBase.cs +++ b/samples/BookStore-Modular/application/test/Acme.BookStore.TestBase/BookStoreTestBase.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; using Volo.Abp.Uow; +using Volo.Abp.Testing; namespace Acme.BookStore { diff --git a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.TestBase/BookManagementTestBase.cs b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.TestBase/BookManagementTestBase.cs index d4a4de4ea9..dea660609e 100644 --- a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.TestBase/BookManagementTestBase.cs +++ b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.TestBase/BookManagementTestBase.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; using Volo.Abp.Uow; +using Volo.Abp.Testing; namespace Acme.BookStore.BookManagement { diff --git a/samples/BookStore/test/Acme.BookStore.TestBase/BookStoreTestBase.cs b/samples/BookStore/test/Acme.BookStore.TestBase/BookStoreTestBase.cs index 225ab01776..0f44532e7a 100644 --- a/samples/BookStore/test/Acme.BookStore.TestBase/BookStoreTestBase.cs +++ b/samples/BookStore/test/Acme.BookStore.TestBase/BookStoreTestBase.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; using Volo.Abp.Uow; +using Volo.Abp.Testing; namespace Acme.BookStore { diff --git a/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemoTestBase.cs b/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemoTestBase.cs index 6cb687f0b9..937a515d14 100644 --- a/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemoTestBase.cs +++ b/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemoTestBase.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; using Volo.Abp.Uow; +using Volo.Abp.Testing; namespace DashboardDemo { diff --git a/samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement/ProductManagementTestBase.cs b/samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement/ProductManagementTestBase.cs index a36766b724..63269b0cf8 100644 --- a/samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement/ProductManagementTestBase.cs +++ b/samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement/ProductManagementTestBase.cs @@ -1,5 +1,6 @@ using Volo.Abp; using Volo.Abp.Modularity; +using Volo.Abp.Testing; namespace ProductManagement { diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs index 38e95a5d4b..f20fb70a7e 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs @@ -5,11 +5,11 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.IdentityServer; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; using Volo.Abp.SettingManagement; using Volo.Abp.TenantManagement; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace MyCompanyName.MyProjectName diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs index 3951905c8d..34bb6c01c2 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; using Volo.Abp.Uow; +using Volo.Abp.Testing; namespace MyCompanyName.MyProjectName { diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestModule.cs b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestModule.cs index 78efb08262..f3998e71dc 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestModule.cs +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestModule.cs @@ -13,9 +13,9 @@ using MyCompanyName.MyProjectName.Web.Menus; using Volo.Abp; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; +using Volo.Abp.Validation.Localization; namespace MyCompanyName.MyProjectName { diff --git a/templates/module/angular/projects/my-project-name/src/lib/my-project-name-routing.module.ts b/templates/module/angular/projects/my-project-name/src/lib/my-project-name-routing.module.ts index 5ef00189aa..c1018686fe 100644 --- a/templates/module/angular/projects/my-project-name/src/lib/my-project-name-routing.module.ts +++ b/templates/module/angular/projects/my-project-name/src/lib/my-project-name-routing.module.ts @@ -1,4 +1,10 @@ -import { AuthGuard, DynamicLayoutComponent, PermissionGuard } from '@abp/ng.core'; +import { + AuthGuard, + DynamicLayoutComponent, + PermissionGuard, + ReplaceableComponents, + ReplaceableRouteContainerComponent, +} from '@abp/ng.core'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { MyProjectNameComponent } from './components/my-project-name.component'; @@ -8,8 +14,19 @@ const routes: Routes = [ path: '', component: DynamicLayoutComponent, canActivate: [AuthGuard, PermissionGuard], - data: { requiredPolicy: '' }, - children: [{ path: '', component: MyProjectNameComponent }], + children: [ + { + path: '', + component: ReplaceableRouteContainerComponent, + data: { + requiredPolicy: '', + replaceableComponent: { + defaultComponent: MyProjectNameComponent, + key: 'MyProjectName.MyProjectNameComponent', + } as ReplaceableComponents.RouteData, + }, + }, + ], }, ]; diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj index 6cb4f837a1..6afc84fe77 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj @@ -8,7 +8,7 @@ - + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs index 2d22b07cdf..384aae162a 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs @@ -2,13 +2,14 @@ using Volo.Abp.Localization; using MyCompanyName.MyProjectName.Localization; using Volo.Abp.Localization.ExceptionHandling; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace MyCompanyName.MyProjectName { [DependsOn( - typeof(AbpLocalizationModule) + typeof(AbpValidationModule) )] public class MyProjectNameDomainSharedModule : AbpModule { diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs index 7bcdcfe9c5..fcf6e3ffc6 100644 --- a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; using Volo.Abp.Uow; +using Volo.Abp.Testing; namespace MyCompanyName.MyProjectName {