diff --git a/.github/labeler.yml b/.github/labeler.yml
index 738b727317..cb0c9cddbd 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -1,4 +1,15 @@
ui-angular:
+ - npm/ng-packs/*
- npm/ng-packs/**/*
+ - npm/ng-packs/**/**/*
+ - npm/ng-packs/**/**/**/*
+ - npm/ng-packs/**/**/**/**/*
+ - npm/ng-packs/**/**/**/**/**/*
+ - templates/app/angular/*
- templates/app/angular/**/*
+ - templates/app/angular/**/**/*
+ - templates/app/angular/**/**/**/*
+ - templates/module/angular/*
- templates/module/angular/**/*
+ - templates/module/angular/**/**/*
+ - templates/module/angular/**/**/**/*
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index e70e966d4a..f24ba57949 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -1,17 +1,12 @@
-name: "Pull Request Labeler"
+name: Pull request labeler
on:
- pull_request:
- paths:
- - npm/ng-packs/**/*
- - templates/app/angular/**/*
- - templates/module/angular/**/*
- branches:
- - master
- - dev
+ schedule:
+ - cron: '0 12 */1 * *'
jobs:
labeler:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-latest
steps:
- - uses: actions/labeler@v2
- with:
- repo-token: "${{ secrets.GITHUB_TOKEN }}"
+ - uses: paulfantom/periodic-labeler@master
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GITHUB_REPOSITORY: ${{ github.repository }}
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
index 3ca5aa1e97..c83e5aa6a9 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
@@ -25,6 +25,7 @@
"Volo.AbpIo.Commercial:010004": "Can not find the specified user! The user must have already registered.",
"MyOrganizations": "My organizations",
"ApiKey": "API key",
- "UserNameNotFound": "There is no user with username {0}"
+ "UserNameNotFound": "There is no user with username {0}",
+ "SuccessfullyAddedToNewsletter": "Thanks you for subscribing to our newsletter!"
}
}
\ No newline at end of file
diff --git a/common.props b/common.props
index a43b2acaab..1a273a3efe 100644
--- a/common.props
+++ b/common.props
@@ -1,7 +1,7 @@
latest
- 1.0.2
+ 2.0.0$(NoWarn);CS1591https://abp.io/assets/abp_nupkg.pnghttps://abp.io
diff --git a/docs/cs/Best-Practices/PostgreSQL-Integration.md b/docs/cs/Best-Practices/PostgreSQL-Integration.md
deleted file mode 100644
index 6bf8224f1e..0000000000
--- a/docs/cs/Best-Practices/PostgreSQL-Integration.md
+++ /dev/null
@@ -1,35 +0,0 @@
-## Entity Framework Core PostgreSQL integrace
-
-> Podívejte se na [Entity Framework Core integrační dokument](../Entity-Framework-Core.md) pro základy integrace EF Core.
-
-### Aktualizace projektu EntityFrameworkCore
-
-- V projektu `Acme.BookStore.EntityFrameworkCore` nahraďte balík `Volo.Abp.EntityFrameworkCore.SqlServer` za `Volo.Abp.EntityFrameworkCore.PostgreSql`
-- Aktualizace pro použití PostgreSQL v `BookStoreEntityFrameworkCoreModule`
- - Nahraďte `AbpEntityFrameworkCoreSqlServerModule` za `AbpEntityFrameworkCorePostgreSqlModule`
- - Nahraďte `options.UseSqlServer()` za `options.UsePostgreSql()`
-- V jiných projektech aktualizujte PostgreSQL connection string v nezbytných `appsettings.json` souborech
-
-#### Odstranění stávajících migrací
-
-Smažte všechny stavající migrační soubory (včetně `DbContextModelSnapshot`)
-
-
-
-#### Znovu vygenerujte počáteční migraci & aktualizujte databázi
-
-Nastavte správný spouštěcí projekt (obvykle web projekt),
-Otevřete **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), zvolte `Acme.BookStore.EntityFrameworkCore.DbMigrations` jako **Default project** a proveďte následující příkaz:
-
-Proveďte příkaz `Add-Migration`:
-````
-PM> Add-Migration Initial
-````
-
-Poté proveďte příkaz `Update-Database` k aktualizaci schématu databáze:
-
-````
-PM> Update-Database
-````
-
-
diff --git a/docs/cs/CLI.md b/docs/cs/CLI.md
index cbf8006ad2..2779ba64f3 100644
--- a/docs/cs/CLI.md
+++ b/docs/cs/CLI.md
@@ -46,11 +46,13 @@ abp new Acme.BookStore
* `--tiered`: Vytvoří stupňovité řešení, kde jsou vrstvy Web a Http API fyzicky odděleny. Pokud není uvedeno, tak vytvoří vrstvené řešení, které je méně složité a vhodné pro většinu scénářů.
* `angular`: Angular. Pro tuto šablonu jsou dostupné dodatečné možnosti:
* `--separate-identity-server`: Oddělí identity server aplikaci od API host aplikace. Pokud není uvedeno, bude na straně serveru jediný koncový bod.
+ * `none`: Bez UI. Pro tuto šablonu jsou dostupné dodatečné možnosti:
+ * `--separate-identity-server`: Oddělí identity server aplikaci od API host aplikace. Pokud není uvedeno, bude na straně serveru jediný koncový bod.
* `--database-provider` nebo `-d`: Určuje poskytovatele databáze. Výchozí poskytovatel je `ef`. Dostupní poskytovatelé:
* `ef`: Entity Framework Core.
* `mongodb`: MongoDB.
* `module`: [Šablona modulu](Startup-Templates/Module.md). Dodatečné možnosti:
- * `--no-ui`: Určuje nezahrnutí uživatelského rozhraní. Umožňuje vytvořit moduly pouze pro služby (a.k.a. mikroslužby - bez uživatelského rozhraní).
+ * `--no-ui`: Určuje nezahrnutí uživatelského rozhraní. Umožňuje vytvořit moduly pouze pro služby (a.k.a. mikroslužby - bez uživatelského rozhraní).
* `--output-folder` nebo `-o`: Určuje výstupní složku. Výchozí hodnota je aktuální adresář.
* `--version` nebo `-v`: Určuje verzi ABP & šablony. Může to být [štítek vydání](https://github.com/abpframework/abp/releases) nebo [název větve](https://github.com/abpframework/abp/branches). Pokud není uvedeno, používá nejnovější vydání. Většinou budete chtít použít nejnovější verzi.
diff --git a/docs/cs/EntityFrameworkCore-PostgreSQL-Integration.md b/docs/cs/EntityFrameworkCore-PostgreSQL-Integration.md
new file mode 100644
index 0000000000..9d4f685316
--- /dev/null
+++ b/docs/cs/EntityFrameworkCore-PostgreSQL-Integration.md
@@ -0,0 +1,74 @@
+## Entity Framework Core PostgreSQL integrace
+
+> Podívejte se na [Entity Framework Core integrační dokument](../Entity-Framework-Core.md) pro základy integrace EF Core.
+
+### Aktualizace projektu EntityFrameworkCore
+
+- V projektu `Acme.BookStore.EntityFrameworkCore` nahraďte balík `Volo.Abp.EntityFrameworkCore.SqlServer` za `Volo.Abp.EntityFrameworkCore.PostgreSql`
+- Aktualizace pro použití PostgreSQL v `BookStoreEntityFrameworkCoreModule`
+ - Nahraďte `AbpEntityFrameworkCoreSqlServerModule` za `AbpEntityFrameworkCorePostgreSqlModule`
+ - Nahraďte `options.UseSqlServer()` za `options.UsePostgreSql()`
+- V jiných projektech aktualizujte PostgreSQL connection string v nezbytných `appsettings.json` souborech
+ - Více informací v [PostgreSQL connection strings](https://www.connectionstrings.com/postgresql/), v tomto dokumentu věnujte pozornost sekci `Npgsql`
+
+### Aktualizace projektu EntityFrameworkCore.DbMigrations
+- Aktualizace pro použití PostgreSQL v `XXXMigrationsDbContextFactory`
+ - Nahraďte `new DbContextOptionsBuilder().UseSqlServer()` za `new DbContextOptionsBuilder().UseNpgsql()`
+
+
+### Odstranění stávajících migrací
+
+Smažte všechny stavající migrační soubory (včetně `DbContextModelSnapshot`)
+
+
+
+### Znovu vygenerujte počáteční migraci
+
+Nastavte správný spouštěcí projekt (obvykle web projekt)
+
+
+
+Otevřete **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), zvolte `.EntityFrameworkCore.DbMigrations` jako **Default project** a proveďte následující příkaz:
+
+Proveďte příkaz `Add-Migration`:
+````
+PM> Add-Migration Initial
+````
+
+### Aktualizace databáze
+
+K vytvoření databáze máte dvě možnosti.
+
+#### Použití DbMigrator aplikace
+
+Řešení obsahuje konzolovou aplikaci (v tomto příkladu nazvanou `Acme.BookStore.DbMigrator`), která může vytvářet databáze, aplikovat migrace a vkládat seed data. Je užitečná jak pro vývojové, tak pro produkční prostředí.
+
+> Projekt `.DbMigrator` má vlastní `appsettings.json`. Takže pokud jste změnili connection string uvedený výše, musíte změnit také tento.
+
+Klikněte pravým na projekt `.DbMigrator` a vyberte **Set as StartUp Project**:
+
+
+
+Zmáčkněte F5 (nebo Ctrl+F5) ke spuštění aplikace. Výstup bude vypadat následovně:
+
+
+
+#### Použití EF Core Update-Database příkazu
+
+Ef Core má `Update-Database` příkaz, který v případě potřeby vytvoří databázi a aplikuje čekající migrace.
+
+Nastavte správný spouštěcí projekt (obvykle web projekt)
+
+
+
+Otevřete **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), vyberte projekt `.EntityFrameworkCore.DbMigrations` jako **Default Project** and spusťte následující příkaz:
+
+````
+PM> Update-Database
+````
+
+Dojde k vytvoření nové databáze na základě nakonfigurovaného connection stringu.
+
+
+
+> Použití nástroje `.DbMigrator` je doporučený způsob, jelikož zároveň vloží seed data nutné k správnému běhu webové aplikace.
diff --git a/docs/cs/Getting-Started-Angular-Template.md b/docs/cs/Getting-Started-Angular-Template.md
index 5dfc65c7ec..ea5ef0a4bf 100644
--- a/docs/cs/Getting-Started-Angular-Template.md
+++ b/docs/cs/Getting-Started-Angular-Template.md
@@ -75,7 +75,7 @@ Zmáčkněte F5 (nebo Ctrl+F5) ke spuštění aplikace. Výstup by měl být pod
#### Použití příkazu EF Core Update-Database
-Ef Core máš příkaz `Update-Database`, který v případě potřeby vytvoří databázi a aplikuje čekající migrace. Klikněte pravým na projekt `.Web` a zvolte **Set as StartUp Project**:
+Ef Core máš příkaz `Update-Database`, který v případě potřeby vytvoří databázi a aplikuje čekající migrace. Klikněte pravým na projekt `.HttpApi.Host` a zvolte **Set as StartUp Project**:

diff --git a/docs/cs/Getting-Started-AspNetCore-Application.md b/docs/cs/Getting-Started-AspNetCore-Application.md
index ffb2f556c6..0537b01579 100644
--- a/docs/cs/Getting-Started-AspNetCore-Application.md
+++ b/docs/cs/Getting-Started-AspNetCore-Application.md
@@ -4,15 +4,17 @@ Tento tutoriál vysvětluje jak začít s ABP z ničeho s minimem závislostí.
## Tvorba nového projektu
-1. Vytvořte novou prázdnou AspNet Core Web aplikaci ve Visual Studio:
+1. Vytvořte novou AspNet Core Web aplikaci ve Visual Studio 2019 (16.3.0+):
-
+
-2. Zvolte prázdnou šablonu
+2. Nakonfigurujte váš nový projekt:
-
+
-Můžete zvolit i jinou šablonu, ale pro demonstraci je lepší čístý projekt.
+3. Potvrďte kliknutím na tlačítko vytvořit
+
+
## Instalace Volo.Abp.AspNetCore.Mvc balíku
@@ -28,10 +30,8 @@ ABP je modulární framework a proto vyžaduje **spouštěcí (kořenový) modul
````C#
using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
using Volo.Abp;
-using Volo.Abp.AspNetCore.Modularity;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
@@ -40,7 +40,8 @@ namespace BasicAspNetCoreApplication
[DependsOn(typeof(AbpAspNetCoreMvcModule))]
public class AppModule : AbpModule
{
- public override void OnApplicationInitialization(ApplicationInitializationContext context)
+ public override void OnApplicationInitialization(
+ ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var env = context.GetEnvironment();
@@ -49,8 +50,14 @@ namespace BasicAspNetCoreApplication
{
app.UseDeveloperExceptionPage();
}
+ else
+ {
+ app.UseExceptionHandler("/Error");
+ }
- app.UseMvcWithDefaultRoute();
+ app.UseStaticFiles();
+ app.UseRouting();
+ app.UseMvcWithDefaultRouteAndArea();
}
}
}
@@ -58,7 +65,7 @@ namespace BasicAspNetCoreApplication
``AppModule`` je dobrý název pro spouštěcí modul aplikace.
-ABP balíky definují modulové třídy a modul může mít závislost na jiný modul. V kódu výše, náš ``AppModule`` má závislost na ``AbpAspNetCoreMvcModule`` (definován v balíku Volo.Abp.AspNetCore.Mvc). Je běžné přidat ``DependsOn`` atribute po instalaci nového ABP NuGet balíku.
+ABP balíky definují modulové třídy a modul může mít závislost na jiném. V kódu výše, ``AppModule`` má závislost na ``AbpAspNetCoreMvcModule`` (definován v balíku [Volo.Abp.AspNetCore.Mvc](https://www.nuget.org/packages/Volo.Abp.AspNetCore.Mvc)). Je běžné přidat ``DependsOn`` atribute po instalaci nového ABP NuGet balíku.
Místo třídy Startup, konfigurujeme ASP.NET Core pipeline v této modulové třídě.
@@ -67,7 +74,6 @@ Místo třídy Startup, konfigurujeme ASP.NET Core pipeline v této modulové t
V dalším kroku upravíme Startup třídu k integraci ABP modulového systému:
````C#
-using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
@@ -75,11 +81,9 @@ namespace BasicAspNetCoreApplication
{
public class Startup
{
- public IServiceProvider ConfigureServices(IServiceCollection services)
+ public void ConfigureServices(IServiceCollection services)
{
services.AddApplication();
-
- return services.BuildServiceProviderFromFactory();
}
public void Configure(IApplicationBuilder app)
@@ -88,41 +92,19 @@ namespace BasicAspNetCoreApplication
}
}
}
-
````
-Změnili jsme metodu ``ConfigureServices`` aby vracela ``IServiceProvider`` místo ``void``. Tato změna nám dovoluje nahradit AspNet Core vkládání závislostí za jiný framework (více v sekci Autofac integrace níže). ``services.AddApplication()`` přidává všechny služby definované ve všech modulech počínaje ``AppModule``.
+``services.AddApplication()`` přidává všechny služby definované ve všech modulech počínaje od ``AppModule``.
-Volání ``app.InitializeApplication()`` v metodě ``Configure`` inicializuje a spustí aplikaci.
+``app.InitializeApplication()`` v metodě ``Configure`` inicializuje a spustí aplikaci.
-## Ahoj světe!
+## Spusťte aplikaci!
-Aplikace výše zatím nic nedělá. Pojďme proto vytvořit MVC controller, který už něco dělá:
-
-````C#
-using Microsoft.AspNetCore.Mvc;
-using Volo.Abp.AspNetCore.Mvc;
-
-namespace BasicAspNetCoreApplication.Controllers
-{
- public class HomeController : AbpController
- {
- public IActionResult Index()
- {
- return Content("Hello World!");
- }
- }
-}
-
-````
-
-Jakmile spustíte aplikaci, uvidíte na stránce zprávu "Hello World!".
-
-Odvození ``HomeController`` od ``AbpController`` místo standardní třídy ``Controller``. Toto není vyžadováno, ale třída ``AbpController`` má užitečné základní vlastnosti a metody, které usnadňují vývoj.
+To je vše! Spusťte aplikaci, bude fungovat podle očekávání.
## Použití Autofac jako frameworku pro vkládání závislostí
-Ačkoliv je AspNet Core systém pro vkládání závíslostí (DI) skvělý pro základní požadavky, Autofac poskytuje pokročilé funkce jako injekce vlastností nebo záchyt metod, které jsou v ABP užity k provádění pokročilých funkcí frameworku.
+Ačkoliv je AspNet Core systém pro vkládání závíslostí (DI) dostatečný pro základní požadavky, [Autofac](https://autofac.org/) poskytuje pokročilé funkce jako injekce vlastností nebo záchyt metod, které jsou v ABP užity k provádění pokročilých funkcí frameworku.
Nahrazení AspNet Core DI systému za Autofac a integrace s ABP je snadná.
@@ -143,40 +125,29 @@ public class AppModule : AbpModule
}
````
-3. Změníme řádek ``services.AddApplication();`` v třídě ``Startup`` následovně:
-
-````C#
-services.AddApplication(options =>
-{
- options.UseAutofac(); // Integrace s Autofac
-});
-````
-
-4. Upravíme `Program.cs` aby nepoužíval metodu `WebHost.CreateDefaultBuilder()` jelikož ta používá výchozí DI kontejner:
+3. Upravíme `Program.cs` aby používal Autofac:
````csharp
-public class Program
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Hosting;
+
+namespace BasicAspNetCoreApplication
{
- public static void Main(string[] args)
+ public class Program
{
- /*
- https://github.com/aspnet/AspNetCore/issues/4206#issuecomment-445612167
- CurrentDirectoryHelpers exists in: \framework\src\Volo.Abp.AspNetCore.Mvc\Microsoft\AspNetCore\InProcess\CurrentDirectoryHelpers.cs
- Will remove CurrentDirectoryHelpers.cs when upgrade to ASP.NET Core 3.0.
- */
- CurrentDirectoryHelpers.SetCurrentDirectory();
-
- BuildWebHostInternal(args).Run();
- }
+ public static void Main(string[] args)
+ {
+ CreateHostBuilder(args).Build().Run();
+ }
- public static IWebHost BuildWebHostInternal(string[] args) =>
- new WebHostBuilder()
- .UseKestrel()
- .UseContentRoot(Directory.GetCurrentDirectory())
- .UseIIS()
- .UseIISIntegration()
- .UseStartup()
- .Build();
+ public static IHostBuilder CreateHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ webBuilder.UseStartup();
+ })
+ .UseAutofac(); // Přidejte tento řádek
+ }
}
````
diff --git a/docs/cs/Index.md b/docs/cs/Index.md
index ac13bcbdb6..0424c7120b 100644
--- a/docs/cs/Index.md
+++ b/docs/cs/Index.md
@@ -4,18 +4,12 @@ ABP je **open source aplikační framework** se zaměřením na vývoj webových
K procházení dokumentace využijte navigační nabídky vlevo.
-## Stav projektu
-
-ABP je **novou generací** open source frameworku [ASP.NET Boilerplate](https://aspnetboilerplate.com/). V současné době je v náhledové fázi a není připraven k ostrému nasazení. Na dokumentaci se stále pracuje a ještě zdaleka není dokončena.
-
-Pro aplikace na krátkodobé a ostré nasazení je doporučeno použít [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework, který je bohatý na funkce, vyspělý, aktivně udržovaný a aktuální.
-
## Začínáme
Nejsnazší cestou jak začít nový projekt s ABP je užití startovací šablony:
-* [ASP.NET Core MVC (Razor Pages) UI Šablona](Getting-Started-AspNetCore-MVC-Template.md)
-* [Angular UI Šablona](Getting-Started-Angular-Template.md)
+* [ASP.NET Core MVC (Razor Pages) UI Počáteční Šablona](Getting-Started-AspNetCore-MVC-Template.md)
+* [Angular UI Počáteční Šablona](Getting-Started-Angular-Template.md)
Pokud chcete začít od nuly (s prázdným projektem) tak manuálně nainstalujte ABP Framework s pomocí následujících tutoriálů:
diff --git a/docs/cs/docs-nav.json b/docs/cs/docs-nav.json
index 91badc73e9..85cbf43c9d 100644
--- a/docs/cs/docs-nav.json
+++ b/docs/cs/docs-nav.json
@@ -56,6 +56,10 @@
{
"text": "Základy",
"items": [
+ {
+ "text": "Konfigurace",
+ "path": "Configuration.md"
+ },
{
"text": "Vkládání závislostí",
"path": "Dependency-Injection.md",
@@ -82,16 +86,19 @@
"text": "Validace"
},
{
- "text": "Autorizace"
+ "text": "Autorizace",
+ "path": "Authorization.md"
},
{
- "text": "Ukládání do mezipaměti"
+ "text": "Ukládání do mezipaměti",
+ "path": "Caching.md"
},
{
"text": "Audit"
},
{
- "text": "Správa nastavení"
+ "text": "Nastavení",
+ "path": "Settings.md"
}
]
},
@@ -114,6 +121,14 @@
{
"text": "Služby",
"items": [
+ {
+ "text": "Současný uživatel",
+ "path": "CurrentUser.md"
+ },
+ {
+ "text": "Mapování objekt na objekt",
+ "path": "Object-To-Object-Mapping.md"
+ },
{
"text": "Serializace objektu"
},
@@ -249,7 +264,7 @@
"items": [
{
"text": "PostgreSQL integrace",
- "path": "Best-Practices/PostgreSQL-Integration.md"
+ "path": "EntityFrameworkCore-PostgreSQL-Integration.md"
}
]
},
diff --git a/docs/cs/images/authorization-new-permission-ui-hierarcy.png b/docs/cs/images/authorization-new-permission-ui-hierarcy.png
new file mode 100644
index 0000000000..078d67d50f
Binary files /dev/null and b/docs/cs/images/authorization-new-permission-ui-hierarcy.png differ
diff --git a/docs/cs/images/authorization-new-permission-ui-localized.png b/docs/cs/images/authorization-new-permission-ui-localized.png
new file mode 100644
index 0000000000..610ce39faf
Binary files /dev/null and b/docs/cs/images/authorization-new-permission-ui-localized.png differ
diff --git a/docs/cs/images/authorization-new-permission-ui.png b/docs/cs/images/authorization-new-permission-ui.png
new file mode 100644
index 0000000000..554f27e78d
Binary files /dev/null and b/docs/cs/images/authorization-new-permission-ui.png differ
diff --git a/docs/cs/images/create-aspnet-core-application.png b/docs/cs/images/create-aspnet-core-application.png
new file mode 100644
index 0000000000..5813cf38e9
Binary files /dev/null and b/docs/cs/images/create-aspnet-core-application.png differ
diff --git a/docs/cs/images/create-new-aspnet-core-application-v2.png b/docs/cs/images/create-new-aspnet-core-application-v2.png
new file mode 100644
index 0000000000..f8274ae2a4
Binary files /dev/null and b/docs/cs/images/create-new-aspnet-core-application-v2.png differ
diff --git a/docs/cs/images/select-empty-web-application-v2.png b/docs/cs/images/select-empty-web-application-v2.png
new file mode 100644
index 0000000000..da32f71857
Binary files /dev/null and b/docs/cs/images/select-empty-web-application-v2.png differ
diff --git a/docs/en/Best-Practices/Entity-Framework-Core-Integration.md b/docs/en/Best-Practices/Entity-Framework-Core-Integration.md
index f150bd6f66..4f7e20dd70 100644
--- a/docs/en/Best-Practices/Entity-Framework-Core-Integration.md
+++ b/docs/en/Best-Practices/Entity-Framework-Core-Integration.md
@@ -174,12 +174,12 @@ public static IQueryable IncludeDetails(
* **Do** use the `IncludeDetails` extension method in the repository methods just like used in the example code above (see FindByNormalizedUserNameAsync).
-- **Do** override `IncludeDetails` method of the repository for aggregates root which have **sub collections**. Example:
+- **Do** override `WithDetails` method of the repository for aggregates root which have **sub collections**. Example:
````C#
-protected override IQueryable IncludeDetails(IQueryable queryable)
+public override IQueryable WithDetails()
{
- return queryable.IncludeDetails(); //uses the extension method defined above
+ return GetQueryable().IncludeDetails(); // Uses the extension method defined above
}
````
@@ -206,4 +206,3 @@ public class AbpIdentityEntityFrameworkCoreModule : AbpModule
}
}
````
-
diff --git a/docs/en/CLI.md b/docs/en/CLI.md
index 57bda25004..a1d3d51138 100644
--- a/docs/en/CLI.md
+++ b/docs/en/CLI.md
@@ -128,6 +128,24 @@ abp update [options]
* `--npm`: Only updates NPM packages.
* `--nuget`: Only updates NuGet packages.
+### login
+
+Some features of the CLI requires to be logged in to abp.io platform. To login with your username write
+
+```bash
+abp login
+```
+
+Notice that, a new login with an already active session, will kill the previous session and creates a new one.
+
+### logout
+
+Logs you out by removing the session token from your computer.
+
+```
+abp logout
+```
+
### help
Writes basic usage information of the CLI.
diff --git a/docs/en/Connection-Strings.md b/docs/en/Connection-Strings.md
new file mode 100644
index 0000000000..36103011e1
--- /dev/null
+++ b/docs/en/Connection-Strings.md
@@ -0,0 +1,11 @@
+# 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.
+
+However, currently the following providers are implements:
+
+* [Entity Framework Core](Entity-Framework-Core.md) (works with [various DBMS and providers](https://docs.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli).)
+* [MongoDB](MongoDB.md)
+* [Dapper](Dapper.md)
+
+More providers might be added in the next releases.
\ No newline at end of file
diff --git a/docs/en/Best-Practices/PostgreSQL-Integration.md b/docs/en/EntityFrameworkCore-PostgreSQL-Integration.md
similarity index 100%
rename from docs/en/Best-Practices/PostgreSQL-Integration.md
rename to docs/en/EntityFrameworkCore-PostgreSQL-Integration.md
diff --git a/docs/en/Modules/Docs.md b/docs/en/Modules/Docs.md
index ac85978740..0a74d7ebde 100644
--- a/docs/en/Modules/Docs.md
+++ b/docs/en/Modules/Docs.md
@@ -408,12 +408,101 @@ public class Person
```
~~~
-
-
As an example you can see ABP Framework documentation:
[https://github.com/abpframework/abp/blob/master/docs/en/](https://github.com/abpframework/abp/blob/master/docs/en/)
+#### Conditional sections feature (Using Scriban)
+
+Docs module uses [Scriban]( ) for conditionally show or hide some parts of a document. In order to use that feature, you have to create a JSON file as **Parameter document** per every language. It will contain all the key-values, as well as their display names.
+
+For example, [en/docs-params.json](https://github.com/abpio/abp-commercial-docs/blob/master/en/docs-params.json):
+
+```json
+{
+ "parameters": [{
+ "name": "UI",
+ "displayName": "UI",
+ "values": {
+ "MVC": "MVC / Razor Pages",
+ "NG": "Angular"
+ }
+ },
+ {
+ "name": "DB",
+ "displayName": "Database",
+ "values": {
+ "EF": "Entity Framework Core",
+ "Mongo": "MongoDB"
+ }
+ },
+ {
+ "name": "Tiered",
+ "displayName": "Tiered",
+ "values": {
+ "No": "Not Tiered",
+ "Yes": "Tiered"
+ }
+ }]
+}
+```
+
+Since not every single document in your projects may not have sections or may not need all of those parameters, you have to declare which of those parameters will be used for sectioning the document, as a JSON block anywhere on the document.
+
+For example [Getting-Started.md](https://github.com/abpio/abp-commercial-docs/blob/master/en/Getting-Started.md):
+
+```
+.....
+
+````json
+//[doc-params]
+{
+ "UI": ["MVC","NG"],
+ "DB": ["EF", "Mongo"],
+ "Tiered": ["Yes", "No"]
+}
+````
+
+........
+```
+
+This section will be automatically deleted during render. And f course, those key values must match with the ones in **Parameter document**.
+
+
+
+Now you can use **Scriban** syntax to create sections in your document.
+
+For example:
+
+````
+{{ if UI == "NG" }}
+
+* `-u` argument specifies the UI framework, `angular` in this case.
+
+{{ end }}
+
+{{ if DB == "Mongo" }}
+
+* `-d` argument specifies the database provider, `mongodb` in this case.
+
+{{ end }}
+
+{{ if Tiered == "Yes" }}
+
+* `--tiered` argument is used to create N-tiered solution where authentication server, UI and API layers are physically separated.
+
+{{ end }}
+
+````
+
+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.
+````
+
+**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
Navigation document is the main menu of the documents page. It is located on the left side of the page. It is a `JSON` file. Take a look at the below sample navigation document to understand the structure.
diff --git a/docs/en/Settings.md b/docs/en/Settings.md
index 35c5e2112f..32761ff201 100644
--- a/docs/en/Settings.md
+++ b/docs/en/Settings.md
@@ -40,6 +40,33 @@ ABP automatically discovers this class and registers the setting definitions.
* **Providers**: Can be used to restrict providers available for a particular setting (see the setting value providers section for more).
* **Properties**: A name/value collection to set custom properties about this setting those can be used later in the application code.
+### Change Setting Definitions of a Depended Module
+
+In some cases, you may want to change some properties of a settings defined in some other module that your application/module depends on. A setting definition provider can query and update setting definitions.
+
+The following example gets a setting defined by the [Volo.Abp.Emailing](Emailing.md) package and changes its properties:
+
+````csharp
+public class MySettingDefinitionProvider : SettingDefinitionProvider
+{
+ public override void Define(ISettingDefinitionContext context)
+ {
+ var smtpHost = context.GetOrNull("Abp.Mailing.Smtp.Host");
+ if (smtpHost != null)
+ {
+ smtpHost.DefaultValue = "mail.mydomain.com";
+ smtpHost.DisplayName =
+ new LocalizableString(
+ typeof(MyLocalizationResource),
+ "SmtpServer_DisplayName"
+ );
+ }
+ }
+}
+````
+
+> Using constants for the setting names is a good practice and ABP packages do it. `Abp.Mailing.Smtp.Host` setting name is a constant defined by the `EmailSettingNames` class (in the `Volo.Abp.Emailing` namespace).
+
## Reading Setting Values
### ISettingProvider
@@ -118,6 +145,30 @@ There are 5 pre-built setting value providers registered by the order below:
Global, Tenant and User setting value providers use the `ISettingStore` to read the value from the data source (see the section below).
+### Setting Values in the Application Configuration
+
+As mentioned in the previous section, `ConfigurationSettingValueProvider` reads the settings from the `IConfiguration` service, which can read values from the `appsettings.json` by default. So, the easiest way to configure setting values to define them in the `appsettings.json` file.
+
+For example, you can configure [IEmailSender](Emailing.md) settings as shown below:
+
+````json
+{
+ "Settings": {
+ "Abp.Mailing.DefaultFromAddress": "noreply@mydomain.com",
+ "Abp.Mailing.DefaultFromDisplayName": "My Application",
+ "Abp.Mailing.Smtp.Host": "mail.mydomain.com",
+ "Abp.Mailing.Smtp.Port": "547",
+ "Abp.Mailing.Smtp.UserName": "myusername",
+ "Abp.Mailing.Smtp.Password": "mySecretPassW00rd",
+ "Abp.Mailing.Smtp.EnableSsl": "True"
+ }
+}
+````
+
+Setting values should be configured under the `Settings` section as like in this example.
+
+> `IConfiguration` is an .NET Core service and it can read values not only from the `appsettings.json`, but also from the environment, user secrets... etc. See [Microsoft's documentation]( https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/ ) for more.
+
### Custom Setting Value Providers
If you need to extend the setting system, you can define a class derived from the `SettingValueProvider` class. Example:
@@ -165,7 +216,7 @@ This example adds it as the last item, so it will be the first value provider us
### ISettingStore
-While a setting value provider is free to use any source to get the setting value, the`ISettingStore` service is the default source of the setting values. Global, Tenant and User setting value providers use it.
+While a setting value provider is free to use any source to get the setting value, the `ISettingStore` service is the default source of the setting values. Global, Tenant and User setting value providers use it.
## ISettingEncryptionService
diff --git a/docs/en/Tutorials/Angular/Part-I.md b/docs/en/Tutorials/Angular/Part-I.md
index 88b5c8539e..46368eeecb 100644
--- a/docs/en/Tutorials/Angular/Part-I.md
+++ b/docs/en/Tutorials/Angular/Part-I.md
@@ -631,10 +631,10 @@ Replace `book-list.component.html` content as shown below:
-
{{ data.name }}
-
{{ booksType[data.type] }}
-
{{ data.publishDate | date }}
-
{{ data.price }}
+
{%{{{ data.name }}}%}
+
{%{{{ booksType[data.type] }}}%}
+
{%{{{ data.publishDate | date }}}%}
+
{%{{{ data.price }}}%}
diff --git a/docs/en/Tutorials/Angular/Part-II.md b/docs/en/Tutorials/Angular/Part-II.md
index 1dbfe9b5cd..6d1c563600 100644
--- a/docs/en/Tutorials/Angular/Part-II.md
+++ b/docs/en/Tutorials/Angular/Part-II.md
@@ -195,7 +195,7 @@ Open `book-list.component.html` and add the form in the body template of the mod
*
@@ -461,10 +461,10 @@ Open the `book-list.component.html` and add modify the `p-table` as shown belo
-
{{ data.name }}
-
{{ booksType[data.type] }}
-
{{ data.publishDate | date }}
-
{{ data.price }}
+
{%{{{ data.name }}}%}
+
{%{{{ booksType[data.type] }}}%}
+
{%{{{ data.publishDate | date }}}%}
+
{%{{{ data.price }}}%}
@@ -483,7 +483,7 @@ Update the modal header to change the title based on the current operation:
```html
-
diff --git a/docs/pt-BR/Tutorials/Angular/Part-II.md b/docs/pt-BR/Tutorials/Angular/Part-II.md
index 6113c325a3..e22c7ee238 100644
--- a/docs/pt-BR/Tutorials/Angular/Part-II.md
+++ b/docs/pt-BR/Tutorials/Angular/Part-II.md
@@ -195,7 +195,7 @@ Abra `book-list.component.html`e adicione o formulário no modelo de corpo do mo
*
@@ -455,10 +455,10 @@ Abra o `book-list.component.html` e adicione modifique o `p-table` como mostrado
-
{{ data.name }}
-
{{ booksType[data.type] }}
-
{{ data.publishDate | date }}
-
{{ data.price }}
+
{%{{{ data.name }}}%}
+
{%{{{ booksType[data.type] }}}%}
+
{%{{{ data.publishDate | date }}}%}
+
{%{{{ data.price }}}%}
@@ -477,7 +477,7 @@ Atualize o cabeçalho modal para alterar o título com base na operação atual:
```html
-
{{ selectedBook.id ? 'Edit' : 'New Book' }}
+
{%{{{ selectedBook.id ? 'Edit' : 'New Book' }}}%}
```
diff --git a/docs/pt-BR/docs-nav.json b/docs/pt-BR/docs-nav.json
index 90b29626b8..8e7eaf62af 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": "Best-Practices/PostgreSQL-Integration.md"
+ "path": "EntityFrameworkCore-PostgreSQL-Integration.md"
}
]
},
diff --git a/docs/zh-Hans/Best-Practices/Entity-Framework-Core-Integration.md b/docs/zh-Hans/Best-Practices/Entity-Framework-Core-Integration.md
index 3dd687be53..4d98c6cbc5 100644
--- a/docs/zh-Hans/Best-Practices/Entity-Framework-Core-Integration.md
+++ b/docs/zh-Hans/Best-Practices/Entity-Framework-Core-Integration.md
@@ -173,12 +173,12 @@ public static IQueryable IncludeDetails(
* **推荐** 推荐在仓储其他方法中使用 `IncludeDetails` 扩展方法, 就像上面的示例代码一样(参阅 FindByNormalizedUserNameAsync).
-- **推荐** 覆盖具有 **子集合** 的聚合根仓储中的`IncludeDetails` 方法. 例如:
+- **推荐** 覆盖具有 **子集合** 的聚合根仓储中的 `WithDetails` 方法. 例如:
````C#
-protected override IQueryable IncludeDetails(IQueryable queryable)
+public override IQueryable WithDetails()
{
- return queryable.IncludeDetails(); //uses the extension method defined above
+ return GetQueryable().IncludeDetails(); // Uses the extension method defined above
}
````
@@ -205,4 +205,3 @@ public class AbpIdentityEntityFrameworkCoreModule : AbpModule
}
}
````
-
diff --git a/docs/zh-Hans/Entities.md b/docs/zh-Hans/Entities.md
index ba567b2584..9c3066fef4 100644
--- a/docs/zh-Hans/Entities.md
+++ b/docs/zh-Hans/Entities.md
@@ -41,7 +41,7 @@ public class UserRole : Entity
public DateTime CreationTime { get; set; }
- public Phone()
+ public UserRole()
{
}
diff --git a/docs/zh-Hans/Best-Practices/PostgreSQL-Integration.md b/docs/zh-Hans/EntityFrameworkCore-PostgreSQL-Integration.md
similarity index 100%
rename from docs/zh-Hans/Best-Practices/PostgreSQL-Integration.md
rename to docs/zh-Hans/EntityFrameworkCore-PostgreSQL-Integration.md
diff --git a/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md b/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md
index c9a56447ba..f9314e5030 100644
--- a/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md
+++ b/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md
@@ -225,7 +225,7 @@ using Volo.Abp.Application.Services;
namespace Acme.BookStore
{
public interface IBookAppService :
- IAsyncCrudAppService< //定义了CRUD方法
+ ICrudAppService< //定义了CRUD方法
BookDto, //用来展示书籍
Guid, //Book实体的主键
PagedAndSortedResultRequestDto, //获取书籍的时候用于分页和排序
@@ -238,8 +238,8 @@ namespace Acme.BookStore
````
* 框架定义应用程序服务的接口不是必需的. 但是,它被建议作为最佳实践.
-* `IAsyncCrudAppService`定义了常见的**CRUD**方法:`GetAsync`,`GetListAsync`,`CreateAsync`,`UpdateAsync`和`DeleteAsync`. 你可以从空的`IApplicationService`接口继承并手动定义自己的方法.
-* `IAsyncCrudAppService`有一些变体, 你可以在每个方法中使用单独的DTO,也可以分别单独指定.
+* `ICrudAppService`定义了常见的**CRUD**方法:`GetAsync`,`GetListAsync`,`CreateAsync`,`UpdateAsync`和`DeleteAsync`. 你可以从空的`IApplicationService`接口继承并手动定义自己的方法.
+* `ICrudAppService`有一些变体, 你可以在每个方法中使用单独的DTO,也可以分别单独指定.
#### BookAppService
@@ -255,7 +255,7 @@ using Volo.Abp.Domain.Repositories;
namespace Acme.BookStore
{
public class BookAppService :
- AsyncCrudAppService,
IBookAppService
{
@@ -268,7 +268,7 @@ namespace Acme.BookStore
}
````
-* `BookAppService`继承了`AsyncCrudAppService<...>`.`AsyncCrudAppService<...>`实现了上面定义的CRUD方法.
+* `BookAppService`继承了`CrudAppService<...>`.它实现了上面定义的CRUD方法.
* `BookAppService`注入`IRepository `,这是`Book`实体的默认仓储. ABP自动为每个聚合根(或实体)创建默认仓储. 请参阅[仓储文档](../../Repositories.md)
* `BookAppService`使用`IObjectMapper`将`Book`对象转换为`BookDto`对象, 将`CreateUpdateBookDto`对象转换为`Book`对象. 启动模板使用[AutoMapper](http://automapper.org/)库作为对象映射提供程序. 你之前定义了映射, 因此它将按预期工作.
diff --git a/docs/zh-Hans/docs-nav.json b/docs/zh-Hans/docs-nav.json
index 3c6c58cd68..dd740f6c3b 100644
--- a/docs/zh-Hans/docs-nav.json
+++ b/docs/zh-Hans/docs-nav.json
@@ -254,7 +254,7 @@
"items": [
{
"text": "PostgreSQL 集成",
- "path": "Best-Practices/PostgreSQL-Integration.md"
+ "path": "EntityFrameworkCore-PostgreSQL-Integration.md"
}
]
},
diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj
index 0ccb29a319..eb6908d0cd 100644
--- a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AspNetCore.Authentication.JwtBearerVolo.Abp.AspNetCore.Authentication.JwtBearer$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -18,7 +18,7 @@
-
+
diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj
index 8541a681f0..6a5f7edb36 100644
--- a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AspNetCore.Authentication.OAuthVolo.Abp.AspNetCore.Authentication.OAuth$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo/Abp/AspNetCore/Authentication/OAuth/Claims/MultipleClaimAction.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo/Abp/AspNetCore/Authentication/OAuth/Claims/MultipleClaimAction.cs
index 074cc936d0..0c3b05090c 100644
--- a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo/Abp/AspNetCore/Authentication/OAuth/Claims/MultipleClaimAction.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo/Abp/AspNetCore/Authentication/OAuth/Claims/MultipleClaimAction.cs
@@ -14,7 +14,11 @@ namespace Volo.Abp.AspNetCore.Authentication.OAuth.Claims
public override void Run(JsonElement userData, ClaimsIdentity identity, string issuer)
{
- var prop = userData.GetProperty(ValueType);
+ JsonElement prop;
+
+ if (!userData.TryGetProperty(ValueType, out prop))
+ return;
+
if (prop.ValueKind == JsonValueKind.Null)
{
return;
diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj
index 384aaa262e..6688526622 100644
--- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AspNetCore.MultiTenancyVolo.Abp.AspNetCore.MultiTenancy$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj
index 253bf0d288..aa45445c43 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AspNetCore.Mvc.ClientVolo.Abp.AspNetCore.Mvc.Client$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
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 838150fd49..1fbb72bb3e 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
@@ -7,6 +7,7 @@ using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client.DynamicProxying;
+using Volo.Abp.Threading;
using Volo.Abp.Users;
namespace Volo.Abp.AspNetCore.Mvc.Client
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs
index 79033f3679..d60256a501 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs
@@ -55,9 +55,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
private Dictionary GetResourceOrNull()
{
- var applicationConfigurationDto = AsyncHelper.RunSync(
- () => _applicationConfigurationClient.GetAsync()
- );
+ var applicationConfigurationDto = AsyncHelper.RunSync(() => _applicationConfigurationClient.GetAsync());
var resource = applicationConfigurationDto
.Localization.Values
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 cbddb7c3c7..18f5272e7b 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
@@ -21,10 +21,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
return configuration.Auth.GrantedPolicies.ContainsKey(name);
}
- public Task IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name)
+ public async Task IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name)
{
/* This provider always works for the current principal. */
- return IsGrantedAsync(name);
+ return await IsGrantedAsync(name);
}
}
}
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 718abbb6a9..236387823c 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
@@ -85,12 +85,58 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
public TenantConfiguration Find(string name)
{
- return AsyncHelper.RunSync(() => FindAsync(name));
+ var cacheKey = CreateCacheKey(name);
+ var httpContext = HttpContextAccessor?.HttpContext;
+
+ if (httpContext != null && httpContext.Items[cacheKey] is TenantConfiguration tenantConfiguration)
+ {
+ return tenantConfiguration;
+ }
+
+ tenantConfiguration = Cache.GetOrAdd(
+ cacheKey,
+ () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name))),
+ () => new DistributedCacheEntryOptions
+ {
+ AbsoluteExpirationRelativeToNow =
+ TimeSpan.FromMinutes(5) //TODO: Should be configurable.
+ }
+ );
+
+ if (httpContext != null)
+ {
+ httpContext.Items[cacheKey] = tenantConfiguration;
+ }
+
+ return tenantConfiguration;
}
public TenantConfiguration Find(Guid id)
{
- return AsyncHelper.RunSync(() => FindAsync(id));
+ var cacheKey = CreateCacheKey(id);
+ var httpContext = HttpContextAccessor?.HttpContext;
+
+ if (httpContext != null && httpContext.Items[cacheKey] is TenantConfiguration tenantConfiguration)
+ {
+ return tenantConfiguration;
+ }
+
+ tenantConfiguration = Cache.GetOrAdd(
+ cacheKey,
+ () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id))),
+ () => new DistributedCacheEntryOptions
+ {
+ AbsoluteExpirationRelativeToNow =
+ TimeSpan.FromMinutes(5) //TODO: Should be configurable.
+ }
+ );
+
+ if (httpContext != null)
+ {
+ httpContext.Items[cacheKey] = tenantConfiguration;
+ }
+
+ return tenantConfiguration;
}
protected virtual TenantConfiguration CreateTenantConfiguration(FindTenantResultDto tenantResultDto)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj
index 173ff3cfbe..9d3107e90c 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AspNetCore.Mvc.ContractsVolo.Abp.AspNetCore.Mvc.Contracts$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
index f0eabc0025..c6ad85408b 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
@@ -3,7 +3,8 @@
- netcoreapp3.0
+ netcoreapp3.1
+ trueVolo.Abp.AspNetCore.Mvc.UI.BootstrapVolo.Abp.AspNetCore.Mvc.UI.Bootstrap$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
index 04158b461a..a1b83cbaef 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
@@ -3,7 +3,8 @@
- netcoreapp3.0
+ netcoreapp3.1
+ trueVolo.Abp.AspNetCore.Mvc.UI.BundlingVolo.Abp.AspNetCore.Mvc.UI.Bundlingtrue
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
index d55e9ec2df..7a31569dda 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
@@ -3,7 +3,8 @@
- netcoreapp3.0
+ netcoreapp3.1
+ trueVolo.Abp.AspNetCore.Mvc.UI.MultiTenancyVolo.Abp.AspNetCore.Mvc.UI.MultiTenancy$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/cs.json b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/cs.json
index 7151dc73f3..5887243cb4 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/cs.json
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/cs.json
@@ -6,6 +6,7 @@
"Switch": "změnit",
"Name": "Název",
"SwitchTenantHint": "Nechte pole prázdné ke změně na hostitele.",
+ "SwitchTenant": "Změnit tenant",
"NotSelected": "Nevybrán"
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/pt-BR.json b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/pt-BR.json
index 3b1643f03e..8ac517d594 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/pt-BR.json
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/pt-BR.json
@@ -6,6 +6,7 @@
"Switch": "trocar",
"Name": "Nome",
"SwitchTenantHint": "Deixe o campo de nome em branco para acessar o host.",
+ "SwitchTenant": "Alterar Inquilino",
"NotSelected": "Não selecionado"
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
index b91f36abf0..7a86cbb464 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
@@ -3,7 +3,8 @@
- netcoreapp3.0
+ netcoreapp3.1
+ trueVolo.Abp.AspNetCore.Mvc.UI.PackagesVolo.Abp.AspNetCore.Mvc.UI.Packagestrue
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj
index f12072816a..168ca481fd 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj
@@ -3,7 +3,8 @@
- netcoreapp3.0
+ netcoreapp3.1
+ trueVolo.Abp.AspNetCore.Mvc.UI.Theme.BasicVolo.Abp.AspNetCore.Mvc.UI.Theme.Basic$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Views/Error/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Views/Error/Default.cshtml
index f1c6bb91d3..cfd16a2b8c 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Views/Error/Default.cshtml
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Views/Error/Default.cshtml
@@ -2,8 +2,8 @@
@using System.Collections.Generic
@using Localization.Resources.AbpUi
@using Microsoft.AspNetCore.Mvc.Localization
-@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Error
-@model AbpErrorPageModel
+@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Views.Error
+@model AbpErrorViewModel
@inject IHtmlLocalizer L
@{
var errorMessage = Model.ErrorInfo.Message;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
index 258feaf64a..0962057909 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
@@ -3,7 +3,8 @@
- netcoreapp3.0
+ netcoreapp3.1
+ trueVolo.Abp.AspNetCore.Mvc.UI.Theme.SharedVolo.Abp.AspNetCore.Mvc.UI.Theme.Shared$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
index 75b83faaf2..d26c12fc7a 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
@@ -3,7 +3,8 @@
- netcoreapp3.0
+ netcoreapp3.1
+ trueVolo.Abp.AspNetCore.Mvc.UI.WidgetsVolo.Abp.AspNetCore.Mvc.UI.Widgetstrue
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
index 03e3d2bbd8..fb784efd44 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
@@ -3,7 +3,8 @@
- netcoreapp3.0
+ netcoreapp3.1
+ trueVolo.Abp.AspNetCore.Mvc.UIVolo.Abp.AspNetCore.Mvc.UI$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
index c0330fc577..0778c57747 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
@@ -3,7 +3,8 @@
- netcoreapp3.0
+ netcoreapp3.1
+ trueVolo.Abp.AspNetCore.MvcVolo.Abp.AspNetCore.Mvc$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -24,9 +25,9 @@
-
-
-
+
+
+
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
index ebc086dee6..06ce49551b 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
+using Microsoft.Extensions.Hosting;
using Volo.Abp.ApiVersioning;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.AspNetCore.Mvc.DependencyInjection;
@@ -64,6 +65,14 @@ namespace Volo.Abp.AspNetCore.Mvc
options.IgnoredInterfaces.AddIfNotContains(typeof(IActionFilter));
});
+ context.Services.PostConfigure(options =>
+ {
+ if (options.MinifyGeneratedScript == null)
+ {
+ options.MinifyGeneratedScript = context.Services.GetHostingEnvironment().IsProduction();
+ }
+ });
+
var mvcCoreBuilder = context.Services.AddMvcCore();
context.Services.ExecutePreConfiguredActions(mvcCoreBuilder);
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
index fb29e17496..55d5512c6a 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
@@ -4,6 +4,8 @@ namespace Volo.Abp.AspNetCore.Mvc
{
public class AbpAspNetCoreMvcOptions
{
+ public bool? MinifyGeneratedScript { get; set; }
+
public AbpConventionalControllerOptions ConventionalControllers { get; }
public AbpAspNetCoreMvcOptions()
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 f3af9182ba..5015d146e8 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
@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
using Volo.Abp.Application.Services;
using Volo.Abp.Authorization;
using Volo.Abp.Features;
@@ -34,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
IAuthorizationService authorizationService,
ICurrentUser currentUser,
ISettingProvider settingProvider,
- SettingDefinitionManager settingDefinitionManager,
+ ISettingDefinitionManager settingDefinitionManager,
IFeatureDefinitionManager featureDefinitionManager,
ILanguageProvider languageProvider)
{
@@ -76,23 +77,35 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
protected virtual async Task GetAuthConfigAsync()
{
+ Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetAuthConfigAsync()");
+
var authConfig = new ApplicationAuthConfigurationDto();
- foreach (var policyName in await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync())
+ var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync();
+
+ Logger.LogDebug($"GetPoliciesNamesAsync returns {policyNames.Count} items.");
+
+ foreach (var policyName in policyNames)
{
authConfig.Policies[policyName] = true;
+ Logger.LogDebug($"_authorizationService.IsGrantedAsync? {policyName}");
+
if (await _authorizationService.IsGrantedAsync(policyName))
{
authConfig.GrantedPolicies[policyName] = true;
}
}
+ Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetAuthConfigAsync()");
+
return authConfig;
}
protected virtual async Task GetLocalizationConfigAsync()
{
+ Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetLocalizationConfigAsync()");
+
var localizationConfig = new ApplicationLocalizationConfigurationDto();
localizationConfig.Languages.AddRange(await _languageProvider.GetLanguagesAsync());
@@ -115,12 +128,14 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
localizationConfig.CurrentCulture = GetCurrentCultureInfo();
+ Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetLocalizationConfigAsync()");
+
return localizationConfig;
}
private static CurrentCultureDto GetCurrentCultureInfo()
{
- return new CurrentCultureDto
+ return new CurrentCultureDto
{
Name = CultureInfo.CurrentUICulture.Name,
DisplayName = CultureInfo.CurrentUICulture.DisplayName,
@@ -145,6 +160,8 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
private async Task GetSettingConfigAsync()
{
+ Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetSettingConfigAsync()");
+
var result = new ApplicationSettingConfigurationDto
{
Values = new Dictionary()
@@ -160,11 +177,15 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
result.Values[settingDefinition.Name] = await _settingProvider.GetOrNullAsync(settingDefinition.Name);
}
+ Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetSettingConfigAsync()");
+
return result;
}
protected virtual async Task GetFeaturesConfigAsync()
{
+ Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetFeaturesConfigAsync()");
+
var result = new ApplicationFeatureConfigurationDto();
foreach (var featureDefinition in _featureDefinitionManager.GetAll())
@@ -177,6 +198,8 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
result.Values[featureDefinition.Name] = await FeatureChecker.GetOrNullAsync(featureDefinition.Name);
}
+ Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetFeaturesConfigAsync()");
+
return result;
}
}
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 98e09ff9a8..67672986be 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
@@ -15,9 +15,9 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
}
[HttpGet]
- public Task GetAsync()
+ public async Task GetAsync()
{
- return _applicationConfigurationAppService.GetAsync();
+ return await _applicationConfigurationAppService.GetAsync();
}
}
}
\ 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 bce46bab44..6cc01966a5 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
@@ -1,10 +1,11 @@
-using System.Diagnostics;
-using System.Text;
+using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
using Volo.Abp.Auditing;
using Volo.Abp.Http;
using Volo.Abp.Json;
+using Volo.Abp.Minify.Scripts;
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
{
@@ -15,23 +16,31 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
{
private readonly IAbpApplicationConfigurationAppService _configurationAppService;
private readonly IJsonSerializer _jsonSerializer;
+ private readonly AbpAspNetCoreMvcOptions _options;
+ private readonly IJavascriptMinifier _javascriptMinifier;
public AbpApplicationConfigurationScriptController(
IAbpApplicationConfigurationAppService configurationAppService,
- IJsonSerializer jsonSerializer)
+ IJsonSerializer jsonSerializer,
+ IOptions options,
+ IJavascriptMinifier javascriptMinifier)
{
_configurationAppService = configurationAppService;
_jsonSerializer = jsonSerializer;
+ _options = options.Value;
+ _javascriptMinifier = javascriptMinifier;
}
[HttpGet]
[Produces(MimeTypes.Application.Javascript, MimeTypes.Text.Plain)]
public async Task Get()
{
+ var script = CreateAbpExtendScript(await _configurationAppService.GetAsync());
+
return Content(
- CreateAbpExtendScript(
- await _configurationAppService.GetAsync()
- ),
+ _options.MinifyGeneratedScript == true
+ ? _javascriptMinifier.Minify(script)
+ : script,
MimeTypes.Application.Javascript
);
}
@@ -42,7 +51,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
script.AppendLine("(function(){");
script.AppendLine();
- script.AppendLine($"$.extend(true, abp, {_jsonSerializer.Serialize(config, indented: Debugger.IsAttached)})");
+ script.AppendLine($"$.extend(true, abp, {_jsonSerializer.Serialize(config, indented: true)})");
script.AppendLine();
script.AppendLine("abp.event.trigger('abp.configurationInitialized');");
script.AppendLine();
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs
index 87e77efa6d..9875ccd808 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs
@@ -171,6 +171,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
RemoveEmptySelectors(controller.Selectors);
+ var controllerType = controller.ControllerType.AsType();
+ var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault(controllerType.GetTypeInfo());
+ if (remoteServiceAtt != null && !remoteServiceAtt.IsEnabledFor(controllerType))
+ {
+ return;
+ }
+
if (controller.Selectors.Any(selector => selector.AttributeRouteModel != null))
{
return;
@@ -188,6 +195,12 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
RemoveEmptySelectors(action.Selectors);
+ var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault(action.ActionMethod);
+ if (remoteServiceAtt != null && !remoteServiceAtt.IsEnabledFor(action.ActionMethod))
+ {
+ return;
+ }
+
if (!action.Selectors.Any())
{
AddAbpServiceSelector(rootPath, controllerName, action, configuration);
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxyScriptController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxyScriptController.cs
index b94e5c6a92..99cada9602 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxyScriptController.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxyScriptController.cs
@@ -1,7 +1,9 @@
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
using Volo.Abp.Auditing;
using Volo.Abp.Http;
using Volo.Abp.Http.ProxyScripting;
+using Volo.Abp.Minify.Scripts;
namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting
{
@@ -11,10 +13,16 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting
public class AbpServiceProxyScriptController : AbpController
{
private readonly IProxyScriptManager _proxyScriptManager;
+ private readonly AbpAspNetCoreMvcOptions _options;
+ private readonly IJavascriptMinifier _javascriptMinifier;
- public AbpServiceProxyScriptController(IProxyScriptManager proxyScriptManager)
+ public AbpServiceProxyScriptController(IProxyScriptManager proxyScriptManager,
+ IOptions options,
+ IJavascriptMinifier javascriptMinifier)
{
_proxyScriptManager = proxyScriptManager;
+ _options = options.Value;
+ _javascriptMinifier = javascriptMinifier;
}
[HttpGet]
@@ -22,7 +30,15 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting
public ActionResult GetAll(ServiceProxyGenerationModel model)
{
model.Normalize();
- return Content(_proxyScriptManager.GetScript(model.CreateOptions()), MimeTypes.Application.Javascript);
+
+ var script = _proxyScriptManager.GetScript(model.CreateOptions());
+
+ return Content(
+ _options.MinifyGeneratedScript == true
+ ? _javascriptMinifier.Minify(script)
+ : script,
+ MimeTypes.Application.Javascript
+ );
}
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs
index 20dae137e7..5cc9a0a3c5 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs
@@ -11,8 +11,6 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting
public bool UseCache { get; set; }
- public bool Minify { get; set; }
-
public string Modules { get; set; }
public string Controllers { get; set; }
@@ -34,7 +32,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting
public ProxyScriptingModel CreateOptions()
{
- var options = new ProxyScriptingModel(Type, UseCache, Minify);
+ var options = new ProxyScriptingModel(Type, UseCache);
if (!Modules.IsNullOrEmpty())
{
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
index a468d4cfd6..2a9b1d394b 100644
--- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AspNetCore.TestBaseVolo.Abp.AspNetCore.TestBase$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -23,7 +23,7 @@
-
+
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 75d903557e..a7dfa5044c 100644
--- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs
@@ -25,7 +25,9 @@ namespace Microsoft.AspNetCore.RequestLocalization
{
var middleware = new RequestLocalizationMiddleware(
next,
- new OptionsWrapper(_requestLocalizationOptionsProvider.GetLocalizationOptions()),
+ new OptionsWrapper(
+ await _requestLocalizationOptionsProvider.GetLocalizationOptionsAsync()
+ ),
_loggerFactory
);
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 730f6e3937..c30eafb9d0 100644
--- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs
@@ -2,67 +2,76 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.DependencyInjection;
+using Nito.AsyncEx;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Localization;
using Volo.Abp.Settings;
-using Volo.Abp.Threading;
namespace Microsoft.AspNetCore.RequestLocalization
{
public class DefaultAbpRequestLocalizationOptionsProvider : IAbpRequestLocalizationOptionsProvider, ISingletonDependency
{
- private readonly IServiceProvider _serviceProvider;
- private Lazy _lazyRequestLocalizationOptions;
+ private readonly IServiceScopeFactory _serviceProviderFactory;
+ private readonly SemaphoreSlim _syncSemaphore;
+ private Action _optionsAction;
+ private RequestLocalizationOptions _requestLocalizationOptions;
- public DefaultAbpRequestLocalizationOptionsProvider(IServiceProvider serviceProvider)
+ public DefaultAbpRequestLocalizationOptionsProvider(IServiceScopeFactory serviceProviderFactory)
{
- _serviceProvider = serviceProvider;
+ _serviceProviderFactory = serviceProviderFactory;
+ _syncSemaphore = new SemaphoreSlim(1, 1);
}
public void InitLocalizationOptions(Action optionsAction = null)
{
- _lazyRequestLocalizationOptions = new Lazy(() =>
+ _optionsAction = optionsAction;
+ }
+
+ public async Task GetLocalizationOptionsAsync()
+ {
+ if (_requestLocalizationOptions == null)
{
- using (var serviceScope = _serviceProvider.CreateScope())
+ using (await _syncSemaphore.LockAsync())
{
- var languageProvider = serviceScope.ServiceProvider.GetRequiredService();
- var settingProvider = serviceScope.ServiceProvider.GetRequiredService();
+ using (var serviceScope = _serviceProviderFactory.CreateScope())
+ {
+ var languageProvider = serviceScope.ServiceProvider.GetRequiredService();
+ var settingProvider = serviceScope.ServiceProvider.GetRequiredService();
- var languages = AsyncHelper.RunSync(languageProvider.GetLanguagesAsync);
- var defaultLanguage = AsyncHelper.RunSync(() =>
- settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage));
+ var languages = await languageProvider.GetLanguagesAsync();
+ var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage);
- var options = !languages.Any()
- ? new RequestLocalizationOptions()
- : new RequestLocalizationOptions
- {
- DefaultRequestCulture = DefaultGetRequestCulture(defaultLanguage, languages),
+ var options = !languages.Any()
+ ? new RequestLocalizationOptions()
+ : new RequestLocalizationOptions
+ {
+ DefaultRequestCulture = DefaultGetRequestCulture(defaultLanguage, languages),
- SupportedCultures = languages
- .Select(l => l.CultureName)
- .Distinct()
- .Select(c => new CultureInfo(c))
- .ToArray(),
+ SupportedCultures = languages
+ .Select(l => l.CultureName)
+ .Distinct()
+ .Select(c => new CultureInfo(c))
+ .ToArray(),
- SupportedUICultures = languages
- .Select(l => l.UiCultureName)
- .Distinct()
- .Select(c => new CultureInfo(c))
- .ToArray()
- };
+ SupportedUICultures = languages
+ .Select(l => l.UiCultureName)
+ .Distinct()
+ .Select(c => new CultureInfo(c))
+ .ToArray()
+ };
- optionsAction?.Invoke(options);
- return options;
+ _optionsAction?.Invoke(options);
+ _requestLocalizationOptions = options;
+ }
}
- }, true);
- }
+ }
- public RequestLocalizationOptions GetLocalizationOptions()
- {
- return _lazyRequestLocalizationOptions.Value;
+ return _requestLocalizationOptions;
}
private static RequestCulture DefaultGetRequestCulture(string defaultLanguage, IReadOnlyList languages)
diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/IAbpRequestLocalizationOptionsProvider.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/IAbpRequestLocalizationOptionsProvider.cs
index 5179bb48ee..86cd3153f7 100644
--- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/IAbpRequestLocalizationOptionsProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/IAbpRequestLocalizationOptionsProvider.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
namespace Microsoft.AspNetCore.RequestLocalization
@@ -7,6 +8,6 @@ namespace Microsoft.AspNetCore.RequestLocalization
{
void InitLocalizationOptions(Action optionsAction = null);
- RequestLocalizationOptions GetLocalizationOptions();
+ Task GetLocalizationOptionsAsync();
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
index d6a67c14be..3ae691a1fc 100644
--- a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
+++ b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AspNetCoreVolo.Abp.AspNetCore$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
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 434ddc9d16..5a401a218e 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs
@@ -18,33 +18,6 @@ namespace Volo.Abp.Auditing
_auditingManager = auditingManager;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- if (!ShouldIntercept(invocation, out var auditLog, out var auditLogAction))
- {
- invocation.Proceed();
- return;
- }
-
- var stopwatch = Stopwatch.StartNew();
-
- try
- {
- invocation.Proceed();
- }
- catch (Exception ex)
- {
- auditLog.Exceptions.Add(ex);
- throw;
- }
- finally
- {
- stopwatch.Stop();
- auditLogAction.ExecutionDuration = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
- auditLog.Actions.Add(auditLogAction);
- }
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
if (!ShouldIntercept(invocation, out var auditLog, out var auditLogAction))
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 d314d31799..070684f48a 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs
@@ -120,16 +120,6 @@ namespace Volo.Abp.Auditing
}
}
- protected virtual void Save(DisposableSaveHandle saveHandle)
- {
- BeforeSave(saveHandle);
-
- if (ShouldSave(saveHandle.AuditLog))
- {
- _auditingStore.Save(saveHandle.AuditLog);
- }
- }
-
protected bool ShouldSave(AuditLogInfo auditLog)
{
if (!auditLog.Actions.Any() && !auditLog.EntityChanges.Any())
@@ -165,11 +155,6 @@ namespace Volo.Abp.Auditing
await _auditingManager.SaveAsync(this);
}
- public void Save()
- {
- _auditingManager.Save(this);
- }
-
public void Dispose()
{
_scope.Dispose();
diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditLogSaveHandle.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditLogSaveHandle.cs
index 596f67523a..4709b745d2 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditLogSaveHandle.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditLogSaveHandle.cs
@@ -5,8 +5,6 @@ namespace Volo.Abp.Auditing
{
public interface IAuditLogSaveHandle : IDisposable
{
- void Save();
-
Task SaveAsync();
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingStore.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingStore.cs
index 101ec8b03e..7166af642b 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingStore.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingStore.cs
@@ -4,8 +4,6 @@ namespace Volo.Abp.Auditing
{
public interface IAuditingStore
{
- void Save(AuditLogInfo auditInfo);
-
Task SaveAsync(AuditLogInfo auditInfo);
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/SimpleLogAuditingStore.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/SimpleLogAuditingStore.cs
index 8067ede5c5..eeb6c7803c 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/SimpleLogAuditingStore.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/SimpleLogAuditingStore.cs
@@ -15,14 +15,9 @@ namespace Volo.Abp.Auditing
Logger = NullLogger.Instance;
}
- public void Save(AuditLogInfo auditInfo)
- {
- Logger.LogInformation(auditInfo.ToString());
- }
-
public Task SaveAsync(AuditLogInfo auditInfo)
{
- Save(auditInfo);
+ Logger.LogInformation(auditInfo.ToString());
return Task.FromResult(0);
}
}
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 9d16a6a55c..d682d4f0c8 100644
--- a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs
+++ b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs
@@ -7,52 +7,54 @@ namespace Microsoft.AspNetCore.Authorization
{
public static class AbpAuthorizationServiceExtensions
{
- public static Task AuthorizeAsync(this IAuthorizationService authorizationService, string policyName)
+ public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, string policyName)
{
- return AuthorizeAsync(
+ return await AuthorizeAsync(
authorizationService,
- authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
+ null,
policyName
);
}
- public static Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement)
+ public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement)
{
- return authorizationService.AuthorizeAsync(
+ return await authorizationService.AuthorizeAsync(
authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
resource,
requirement
);
}
- public static Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy)
+ public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy)
{
- return authorizationService.AuthorizeAsync(
+ return await authorizationService.AuthorizeAsync(
authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
resource,
policy
);
}
- public static Task AuthorizeAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy)
+ public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy)
{
- return AuthorizeAsync(authorizationService, authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
+ return await AuthorizeAsync(
+ authorizationService,
+ null,
policy
);
}
- public static Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IEnumerable requirements)
+ public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IEnumerable requirements)
{
- return authorizationService.AuthorizeAsync(
+ return await authorizationService.AuthorizeAsync(
authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
resource,
requirements
);
}
- public static Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, string policyName)
+ public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, string policyName)
{
- return authorizationService.AuthorizeAsync(
+ return await authorizationService.AuthorizeAsync(
authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
resource,
policyName
diff --git a/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj b/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj
index 04a5494625..616436707f 100644
--- a/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj
+++ b/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj
@@ -14,7 +14,7 @@
-
+
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 74314e815d..44466884dd 100644
--- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs
+++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs
@@ -1,7 +1,6 @@
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
-using Volo.Abp.Threading;
namespace Volo.Abp.Authorization
{
@@ -14,12 +13,6 @@ namespace Volo.Abp.Authorization
_methodInvocationAuthorizationService = methodInvocationAuthorizationService;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- AsyncHelper.RunSync(() => AuthorizeAsync(invocation));
- invocation.Proceed();
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
await AuthorizeAsync(invocation);
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 a87a22fcf5..51c8530ee6 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
@@ -27,9 +27,9 @@ namespace Volo.Abp.Authorization.Permissions
PermissionValueProviderManager = permissionValueProviderManager;
}
- public virtual Task IsGrantedAsync(string name)
+ public virtual async Task IsGrantedAsync(string name)
{
- return IsGrantedAsync(PrincipalAccessor.Principal, name);
+ return await IsGrantedAsync(PrincipalAccessor.Principal, name);
}
public virtual async Task IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name)
diff --git a/framework/src/Volo.Abp.Autofac/Autofac/Builder/AbpRegistrationBuilderExtensions.cs b/framework/src/Volo.Abp.Autofac/Autofac/Builder/AbpRegistrationBuilderExtensions.cs
index 0d5c7612b2..96caf956b1 100644
--- a/framework/src/Volo.Abp.Autofac/Autofac/Builder/AbpRegistrationBuilderExtensions.cs
+++ b/framework/src/Volo.Abp.Autofac/Autofac/Builder/AbpRegistrationBuilderExtensions.cs
@@ -89,7 +89,7 @@ namespace Autofac.Builder
foreach (var interceptor in interceptors)
{
registrationBuilder.InterceptedBy(
- typeof(CastleAbpInterceptorAdapter<>).MakeGenericType(interceptor)
+ typeof(AbpAsyncDeterminationInterceptor<>).MakeGenericType(interceptor)
);
}
diff --git a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
index fdb7318e30..8caf74b672 100644
--- a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
+++ b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs
index 38a0afb2cd..2b5f6fa7a5 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs
@@ -23,7 +23,8 @@ namespace Volo.Abp.BackgroundJobs
services.OnRegistred(context =>
{
- if (ReflectionHelper.IsAssignableToGenericType(context.ImplementationType, typeof(IBackgroundJob<>)))
+ if (ReflectionHelper.IsAssignableToGenericType(context.ImplementationType, typeof(IBackgroundJob<>)) ||
+ ReflectionHelper.IsAssignableToGenericType(context.ImplementationType, typeof(IAsyncBackgroundJob<>)))
{
jobTypes.Add(context.ImplementationType);
}
diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AsyncBackgroundJob.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AsyncBackgroundJob.cs
new file mode 100644
index 0000000000..3c76bd718e
--- /dev/null
+++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AsyncBackgroundJob.cs
@@ -0,0 +1,20 @@
+using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
+
+namespace Volo.Abp.BackgroundJobs
+{
+ public abstract class AsyncBackgroundJob : IAsyncBackgroundJob
+ {
+ //TODO: Add UOW, Localization and other useful properties..?
+
+ public ILogger> Logger { get; set; }
+
+ protected AsyncBackgroundJob()
+ {
+ Logger = NullLogger>.Instance;
+ }
+
+ public abstract Task ExecuteAsync(TArgs args);
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobArgsHelper.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobArgsHelper.cs
index 284a2cbb42..58199a9659 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobArgsHelper.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobArgsHelper.cs
@@ -13,7 +13,8 @@ namespace Volo.Abp.BackgroundJobs
continue;
}
- if (@interface.GetGenericTypeDefinition() != typeof(IBackgroundJob<>))
+ if (@interface.GetGenericTypeDefinition() != typeof(IBackgroundJob<>) &&
+ @interface.GetGenericTypeDefinition() != typeof(IAsyncBackgroundJob<>))
{
continue;
}
@@ -27,7 +28,9 @@ namespace Volo.Abp.BackgroundJobs
return genericArgs[0];
}
- throw new AbpException($"Could not find type of the job args. Ensure that given type implements the {typeof(IBackgroundJob<>).AssemblyQualifiedName} interface. Given job type: {jobType.AssemblyQualifiedName}");
+ throw new AbpException($"Could not find type of the job args. " +
+ $"Ensure that given type implements the {typeof(IBackgroundJob<>).AssemblyQualifiedName} or {typeof(IAsyncBackgroundJob<>).AssemblyQualifiedName} interface. " +
+ $"Given job type: {jobType.AssemblyQualifiedName}");
}
}
}
\ No newline at end of file
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 df0ec36dd6..ec0ac8ee3f 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
@@ -2,7 +2,9 @@
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using System;
+using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
+using Volo.Abp.Threading;
namespace Volo.Abp.BackgroundJobs
{
@@ -27,15 +29,24 @@ namespace Volo.Abp.BackgroundJobs
throw new AbpException("The job type is not registered to DI: " + context.JobType);
}
- var jobExecuteMethod = context.JobType.GetMethod(nameof(IBackgroundJob
-
+
diff --git a/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj b/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj
index adcf4f8c2f..3d01363064 100644
--- a/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj
+++ b/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj
@@ -15,6 +15,7 @@
+
diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/AbpCastleCoreModule.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/AbpCastleCoreModule.cs
index 0f9a10bda1..0cb59767a4 100644
--- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/AbpCastleCoreModule.cs
+++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/AbpCastleCoreModule.cs
@@ -8,7 +8,7 @@ namespace Volo.Abp.Castle
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
- context.Services.AddTransient(typeof(CastleAbpInterceptorAdapter<>));
+ context.Services.AddTransient(typeof(AbpAsyncDeterminationInterceptor<>));
}
}
}
diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/AbpAsyncDeterminationInterceptor.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/AbpAsyncDeterminationInterceptor.cs
new file mode 100644
index 0000000000..4f852ce475
--- /dev/null
+++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/AbpAsyncDeterminationInterceptor.cs
@@ -0,0 +1,15 @@
+using Castle.DynamicProxy;
+using Volo.Abp.DynamicProxy;
+
+namespace Volo.Abp.Castle.DynamicProxy
+{
+ public class AbpAsyncDeterminationInterceptor : AsyncDeterminationInterceptor
+ where TInterceptor : IAbpInterceptor
+ {
+ public AbpAsyncDeterminationInterceptor(TInterceptor abpInterceptor)
+ : base(new CastleAsyncAbpInterceptorAdapter(abpInterceptor))
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpInterceptorAdapter.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpInterceptorAdapter.cs
deleted file mode 100644
index edb52aff86..0000000000
--- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpInterceptorAdapter.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-using System.Reflection;
-using System.Threading.Tasks;
-using Castle.DynamicProxy;
-using Volo.Abp.DynamicProxy;
-using Volo.Abp.Threading;
-
-namespace Volo.Abp.Castle.DynamicProxy
-{
- public class CastleAbpInterceptorAdapter : IInterceptor
- where TInterceptor : IAbpInterceptor
- {
- private static readonly MethodInfo MethodExecuteWithoutReturnValueAsync =
- typeof(CastleAbpInterceptorAdapter)
- .GetMethod(
- nameof(ExecuteWithoutReturnValueAsync),
- BindingFlags.NonPublic | BindingFlags.Instance
- );
-
- private static readonly MethodInfo MethodExecuteWithReturnValueAsync =
- typeof(CastleAbpInterceptorAdapter)
- .GetMethod(
- nameof(ExecuteWithReturnValueAsync),
- BindingFlags.NonPublic | BindingFlags.Instance
- );
-
- private readonly TInterceptor _abpInterceptor;
-
- public CastleAbpInterceptorAdapter(TInterceptor abpInterceptor)
- {
- _abpInterceptor = abpInterceptor;
- }
-
- public void Intercept(IInvocation invocation)
- {
- var proceedInfo = invocation.CaptureProceedInfo();
-
- var method = invocation.MethodInvocationTarget ?? invocation.Method;
-
- if (method.IsAsync())
- {
- InterceptAsyncMethod(invocation, proceedInfo);
- }
- else
- {
- InterceptSyncMethod(invocation, proceedInfo);
- }
- }
-
- private void InterceptSyncMethod(IInvocation invocation, IInvocationProceedInfo proceedInfo)
- {
- _abpInterceptor.Intercept(new CastleAbpMethodInvocationAdapter(invocation, proceedInfo));
- }
-
- private void InterceptAsyncMethod(IInvocation invocation, IInvocationProceedInfo proceedInfo)
- {
- if (invocation.Method.ReturnType == typeof(Task))
- {
- invocation.ReturnValue = MethodExecuteWithoutReturnValueAsync
- .Invoke(this, new object[] { invocation, proceedInfo });
- }
- else
- {
- invocation.ReturnValue = MethodExecuteWithReturnValueAsync
- .MakeGenericMethod(invocation.Method.ReturnType.GenericTypeArguments[0])
- .Invoke(this, new object[] {invocation, proceedInfo});
- }
- }
-
- private async Task ExecuteWithoutReturnValueAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo)
- {
- await Task.Yield();
-
- await _abpInterceptor.InterceptAsync(
- new CastleAbpMethodInvocationAdapter(invocation, proceedInfo)
- );
- }
-
- private async Task ExecuteWithReturnValueAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo)
- {
- await Task.Yield();
-
- await _abpInterceptor.InterceptAsync(
- new CastleAbpMethodInvocationAdapter(invocation, proceedInfo)
- );
-
- return await (Task)invocation.ReturnValue;
- }
- }
-}
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 0963da406b..89f3713521 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
@@ -1,77 +1,26 @@
using System;
-using System.Collections.Generic;
-using System.Reflection;
using System.Threading.Tasks;
using Castle.DynamicProxy;
using Volo.Abp.DynamicProxy;
-using Volo.Abp.Threading;
namespace Volo.Abp.Castle.DynamicProxy
{
- public class CastleAbpMethodInvocationAdapter : IAbpMethodInvocation
+ public class CastleAbpMethodInvocationAdapter : CastleAbpMethodInvocationAdapterBase, IAbpMethodInvocation
{
- public object[] Arguments => Invocation.Arguments;
-
- public IReadOnlyDictionary ArgumentsDictionary => _lazyArgumentsDictionary.Value;
- private readonly Lazy> _lazyArgumentsDictionary;
-
- public Type[] GenericArguments => Invocation.GenericArguments;
-
- public object TargetObject => Invocation.InvocationTarget ?? Invocation.MethodInvocationTarget;
-
- public MethodInfo Method => Invocation.MethodInvocationTarget ?? Invocation.Method;
-
- public object ReturnValue
- {
- get => _actualReturnValue ?? Invocation.ReturnValue;
- set => Invocation.ReturnValue = value;
- }
-
- private object _actualReturnValue;
-
- protected IInvocation Invocation { get; }
protected IInvocationProceedInfo ProceedInfo { get; }
+ protected Func Proceed { get; }
- public CastleAbpMethodInvocationAdapter(IInvocation invocation, IInvocationProceedInfo proceedInfo)
+ public CastleAbpMethodInvocationAdapter(IInvocation invocation, IInvocationProceedInfo proceedInfo,
+ Func proceed)
+ : base(invocation)
{
- Invocation = invocation;
ProceedInfo = proceedInfo;
-
- _lazyArgumentsDictionary = new Lazy>(GetArgumentsDictionary);
+ Proceed = proceed;
}
- public void Proceed()
+ public override async Task ProceedAsync()
{
- ProceedInfo.Invoke();
-
- if (Invocation.Method.IsAsync())
- {
- AsyncHelper.RunSync(() => (Task)Invocation.ReturnValue);
- }
- }
-
- public Task ProceedAsync()
- {
- ProceedInfo.Invoke();
-
- _actualReturnValue = Invocation.ReturnValue;
-
- return Invocation.Method.IsAsync()
- ? (Task)_actualReturnValue
- : Task.FromResult(_actualReturnValue);
- }
-
- private IReadOnlyDictionary GetArgumentsDictionary()
- {
- var dict = new Dictionary();
-
- var methodParameters = Method.GetParameters();
- for (int i = 0; i < methodParameters.Length; i++)
- {
- dict[methodParameters[i].Name] = Invocation.Arguments[i];
- }
-
- return dict;
+ await Proceed(Invocation, ProceedInfo);
}
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterBase.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterBase.cs
new file mode 100644
index 0000000000..09609699a8
--- /dev/null
+++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterBase.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Threading.Tasks;
+using Castle.DynamicProxy;
+using Volo.Abp.DynamicProxy;
+
+namespace Volo.Abp.Castle.DynamicProxy
+{
+ public abstract class CastleAbpMethodInvocationAdapterBase : IAbpMethodInvocation
+ {
+ public object[] Arguments => Invocation.Arguments;
+
+ public IReadOnlyDictionary ArgumentsDictionary => _lazyArgumentsDictionary.Value;
+ private readonly Lazy> _lazyArgumentsDictionary;
+
+ public Type[] GenericArguments => Invocation.GenericArguments;
+
+ public object TargetObject => Invocation.InvocationTarget ?? Invocation.MethodInvocationTarget;
+
+ public MethodInfo Method => Invocation.MethodInvocationTarget ?? Invocation.Method;
+
+ public object ReturnValue { get; set; }
+
+ protected IInvocation Invocation { get; }
+
+ protected CastleAbpMethodInvocationAdapterBase(IInvocation invocation)
+ {
+ Invocation = invocation;
+ _lazyArgumentsDictionary = new Lazy>(GetArgumentsDictionary);
+ }
+
+ public abstract Task ProceedAsync();
+
+ private IReadOnlyDictionary GetArgumentsDictionary()
+ {
+ var dict = new Dictionary();
+
+ var methodParameters = Method.GetParameters();
+ for (int i = 0; i < methodParameters.Length; i++)
+ {
+ dict[methodParameters[i].Name] = Invocation.Arguments[i];
+ }
+
+ return dict;
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterWithReturnValue.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterWithReturnValue.cs
new file mode 100644
index 0000000000..bf91102337
--- /dev/null
+++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterWithReturnValue.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Threading.Tasks;
+using Castle.DynamicProxy;
+using Volo.Abp.DynamicProxy;
+
+namespace Volo.Abp.Castle.DynamicProxy
+{
+ public class CastleAbpMethodInvocationAdapterWithReturnValue : CastleAbpMethodInvocationAdapterBase, IAbpMethodInvocation
+ {
+ protected IInvocationProceedInfo ProceedInfo { get; }
+ protected Func> Proceed { get; }
+
+ public CastleAbpMethodInvocationAdapterWithReturnValue(IInvocation invocation,
+ IInvocationProceedInfo proceedInfo,
+ Func> proceed)
+ : base(invocation)
+ {
+ ProceedInfo = proceedInfo;
+ Proceed = proceed;
+ }
+
+ public override async Task ProceedAsync()
+ {
+ ReturnValue = await Proceed(Invocation, ProceedInfo);
+ }
+ }
+}
\ 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
new file mode 100644
index 0000000000..8a0c4fdd45
--- /dev/null
+++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Threading.Tasks;
+using Castle.DynamicProxy;
+using Volo.Abp.DynamicProxy;
+
+namespace Volo.Abp.Castle.DynamicProxy
+{
+ public class CastleAsyncAbpInterceptorAdapter : AsyncInterceptorBase
+ where TInterceptor : IAbpInterceptor
+ {
+ private readonly TInterceptor _abpInterceptor;
+
+ public CastleAsyncAbpInterceptorAdapter(TInterceptor abpInterceptor)
+ {
+ _abpInterceptor = abpInterceptor;
+ }
+
+ protected override async Task InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func proceed)
+ {
+ await _abpInterceptor.InterceptAsync(
+ new CastleAbpMethodInvocationAdapter(invocation, proceedInfo, proceed)
+ );
+ }
+
+ protected override async Task InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func> proceed)
+ {
+ var adapter = new CastleAbpMethodInvocationAdapterWithReturnValue(invocation, proceedInfo, proceed);
+
+ await _abpInterceptor.InterceptAsync(
+ adapter
+ );
+
+ return (TResult)adapter.ReturnValue;
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
index eacd952e35..1ddfe2abec 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
+++ b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
@@ -15,10 +15,12 @@
-
-
-
-
+
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs
index a616d29409..34bf95fdf1 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs
@@ -19,10 +19,6 @@ namespace Volo.Abp.Cli
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
- // TODO: workaround until subsequent issues of https://github.com/dotnet/corefx/issues/30166 are resolved
- // a permanent fix will probably be published with the release of .net core 3.0: https://github.com/dotnet/corefx/issues/36553
- AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
-
Configure(options =>
{
options.Commands["help"] = typeof(HelpCommand);
@@ -33,6 +29,7 @@ namespace Volo.Abp.Cli
options.Commands["add-module"] = typeof(AddModuleCommand);
options.Commands["login"] = typeof(LoginCommand);
options.Commands["logout"] = typeof(LogoutCommand);
+ options.Commands["suite"] = typeof(SuiteCommand);
});
}
}
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 f02f03d502..436e169aad 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
@@ -69,7 +69,7 @@ namespace Volo.Abp.Cli
{
var assembly = typeof(CliService).Assembly;
var toolPath = GetToolPath(assembly);
- var currentCliVersion = await GetCurrentCliVersion(toolPath, assembly);
+ var currentCliVersion = await GetCurrentCliVersion(assembly);
var updateChannel = GetUpdateChannel(currentCliVersion);
Logger.LogInformation($"Version {currentCliVersion} ({updateChannel} channel)");
@@ -100,26 +100,25 @@ namespace Volo.Abp.Cli
return assembly.Location.Substring(0, assembly.Location.IndexOf(".store", StringComparison.Ordinal));
}
- private async Task GetCurrentCliVersion(string toolPath, Assembly assembly)
+ private static async Task GetCurrentCliVersion(Assembly assembly)
{
SemanticVersion currentCliVersion = default;
- if (!string.IsNullOrEmpty(toolPath))
+
+ var consoleOutput = new StringReader(CmdHelper.RunCmdAndGetOutput($"dotnet tool list -g"));
+ string line;
+ while ((line = await consoleOutput.ReadLineAsync()) != null)
{
- var consoleOutput = new StringReader(CmdHelper.RunCmdAndGetOutput($"dotnet tool list --tool-path {toolPath}"));
- string line;
- while ((line = await consoleOutput.ReadLineAsync()) != null)
+ if (line.StartsWith("volo.abp.cli", StringComparison.InvariantCultureIgnoreCase))
{
- if (line.StartsWith("Volo.Abp.Cli", StringComparison.InvariantCultureIgnoreCase))
- {
- var version = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries)[1];
+ var version = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries)[1];
- SemanticVersion.TryParse(version, out currentCliVersion);
+ SemanticVersion.TryParse(version, out currentCliVersion);
- break;
- }
+ break;
}
}
+
if (currentCliVersion == null)
{
// If not a tool executable, fallback to assembly version and treat as dev without updates
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 3c034d5702..3081c77cb5 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,10 +4,21 @@
{
#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/";
+
public const string AccountAbpIo = "https://account.abp.io/";
+
+ public const string NuGetRootPath = "https://nuget.abp.io/";
#endif
+
+ public static string GetNuGetServiceIndexUrl(string apiKey)
+ {
+ return NuGetRootPath + apiKey + "/v3/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 a7afbfa87d..58adc65fc4 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
@@ -75,9 +75,8 @@ namespace Volo.Abp.Cli.Commands
public string GetShortDescription()
{
- return "Adds a multi-package module to a solution by finding all packages of the module, " +
- "finding related projects in the solution and adding each package to the" +
- " corresponding project in the solution.";
+ return "Add a multi-package module to a solution by finding all packages of the module, " +
+ "finding related projects in the solution and adding each package to the corresponding project in the solution.";
}
protected virtual string GetSolutionFile(CommandLineArgs commandLineArgs)
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 211d20d5e1..03e228f255 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
@@ -68,9 +68,7 @@ namespace Volo.Abp.Cli.Commands
public string GetShortDescription()
{
- return "Adds a new ABP package to a project by adding related nuget package" +
- " as a dependency to the project and adding [DependsOn(...)] attribute to" +
- " the module class in the project.";
+ return "Add a new ABP package to a project by adding related NuGet package dependencies and [DependsOn(...)] attributes.";
}
protected virtual string GetProjectFile(CommandLineArgs commandLineArgs)
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 97dfe23944..e1536c2973 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
@@ -143,7 +143,7 @@ namespace Volo.Abp.Cli.Commands
public string GetShortDescription()
{
- return "Downloads the source code of the specified module.";
+ return "Download the source code of the specified module.";
}
public static class Options
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 dd9145e8db..2da6b82c8a 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
@@ -82,7 +82,7 @@ namespace Volo.Abp.Cli.Commands
public string GetShortDescription()
{
- return string.Empty;
+ return "Show command line help. Write ` abp help `";
}
}
}
\ No newline at end of file
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 5efbc358f0..fe9ed2d98f 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
@@ -72,7 +72,7 @@ namespace Volo.Abp.Cli.Commands
public string GetShortDescription()
{
- return string.Empty;
+ return "Sign in to " + CliUrls.AccountAbpIo + ".";
}
public static class Options
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LogoutCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LogoutCommand.cs
index d3024635fb..464d40e74d 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LogoutCommand.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LogoutCommand.cs
@@ -31,7 +31,7 @@ namespace Volo.Abp.Cli.Commands
public string GetShortDescription()
{
- return string.Empty;
+ return "Sign out from " + CliUrls.AccountAbpIo + ".";
}
}
}
\ No newline at end of file
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 44c1789907..9cfa702fd7 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
@@ -165,7 +165,7 @@ namespace Volo.Abp.Cli.Commands
sb.AppendLine(" abp new Acme.BookStore -d mongodb");
sb.AppendLine(" abp new Acme.BookStore -d mongodb -o d:\\my-project");
sb.AppendLine(" abp new Acme.BookStore -t module");
- sb.AppendLine(" abp new Acme.BookStore -t module no-ui");
+ sb.AppendLine(" abp new Acme.BookStore -t module --no-ui");
sb.AppendLine(" abp new Acme.BookStore --local-framework-ref --abp-path \"D:\\github\\abp\"");
sb.AppendLine("");
sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI");
@@ -175,7 +175,7 @@ namespace Volo.Abp.Cli.Commands
public string GetShortDescription()
{
- return "Generates a new solution based on the ABP startup templates.";
+ return "Generate a new solution based on the ABP startup templates.";
}
protected virtual DatabaseProvider GetDatabaseProvider(CommandLineArgs commandLineArgs)
@@ -246,4 +246,4 @@ namespace Volo.Abp.Cli.Commands
}
}
}
-}
\ No newline at end of file
+}
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
new file mode 100644
index 0000000000..a47a865617
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs
@@ -0,0 +1,156 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
+using Volo.Abp.Cli.Args;
+using Volo.Abp.Cli.Licensing;
+using Volo.Abp.Cli.Utils;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.Cli.Commands
+{
+ public class SuiteCommand : IConsoleCommand, ITransientDependency
+ {
+ private const string SuitePackageName = "Volo.Abp.Suite";
+ public ILogger Logger { get; set; }
+ private readonly IApiKeyService _apiKeyService;
+
+ public SuiteCommand(IApiKeyService apiKeyService)
+ {
+ _apiKeyService = apiKeyService;
+ Logger = NullLogger.Instance;
+ }
+
+ public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
+ {
+ var operationType = NamespaceHelper.NormalizeNamespace(commandLineArgs.Target);
+
+ switch (operationType)
+ {
+ case "":
+ case null:
+ RunSuite();
+ break;
+
+ case "install":
+ Logger.LogInformation("Installing ABP Suite...");
+ await InstallSuiteAsync();
+ break;
+
+ case "update":
+ Logger.LogInformation("Updating ABP Suite...");
+ await UpdateSuiteAsync();
+ break;
+
+ case "remove":
+ Logger.LogInformation("Removing ABP Suite...");
+ RemoveSuite();
+ break;
+ }
+ }
+
+ private async Task InstallSuiteAsync()
+ {
+ var nugetIndexUrl = await GetNuGetIndexUrlAsync();
+
+ if (nugetIndexUrl == null)
+ {
+ return;
+ }
+
+ var result = CmdHelper.RunCmd("dotnet tool install " + SuitePackageName + " --add-source " + nugetIndexUrl + " -g");
+
+ if (result == 0)
+ {
+ Logger.LogInformation("ABP Suite has been successfully installed.");
+ Logger.LogInformation("You can run it with the CLI command \"abp suite\"");
+ }
+ }
+
+ private async Task UpdateSuiteAsync()
+ {
+ var nugetIndexUrl = await GetNuGetIndexUrlAsync();
+
+ if (nugetIndexUrl == null)
+ {
+ return;
+ }
+
+ CmdHelper.RunCmd("dotnet tool update " + SuitePackageName + " --add-source " + nugetIndexUrl + " -g");
+ }
+
+ private static void RemoveSuite()
+ {
+ CmdHelper.RunCmd("dotnet tool uninstall " + SuitePackageName + " -g");
+ }
+
+ private void RunSuite()
+ {
+ try
+ {
+ if (!GlobalToolHelper.IsGlobalToolInstalled("abp-suite"))
+ {
+ Logger.LogWarning("ABP Suite is not installed! To install it you can run the command: \"abp suite install\"");
+ return;
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.LogWarning("Couldn't check ABP Suite installed status: " + ex.Message);
+ }
+
+ CmdHelper.RunCmd("abp-suite");
+ }
+
+ private async Task GetNuGetIndexUrlAsync()
+ {
+ var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync();
+
+ 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;
+ }
+
+ return CliUrls.GetNuGetServiceIndexUrl(apiKeyResult.ApiKey);
+ }
+
+ public string GetUsageInfo()
+ {
+ var sb = new StringBuilder();
+
+ sb.AppendLine("");
+ sb.AppendLine("Usage:");
+ sb.AppendLine("");
+ sb.AppendLine(" abp suite [options]");
+ sb.AppendLine("");
+ sb.AppendLine("Options:");
+ sb.AppendLine("");
+ sb.AppendLine(" (run ABP Suite)");
+ sb.AppendLine("install (install ABP Suite as a dotnet global tool)");
+ sb.AppendLine("update (update ABP Suite to the latest)");
+ sb.AppendLine("remove (uninstall ABP Suite)");
+ sb.AppendLine("");
+ sb.AppendLine("Examples:");
+ sb.AppendLine("");
+ sb.AppendLine(" abp suite");
+ sb.AppendLine(" abp suite install");
+ sb.AppendLine(" abp suite update");
+ sb.AppendLine(" abp suite remove");
+ sb.AppendLine("");
+
+ return sb.ToString();
+ }
+
+ public string GetShortDescription()
+ {
+ return "Install, update, remove or start ABP Suite. See https://commercial.abp.io/tools/suite.";
+ }
+ }
+}
\ No newline at end of file
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 a1775bb987..d201790c94 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
@@ -5,12 +5,9 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Options;
using Volo.Abp.Cli.Args;
-using Volo.Abp.Cli.ProjectBuilding.Analyticses;
using Volo.Abp.Cli.ProjectModification;
using Volo.Abp.DependencyInjection;
-using Volo.Abp.Json;
namespace Volo.Abp.Cli.Commands
{
@@ -20,21 +17,12 @@ namespace Volo.Abp.Cli.Commands
private readonly VoloNugetPackagesVersionUpdater _nugetPackagesVersionUpdater;
private readonly NpmPackagesUpdater _npmPackagesUpdater;
- private readonly ICliAnalyticsCollect _cliAnalyticsCollect;
- private readonly AbpCliOptions _options;
- private readonly IJsonSerializer _jsonSerializer;
public UpdateCommand(VoloNugetPackagesVersionUpdater nugetPackagesVersionUpdater,
- NpmPackagesUpdater npmPackagesUpdater,
- ICliAnalyticsCollect cliAnalyticsCollect,
- IJsonSerializer jsonSerializer,
- IOptions options)
+ NpmPackagesUpdater npmPackagesUpdater)
{
_nugetPackagesVersionUpdater = nugetPackagesVersionUpdater;
_npmPackagesUpdater = npmPackagesUpdater;
- _cliAnalyticsCollect = cliAnalyticsCollect;
- _jsonSerializer = jsonSerializer;
- _options = options.Value;
Logger = NullLogger.Instance;
}
@@ -44,24 +32,18 @@ namespace Volo.Abp.Cli.Commands
var updateNpm = commandLineArgs.Options.ContainsKey(Options.Packages.Npm);
var updateNuget = commandLineArgs.Options.ContainsKey(Options.Packages.NuGet);
- var directory = commandLineArgs.Options.GetOrNull(Options.SolutionPath.Short, Options.SolutionPath.Long);
- if (directory == null)
- {
- directory = Directory.GetCurrentDirectory();
- }
+ var directory = commandLineArgs.Options.GetOrNull(Options.SolutionPath.Short, Options.SolutionPath.Long) ??
+ Directory.GetCurrentDirectory();
- var both = (updateNuget && updateNpm) || (!updateNuget && !updateNpm);
-
- if (updateNuget || both)
+ if (updateNuget || !updateNpm)
{
await UpdateNugetPackages(commandLineArgs, directory);
}
- if (updateNpm || both)
+ if (updateNpm || !updateNuget)
{
UpdateNpmPackages(directory);
}
-
}
private void UpdateNpmPackages(string directory)
@@ -131,8 +113,7 @@ namespace Volo.Abp.Cli.Commands
public string GetShortDescription()
{
- return "Automatically updates all ABP related NuGet packages and NPM packages in a" +
- " solution or project to the latest versions";
+ return "Update all ABP related NuGet packages and NPM packages in a solution or project to the latest version.";
}
public static class Options
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs
index bc0b39a85a..81c64a3b5f 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs
@@ -8,22 +8,36 @@ namespace Volo.Abp.Cli.Http
{
public class CliHttpClient : HttpClient
{
+ public static TimeSpan DefaultTimeout { get; set; } = TimeSpan.FromMinutes(1);
+
public CliHttpClient(TimeSpan? timeout = null) : base(new CliHttpClientHandler())
{
- Timeout = timeout ?? TimeSpan.FromMinutes(1);
+ Timeout = timeout ?? DefaultTimeout;
AddAuthentication(this);
}
+ public CliHttpClient(bool setBearerToken) : base(new CliHttpClientHandler())
+ {
+ Timeout = DefaultTimeout;
+
+ if (setBearerToken)
+ {
+ AddAuthentication(this);
+ }
+ }
+
private static void AddAuthentication(HttpClient client)
{
- if (File.Exists(CliPaths.AccessToken))
+ if (!File.Exists(CliPaths.AccessToken))
+ {
+ return;
+ }
+
+ var accessToken = File.ReadAllText(CliPaths.AccessToken, Encoding.UTF8);
+ if (!accessToken.IsNullOrEmpty())
{
- var accessToken = File.ReadAllText(CliPaths.AccessToken, Encoding.UTF8);
- if (!accessToken.IsNullOrEmpty())
- {
- client.SetBearerToken(accessToken);
- }
+ client.SetBearerToken(accessToken);
}
}
}
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 c8f221b73c..1b9539d012 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,12 @@
using System;
+using System.Collections.Generic;
+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.ProjectBuilding;
using Volo.Abp.DependencyInjection;
@@ -10,22 +17,45 @@ namespace Volo.Abp.Cli.Licensing
public class AbpIoApiKeyService : IApiKeyService, ITransientDependency
{
protected IJsonSerializer JsonSerializer { get; }
-
protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; }
+ private readonly ILogger _logger;
- public AbpIoApiKeyService(IJsonSerializer jsonSerializer, IRemoteServiceExceptionHandler remoteServiceExceptionHandler)
+ public AbpIoApiKeyService(IJsonSerializer jsonSerializer, IRemoteServiceExceptionHandler remoteServiceExceptionHandler, ILogger logger)
{
JsonSerializer = jsonSerializer;
RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
+ _logger = logger;
}
public async Task GetApiKeyOrNullAsync()
{
using (var client = new CliHttpClient())
{
- var url = $"{CliUrls.WwwAbpIo}api/license/api-key";
-
- var response = await client.GetAsync(url);
+ var response = 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}. request attempt failed 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}. " +
+ $"Waiting {timeSpan.TotalSeconds} secs for the next try...");
+ }
+ })
+ .ExecuteAsync(async () => await client.GetAsync($"{CliUrls.WwwAbpIo}api/license/api-key"));
if (!response.IsSuccessStatusCode)
{
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 700303006b..1a067243d5 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
@@ -32,7 +32,7 @@ namespace Volo.Abp.Cli.NuGet
public async Task GetLatestVersionOrNullAsync(string packageId, bool includePreviews = false, bool includeNightly = false)
{
- using (var client = new CliHttpClient())
+ using (var client = new CliHttpClient(setBearerToken: false))
{
var url = includeNightly ?
$"https://www.myget.org/F/abp-nightly/api/v3/flatcontainer/{packageId.ToLowerInvariant()}/index.json" :
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 fe41577583..744641bb8a 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
@@ -32,7 +32,8 @@ namespace Volo.Abp.Cli.ProjectBuilding
return;
}
- var exceptionMessage = "Remote server returns '" + (int)responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. ";
+ var exceptionMessage = "Remote server returns '" + (int) responseMessage.StatusCode + "-" +
+ responseMessage.ReasonPhrase + "'. ";
var remoteServiceErrorMessage = await GetAbpRemoteServiceErrorAsync(responseMessage);
if (remoteServiceErrorMessage != null)
@@ -45,10 +46,18 @@ namespace Volo.Abp.Cli.ProjectBuilding
public async Task GetAbpRemoteServiceErrorAsync(HttpResponseMessage responseMessage)
{
- var errorResult = _jsonSerializer.Deserialize
- (
- await responseMessage.Content.ReadAsStringAsync()
- );
+ RemoteServiceErrorResponse errorResult;
+ try
+ {
+ errorResult = _jsonSerializer.Deserialize
+ (
+ await responseMessage.Content.ReadAsStringAsync()
+ );
+ }
+ catch (JsonReaderException)
+ {
+ return null;
+ }
if (errorResult?.Error == null)
{
@@ -82,7 +91,8 @@ namespace Volo.Abp.Cli.ProjectBuilding
for (var i = 0; i < errorResult.Error.ValidationErrors.Length; i++)
{
var validationError = errorResult.Error.ValidationErrors[i];
- sbError.AppendLine("Validation error #" + i + ": " + validationError.Message + " - Members: " + validationError.Members.JoinAsString(", ") + ".");
+ sbError.AppendLine("Validation error #" + i + ": " + validationError.Message + " - Members: " +
+ validationError.Members.JoinAsString(", ") + ".");
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs
index 4a313e784d..9c6edf479d 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs
@@ -130,6 +130,12 @@ namespace Volo.Abp.Cli.ProjectModification
return projectFolders.ToArray();
}
+ var hostFolder = Path.Combine(baseFolder, "host");
+ if (Directory.Exists(hostFolder))
+ {
+ projectFolders.Add(hostFolder);
+ }
+
var srcFolder = Path.Combine(baseFolder, "src");
if (Directory.Exists(srcFolder))
{
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
index 0c7c9fc6c0..b871c295f6 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
@@ -11,10 +11,12 @@ namespace Volo.Abp.Cli.Utils
Process.Start(procStartInfo).WaitForExit();
}
- public static void RunCmd(string command)
+ public static int RunCmd(string command)
{
var procStartInfo = new ProcessStartInfo(GetFileName(), GetArguments(command));
- Process.Start(procStartInfo).WaitForExit();
+ var process = Process.Start(procStartInfo);
+ process?.WaitForExit();
+ return process?.ExitCode ?? 0;
}
public static string RunCmdAndGetOutput(string command)
@@ -66,7 +68,7 @@ namespace Volo.Abp.Cli.Utils
}
//Windows default.
- return "cmd.exe";
+ return "cmd.exe";
}
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/GlobalToolHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/GlobalToolHelper.cs
new file mode 100644
index 0000000000..8424262324
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/GlobalToolHelper.cs
@@ -0,0 +1,34 @@
+using System;
+using System.IO;
+
+namespace Volo.Abp.Cli.Utils
+{
+ public class GlobalToolHelper
+ {
+ ///
+ /// Checks whether the tool is installed or not.
+ ///
+ /// Eg: For AbpSuite tool it's "abp-suite", for ABP CLI tool it's "abp"
+ public static bool IsGlobalToolInstalled(string toolCommandName)
+ {
+ string suitePath;
+
+ if (PlatformHelper.GetPlatform() == RuntimePlatform.LinuxOrMacOs)
+ {
+ suitePath = Environment
+ .ExpandEnvironmentVariables(
+ Path.Combine("%HOME%", ".dotnet", "tools", toolCommandName)
+ );
+ }
+ else
+ {
+ suitePath = Environment
+ .ExpandEnvironmentVariables(
+ Path.Combine(@"%USERPROFILE%", ".dotnet", "tools", toolCommandName + ".exe")
+ );
+ }
+
+ return File.Exists(suitePath);
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/PlatformHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/PlatformHelper.cs
new file mode 100644
index 0000000000..09d2481782
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/PlatformHelper.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Volo.Abp.Cli.Utils
+{
+ public class PlatformHelper
+ {
+ public static OSPlatform GetOperatingSystem()
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ //MAC
+ return OSPlatform.OSX;
+ }
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ return OSPlatform.Linux;
+ }
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ return OSPlatform.Windows;
+ }
+
+ throw new Exception("Cannot determine operating system!");
+ }
+
+ public static RuntimePlatform GetPlatform()
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ||
+ RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ return RuntimePlatform.LinuxOrMacOs;
+ }
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ return RuntimePlatform.Windows;
+ }
+
+ throw new Exception("Cannot determine runtime platform!");
+ }
+ }
+
+ public enum RuntimePlatform
+ {
+ Windows = 1,
+ LinuxOrMacOs = 2
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Cli/Properties/launchSettings.json b/framework/src/Volo.Abp.Cli/Properties/launchSettings.json
new file mode 100644
index 0000000000..e7f99eea04
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli/Properties/launchSettings.json
@@ -0,0 +1,7 @@
+{
+ "profiles": {
+ "Volo.Abp.Cli": {
+ "commandName": "Project"
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj b/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
index 5f16964cef..333311afd2 100644
--- a/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
+++ b/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
@@ -4,7 +4,7 @@
Exe
- netcoreapp3.0
+ netcoreapp3.1trueabp
diff --git a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj
index 475525c41d..42c60785ba 100644
--- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj
+++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj
@@ -11,17 +11,17 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/AbpInterceptor.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/AbpInterceptor.cs
index 8874beafcf..51ab36efc4 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/AbpInterceptor.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/AbpInterceptor.cs
@@ -3,13 +3,7 @@
namespace Volo.Abp.DynamicProxy
{
public abstract class AbpInterceptor : IAbpInterceptor
- {
- public abstract void Intercept(IAbpMethodInvocation invocation);
-
- public virtual Task InterceptAsync(IAbpMethodInvocation invocation)
- {
- Intercept(invocation);
- return Task.CompletedTask;
- }
- }
+ {
+ public abstract Task InterceptAsync(IAbpMethodInvocation invocation);
+ }
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpInterceptor.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpInterceptor.cs
index 0d953d9c73..c20cb01277 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpInterceptor.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpInterceptor.cs
@@ -4,8 +4,6 @@ namespace Volo.Abp.DynamicProxy
{
public interface IAbpInterceptor
{
- void Intercept(IAbpMethodInvocation invocation);
-
Task InterceptAsync(IAbpMethodInvocation invocation);
}
}
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpMethodInvocation.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpMethodInvocation.cs
index 37a36ac05f..17a89be467 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpMethodInvocation.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpMethodInvocation.cs
@@ -19,8 +19,6 @@ namespace Volo.Abp.DynamicProxy
object ReturnValue { get; set; }
- void Proceed();
-
Task ProceedAsync();
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj
index 0b6eaee362..6f1674f8ce 100644
--- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj
+++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj
@@ -13,8 +13,14 @@
+
+
+
+
+
+
\ No newline at end of file
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 e107072221..3166152e89 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
@@ -1,12 +1,30 @@
-using Volo.Abp.Auditing;
+using Volo.Abp.Application.Localization.Resources.AbpDdd;
+using Volo.Abp.Auditing;
+using Volo.Abp.Localization;
using Volo.Abp.Modularity;
+using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.Application
{
[DependsOn(
- typeof(AbpAuditingModule)
+ typeof(AbpAuditingModule),
+ typeof(AbpLocalizationModule)
)]
public class AbpDddApplicationContractsModule : AbpModule
{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.FileSets.AddEmbedded();
+ });
+
+ Configure(options =>
+ {
+ options.Resources
+ .Add("en")
+ .AddVirtualJson("/Volo/Abp/Application/Localization/Resources/AbpDdd");
+ });
+ }
}
}
diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ILimitedResultRequest.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ILimitedResultRequest.cs
index d0088fe155..36af42363c 100644
--- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ILimitedResultRequest.cs
+++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ILimitedResultRequest.cs
@@ -6,7 +6,8 @@ namespace Volo.Abp.Application.Dtos
public interface ILimitedResultRequest
{
///
- /// Max expected result count.
+ /// Maximum result count should be returned.
+ /// This is generally used to limit result count on paging.
///
int MaxResultCount { get; set; }
}
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 0931d090f3..e9476a56bc 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
@@ -1,5 +1,9 @@
using System;
+using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Localization;
+using Volo.Abp.Application.Localization.Resources.AbpDdd;
namespace Volo.Abp.Application.Dtos
{
@@ -7,11 +11,42 @@ namespace Volo.Abp.Application.Dtos
/// Simply implements .
///
[Serializable]
- public class LimitedResultRequestDto : ILimitedResultRequest
+ public class LimitedResultRequestDto : ILimitedResultRequest, IValidatableObject
{
+ ///
+ /// Default value: 10.
+ ///
public static int DefaultMaxResultCount { get; set; } = 10;
+ ///
+ /// Maximum possible value of the .
+ /// Default value: 1,000.
+ ///
+ public static int MaxMaxResultCount { get; set; } = 1000;
+
+ ///
+ /// Maximum result count should be returned.
+ /// This is generally used to limit result count on paging.
+ ///
[Range(1, int.MaxValue)]
public virtual int MaxResultCount { get; set; } = DefaultMaxResultCount;
+
+ public virtual IEnumerable Validate(ValidationContext validationContext)
+ {
+ if (MaxResultCount > MaxMaxResultCount)
+ {
+ var localizer = validationContext.GetRequiredService>();
+
+ yield return new ValidationResult(
+ localizer[
+ "MaxResultCountExceededExceptionMessage",
+ nameof(MaxResultCount),
+ MaxMaxResultCount,
+ typeof(LimitedResultRequestDto).FullName,
+ nameof(MaxMaxResultCount)
+ ],
+ new[] { nameof(MaxResultCount) });
+ }
+ }
}
}
\ No newline at end of file
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
new file mode 100644
index 0000000000..75880401d3
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/AbpDddResource.cs
@@ -0,0 +1,10 @@
+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.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/en.json b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/en.json
new file mode 100644
index 0000000000..2c514e6c18
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/en.json
@@ -0,0 +1,6 @@
+{
+ "culture": "en",
+ "texts": {
+ "MaxResultCountExceededExceptionMessage": "{0} can not be more than {1}! Increase {2}.{3} on the server side to allow more results."
+ }
+}
diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/tr.json b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/tr.json
new file mode 100644
index 0000000000..428f348427
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/tr.json
@@ -0,0 +1,6 @@
+{
+ "culture": "tr",
+ "texts": {
+ "MaxResultCountExceededExceptionMessage": "{0} en fazla {1} olabilir, daha büyük olamaz! Daha fazla sonuca izin vermek için {2}.{3}'ü sunucu tarafında artırın."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/zh-Hans.json b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/zh-Hans.json
new file mode 100644
index 0000000000..0bc563e702
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/zh-Hans.json
@@ -0,0 +1,6 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "MaxResultCountExceededExceptionMessage": "{0}不能超过 {1}! 在服务器端增加{2}.{3}以获得更多结果."
+ }
+}
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 237e89aa53..4134b59a4c 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
@@ -321,10 +321,12 @@ namespace Volo.Abp.Application.Services
var propertyInfo = entity.GetType().GetProperty(nameof(IMultiTenant.TenantId));
- if (propertyInfo != null && propertyInfo.GetSetMethod() != null)
+ if (propertyInfo == null || propertyInfo.GetSetMethod(true) == null)
{
- propertyInfo.SetValue(entity, tenantId, null);
+ return;
}
+
+ propertyInfo.SetValue(entity, tenantId);
}
}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs
index e72a92c14a..92ebdd4568 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs
@@ -94,7 +94,7 @@ namespace Volo.Abp.Domain.Entities
nameof(entity.Id)
);
- if (idProperty == null)
+ if (idProperty == null || idProperty.GetSetMethod(true) == null)
{
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 05fc760182..d13d52ed97 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
@@ -25,54 +25,28 @@ namespace Volo.Abp.Domain.Repositories
CancellationTokenProvider = NullCancellationTokenProvider.Instance;
}
- public abstract TEntity Insert(TEntity entity, bool autoSave = false);
+ public abstract Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- public virtual Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Insert(entity, autoSave));
- }
+ public abstract Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- public abstract TEntity Update(TEntity entity, bool autoSave = false);
+ public abstract Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- public virtual Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Update(entity));
- }
+ public abstract Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default);
- public abstract void Delete(TEntity entity, bool autoSave = false);
-
- public virtual Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(entity);
- return Task.CompletedTask;
- }
+ public abstract Task GetCountAsync(CancellationToken cancellationToken = default);
- protected virtual CancellationToken GetCancellationToken(CancellationToken prefferedValue = default)
+ protected virtual CancellationToken GetCancellationToken(CancellationToken preferredValue = default)
{
- return CancellationTokenProvider.FallbackToProvider(prefferedValue);
- }
-
- public abstract List GetList(bool includeDetails = false);
-
- public virtual Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(GetList(includeDetails));
- }
-
- public abstract long GetCount();
-
- public virtual Task GetCountAsync(CancellationToken cancellationToken = default)
- {
- return Task.FromResult(GetCount());
+ return CancellationTokenProvider.FallbackToProvider(preferredValue);
}
}
public abstract class BasicRepositoryBase : BasicRepositoryBase, IBasicRepository
where TEntity : class, IEntity
{
- public virtual TEntity Get(TKey id, bool includeDetails = true)
+ public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
- var entity = Find(id, includeDetails);
+ var entity = await FindAsync(id, includeDetails, cancellationToken);
if (entity == null)
{
@@ -82,33 +56,17 @@ namespace Volo.Abp.Domain.Repositories
return entity;
}
- public virtual Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Get(id, includeDetails));
- }
-
- public abstract TEntity Find(TKey id, bool includeDetails = true);
-
- public virtual Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Find(id, includeDetails));
- }
-
- public virtual void Delete(TKey id, bool autoSave = false)
+ public abstract Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default);
+
+ public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
- var entity = Find(id);
+ var entity = await FindAsync(id, cancellationToken: cancellationToken);
if (entity == null)
{
return;
}
- Delete(entity);
- }
-
- public virtual Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(id);
- return Task.CompletedTask;
+ await DeleteAsync(entity, autoSave, cancellationToken);
}
}
}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IBasicRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IBasicRepository.cs
index f3644bbe4a..6b62691ed8 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IBasicRepository.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IBasicRepository.cs
@@ -8,17 +8,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IBasicRepository : IReadOnlyBasicRepository
where TEntity : class, IEntity
{
- ///
- /// Inserts a new entity.
- ///
- /// Inserted entity
- ///
- /// Set true to automatically save entity to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- [NotNull]
- TEntity Insert([NotNull] TEntity entity, bool autoSave = false);
-
///
/// Inserts a new entity.
///
@@ -31,17 +20,6 @@ namespace Volo.Abp.Domain.Repositories
[NotNull]
Task InsertAsync([NotNull] TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- ///
- /// Updates an existing entity.
- ///
- /// Entity
- ///
- /// Set true to automatically save changes to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- [NotNull]
- TEntity Update([NotNull] TEntity entity, bool autoSave = false);
-
///
/// Updates an existing entity.
///
@@ -54,16 +32,6 @@ namespace Volo.Abp.Domain.Repositories
[NotNull]
Task UpdateAsync([NotNull] TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- ///
- /// Deletes an entity.
- ///
- /// Entity to be deleted
- ///
- /// Set true to automatically save changes to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- void Delete([NotNull] TEntity entity, bool autoSave = false);
-
///
/// Deletes an entity.
///
@@ -79,16 +47,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IBasicRepository : IBasicRepository, IReadOnlyBasicRepository
where TEntity : class, IEntity
{
- ///
- /// Deletes an entity by primary key.
- ///
- /// Primary key of the entity
- ///
- /// Set true to automatically save changes to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- void Delete(TKey id, bool autoSave = false); //TODO: Return true if deleted
-
///
/// Deletes an entity by primary key.
///
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs
index c67b35794b..828e305ff8 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs
@@ -9,13 +9,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IReadOnlyBasicRepository : IRepository
where TEntity : class, IEntity
{
- ///
- /// Gets a list of all the entities.
- ///
- /// Set true to include all children of this entity
- /// Entity
- List GetList(bool includeDetails = false);
-
///
/// Gets a list of all the entities.
///
@@ -24,11 +17,6 @@ namespace Volo.Abp.Domain.Repositories
/// Entity
Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default);
- ///
- /// Gets total count of all entities.
- ///
- long GetCount();
-
///
/// Gets total count of all entities.
///
@@ -38,16 +26,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IReadOnlyBasicRepository : IReadOnlyBasicRepository
where TEntity : class, IEntity
{
- ///
- /// Gets an entity with given primary key.
- /// Throws if can not find an entity with given id.
- ///
- /// Primary key of the entity to get
- /// Set true to include all children of this entity
- /// Entity
- [NotNull]
- TEntity Get(TKey id, bool includeDetails = true);
-
///
/// Gets an entity with given primary key.
/// Throws if can not find an entity with given id.
@@ -59,15 +37,6 @@ namespace Volo.Abp.Domain.Repositories
[NotNull]
Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default);
- ///
- /// Gets an entity with given primary key or null if not found.
- ///
- /// Primary key of the entity to get
- /// Set true to include all children of this entity
- /// Entity or null
- [CanBeNull]
- TEntity Find(TKey id, bool includeDetails = true);
-
///
/// Gets an entity with given primary key or null if not found.
///
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
index a77dc4acb7..2ac16ec229 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
@@ -18,19 +18,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IRepository : IReadOnlyRepository, IBasicRepository
where TEntity : class, IEntity
{
- ///
- /// Deletes many entities by function.
- /// Notice that: All entities fits to given predicate are retrieved and deleted.
- /// This may cause major performance problems if there are too many entities with
- /// given predicate.
- ///
- /// A condition to filter entities
- ///
- /// Set true to automatically save changes to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- void Delete([NotNull] Expression> predicate, bool autoSave = false);
-
///
/// Deletes many entities by function.
/// Notice that: All entities fits to given predicate are retrieved and deleted.
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 139f4ff999..29814f4de6 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
@@ -46,19 +46,7 @@ namespace Volo.Abp.Domain.Repositories
protected abstract IQueryable GetQueryable();
- public virtual void Delete(Expression> predicate, bool autoSave = false)
- {
- foreach (var entity in GetQueryable().Where(predicate).ToList())
- {
- Delete(entity, autoSave);
- }
- }
-
- public virtual Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(predicate, autoSave);
- return Task.CompletedTask;
- }
+ public abstract Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default);
protected virtual TQueryable ApplyDataFilters(TQueryable query)
where TQueryable : IQueryable
@@ -81,50 +69,19 @@ namespace Volo.Abp.Domain.Repositories
public abstract class RepositoryBase : RepositoryBase, IRepository
where TEntity : class, IEntity
{
- public virtual TEntity Find(TKey id, bool includeDetails = true)
- {
- return includeDetails
- ? WithDetails().FirstOrDefault(EntityHelper.CreateEqualityExpressionForId(id))
- : GetQueryable().FirstOrDefault(EntityHelper.CreateEqualityExpressionForId(id));
- }
+ public abstract Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default);
- public virtual TEntity Get(TKey id, bool includeDetails = true)
- {
- var entity = Find(id, includeDetails);
+ public abstract Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default);
- if (entity == null)
- {
- throw new EntityNotFoundException(typeof(TEntity), id);
- }
-
- return entity;
- }
-
- public virtual Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Get(id, includeDetails));
- }
-
- public virtual Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
+ public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
- return Task.FromResult(Find(id, includeDetails));
- }
-
- public virtual void Delete(TKey id, bool autoSave = false)
- {
- var entity = Find(id, includeDetails: false);
+ var entity = await FindAsync(id, cancellationToken: cancellationToken);
if (entity == null)
{
return;
}
- Delete(entity, autoSave);
- }
-
- public virtual Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(id, autoSave);
- return Task.CompletedTask;
+ await DeleteAsync(entity, autoSave, cancellationToken);
}
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
index 5ed32e6961..40fe0b3610 100644
--- a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
+++ b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
@@ -19,7 +19,12 @@
-
+
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
index 55ec63b9ac..c2e29a7ff7 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.BackgroundJobs;
+using Volo.Abp.Emailing.Localization;
using Volo.Abp.Emailing.Templates;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
@@ -30,6 +31,13 @@ namespace Volo.Abp.Emailing
options.FileSets.AddEmbedded();
});
+ Configure(options =>
+ {
+ options.Resources
+ .Add("en")
+ .AddVirtualJson("/Volo/Abp/Emailing/Localization");
+ });
+
Configure(options =>
{
options.AddJob();
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
index 32d1fb8c1c..0fb3402740 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
@@ -1,3 +1,5 @@
+using Volo.Abp.Emailing.Localization;
+using Volo.Abp.Localization;
using Volo.Abp.Settings;
namespace Volo.Abp.Emailing
@@ -11,16 +13,62 @@ namespace Volo.Abp.Emailing
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(EmailSettingNames.Smtp.Host, "127.0.0.1"),
- new SettingDefinition(EmailSettingNames.Smtp.Port, "25"),
- new SettingDefinition(EmailSettingNames.Smtp.UserName),
- new SettingDefinition(EmailSettingNames.Smtp.Password, isEncrypted: true),
- new SettingDefinition(EmailSettingNames.Smtp.Domain),
- new SettingDefinition(EmailSettingNames.Smtp.EnableSsl, "false"),
- new SettingDefinition(EmailSettingNames.Smtp.UseDefaultCredentials, "true"),
- new SettingDefinition(EmailSettingNames.DefaultFromAddress, "noreply@abp.io"),
- new SettingDefinition(EmailSettingNames.DefaultFromDisplayName, "ABP application")
+ new SettingDefinition(
+ EmailSettingNames.Smtp.Host,
+ "127.0.0.1",
+ L("DisplayName:Abp.Mailing.Smtp.Host"),
+ L("Description:Abp.Mailing.Smtp.Host")),
+
+ new SettingDefinition(EmailSettingNames.Smtp.Port,
+ "25",
+ L("DisplayName:Abp.Mailing.Smtp.Port"),
+ L("Description:Abp.Mailing.Smtp.Port")),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.UserName,
+ displayName: L("DisplayName:Abp.Mailing.Smtp.UserName"),
+ description: L("Description:Abp.Mailing.Smtp.UserName")),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.Password,
+ displayName:
+ L("DisplayName:Abp.Mailing.Smtp.Password"),
+ description: L("Description:Abp.Mailing.Smtp.Password"),
+ isEncrypted: true),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.Domain,
+ displayName: L("DisplayName:Abp.Mailing.Smtp.Domain"),
+ description: L("Description:Abp.Mailing.Smtp.Domain")),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.EnableSsl,
+ "false",
+ L("DisplayName:Abp.Mailing.Smtp.EnableSsl"),
+ L("Description:Abp.Mailing.Smtp.EnableSsl")),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.UseDefaultCredentials,
+ "true",
+ L("DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials"),
+ L("Description:Abp.Mailing.Smtp.UseDefaultCredentials")),
+
+ new SettingDefinition(
+ EmailSettingNames.DefaultFromAddress,
+ "noreply@abp.io",
+ L("DisplayName:Abp.Mailing.DefaultFromAddress"),
+ L("Description:Abp.Mailing.DefaultFromAddress")),
+
+ new SettingDefinition(EmailSettingNames.DefaultFromDisplayName,
+ "ABP application",
+ L("DisplayName:Abp.Mailing.DefaultFromDisplayName"),
+ L("Description:Abp.Mailing.DefaultFromDisplayName"))
);
}
+
+ private static LocalizableString L(string name)
+ {
+ return LocalizableString.Create(name);
+ }
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs
new file mode 100644
index 0000000000..3560c0db26
--- /dev/null
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs
@@ -0,0 +1,10 @@
+using Volo.Abp.Localization;
+
+namespace Volo.Abp.Emailing.Localization
+{
+ [LocalizationResourceName("AbpEmailing")]
+ public class EmailingResource
+ {
+
+ }
+}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json
new file mode 100644
index 0000000000..6fa4e626ff
--- /dev/null
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json
@@ -0,0 +1,23 @@
+{
+ "culture": "en",
+ "texts": {
+ "DisplayName:Abp.Mailing.DefaultFromAddress": "Default from address",
+ "DisplayName:Abp.Mailing.DefaultFromDisplayName": "Default from display name",
+ "DisplayName:Abp.Mailing.Smtp.Host": "Host",
+ "DisplayName:Abp.Mailing.Smtp.Port": "Port",
+ "DisplayName:Abp.Mailing.Smtp.UserName": "User name",
+ "DisplayName:Abp.Mailing.Smtp.Password": "Password",
+ "DisplayName:Abp.Mailing.Smtp.Domain": "Domain",
+ "DisplayName:Abp.Mailing.Smtp.EnableSsl": "Enable SSL",
+ "DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "Use default credentials",
+ "Description:Abp.Mailing.DefaultFromAddress": "The default from address",
+ "Description:Abp.Mailing.DefaultFromDisplayName": "The default from display name",
+ "Description:Abp.Mailing.Smtp.Host": "The name or IP address of the host used for SMTP transactions.",
+ "Description:Abp.Mailing.Smtp.Port": "The port used for SMTP transactions.",
+ "Description:Abp.Mailing.Smtp.UserName": "User name associated with the credentials.",
+ "Description:Abp.Mailing.Smtp.Password": "The password for the user name associated with the credentials.",
+ "Description:Abp.Mailing.Smtp.Domain": "The domain or computer name that verifies the credentials.",
+ "Description:Abp.Mailing.Smtp.EnableSsl": "Whether the SmtpClient uses Secure Sockets Layer (SSL) to encrypt the connection.",
+ "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Whether the DefaultCredentials are sent with requests."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json
new file mode 100644
index 0000000000..0e2d25bff1
--- /dev/null
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json
@@ -0,0 +1,23 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "DisplayName:Abp.Mailing.DefaultFromAddress": "默认发件人地址",
+ "DisplayName:Abp.Mailing.DefaultFromDisplayName": "默认发件人名字",
+ "DisplayName:Abp.Mailing.Smtp.Host": "主机",
+ "DisplayName:Abp.Mailing.Smtp.Port": "端口",
+ "DisplayName:Abp.Mailing.Smtp.UserName": "用户名",
+ "DisplayName:Abp.Mailing.Smtp.Password": "密码",
+ "DisplayName:Abp.Mailing.Smtp.Domain": "域",
+ "DisplayName:Abp.Mailing.Smtp.EnableSsl": "启用SSL",
+ "DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "使用默认凭据",
+ "Description:Abp.Mailing.DefaultFromAddress": "默认的发件人地址.",
+ "Description:Abp.Mailing.DefaultFromDisplayName": "默认的发件人名字.",
+ "Description:Abp.Mailing.Smtp.Host": "SMTP 事务的主机名或主机 IP 地址.",
+ "Description:Abp.Mailing.Smtp.Port": "SMTP 事务的端口.",
+ "Description:Abp.Mailing.Smtp.UserName": "凭据关联的用户名.",
+ "Description:Abp.Mailing.Smtp.Password": "凭据关联的用户名的密码.",
+ "Description:Abp.Mailing.Smtp.Domain": "验证凭据的域名或计算机名.",
+ "Description:Abp.Mailing.Smtp.EnableSsl": "指定 SmtpClient 是否使用安全套接字层 (SSL) 加密连接.",
+ "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "控制默认凭据是否随请求一起发送."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/DefaultEmailTemplateProvider.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/DefaultEmailTemplateProvider.cs
index fdc7fa5375..c15012f0bf 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/DefaultEmailTemplateProvider.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/DefaultEmailTemplateProvider.cs
@@ -6,10 +6,10 @@ namespace Volo.Abp.Emailing.Templates
{
public override void Define(IEmailTemplateDefinitionContext context)
{
- context.Add(new EmailTemplateDefinition(StandardEmailTemplates.DefaultLayout, isLayout: true, layout: null)
+ context.Add(new EmailTemplateDefinition(StandardEmailTemplates.DefaultLayout, defaultCultureName: "en", isLayout: true, layout: null)
.AddTemplateVirtualFiles("/Volo/Abp/Emailing/Templates/DefaultEmailTemplates/Layout"));
- context.Add(new EmailTemplateDefinition(StandardEmailTemplates.SimpleMessage)
+ context.Add(new EmailTemplateDefinition(StandardEmailTemplates.SimpleMessage, defaultCultureName: "en")
.AddTemplateVirtualFiles("/Volo/Abp/Emailing/Templates/DefaultEmailTemplates/Message"));
}
}
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj
index 170256ec32..b63a2ae7cb 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj
index 9f2717823c..0154d1b773 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj
index ab658d9e75..d0d338be9d 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj
index 37f80a5b44..d3c5313898 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj b/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj
index 03602ee77b..3e83001eb2 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj
@@ -19,8 +19,8 @@
-
-
+
+
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 bfedcf2d66..4131a774b5 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
@@ -40,18 +40,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
);
}
- public override TEntity Insert(TEntity entity, bool autoSave = false)
- {
- var savedEntity = DbSet.Add(entity).Entity;
-
- if (autoSave)
- {
- DbContext.SaveChanges();
- }
-
- return savedEntity;
- }
-
public override async Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
var savedEntity = DbSet.Add(entity).Entity;
@@ -64,20 +52,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
return savedEntity;
}
- public override TEntity Update(TEntity entity, bool autoSave = false)
- {
- DbContext.Attach(entity);
-
- var updatedEntity = DbContext.Update(entity).Entity;
-
- if (autoSave)
- {
- DbContext.SaveChanges();
- }
-
- return updatedEntity;
- }
-
public override async Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
DbContext.Attach(entity);
@@ -91,17 +65,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
return updatedEntity;
}
-
- public override void Delete(TEntity entity, bool autoSave = false)
- {
- DbSet.Remove(entity);
-
- if (autoSave)
- {
- DbContext.SaveChanges();
- }
- }
-
+
public override async Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
DbSet.Remove(entity);
@@ -112,13 +76,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
}
}
- public override List GetList(bool includeDetails = false)
- {
- return includeDetails
- ? WithDetails().ToList()
- : DbSet.ToList();
- }
-
public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
return includeDetails
@@ -126,11 +83,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
: await DbSet.ToListAsync(GetCancellationToken(cancellationToken));
}
- public override long GetCount()
- {
- return DbSet.LongCount();
- }
-
public override async Task GetCountAsync(CancellationToken cancellationToken = default)
{
return await DbSet.LongCountAsync(GetCancellationToken(cancellationToken));
@@ -141,16 +93,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
return DbSet.AsQueryable();
}
- public override void Delete(Expression> predicate, bool autoSave = false)
- {
- base.Delete(predicate, autoSave);
-
- if (autoSave)
- {
- DbContext.SaveChanges();
- }
- }
-
public override async Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
var entities = await GetQueryable()
@@ -269,20 +211,9 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
: await DbSet.FindAsync(new object[] { id }, GetCancellationToken(cancellationToken));
}
- public virtual void Delete(TKey id, bool autoSave = false)
- {
- var entity = Find(id, includeDetails: false);
- if (entity == null)
- {
- return;
- }
-
- Delete(entity, autoSave);
- }
-
public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
- var entity = await FindAsync(id, includeDetails: false, cancellationToken: cancellationToken);
+ var entity = await FindAsync(id, cancellationToken: cancellationToken);
if (entity == null)
{
return;
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 18758d98e3..87de3f1247 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
@@ -22,7 +22,6 @@ using Volo.Abp.EntityFrameworkCore.ValueConverters;
using Volo.Abp.Guids;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Reflection;
-using Volo.Abp.Threading;
using Volo.Abp.Timing;
namespace Volo.Abp.EntityFrameworkCore
@@ -68,6 +67,13 @@ namespace Volo.Abp.EntityFrameworkCore
BindingFlags.Instance | BindingFlags.NonPublic
);
+ private static readonly MethodInfo ConfigureValueGeneratedMethodInfo
+ = typeof(AbpDbContext)
+ .GetMethod(
+ nameof(ConfigureValueGenerated),
+ BindingFlags.Instance | BindingFlags.NonPublic
+ );
+
protected AbpDbContext(DbContextOptions options)
: base(options)
{
@@ -90,48 +96,13 @@ namespace Volo.Abp.EntityFrameworkCore
ConfigureValueConverterMethodInfo
.MakeGenericMethod(entityType.ClrType)
.Invoke(this, new object[] { modelBuilder, entityType });
- }
- }
- public override int SaveChanges(bool acceptAllChangesOnSuccess)
- {
- //TODO: Reduce duplications with SaveChangesAsync
- //TODO: Instead of adding entity changes to audit log, write them to uow and add to audit log only if uow succeed
-
- try
- {
- var auditLog = AuditingManager?.Current?.Log;
-
- List entityChangeList = null;
- if (auditLog != null)
- {
- entityChangeList = EntityHistoryHelper.CreateChangeList(ChangeTracker.Entries().ToList());
- }
-
- var changeReport = ApplyAbpConcepts();
-
- var result = base.SaveChanges(acceptAllChangesOnSuccess);
-
- AsyncHelper.RunSync(() => EntityChangeEventHelper.TriggerEventsAsync(changeReport));
-
- if (auditLog != null)
- {
- EntityHistoryHelper.UpdateChangeList(entityChangeList);
- auditLog.EntityChanges.AddRange(entityChangeList);
- }
-
- return result;
- }
- catch (DbUpdateConcurrencyException ex)
- {
- throw new AbpDbConcurrencyException(ex.Message, ex);
- }
- finally
- {
- ChangeTracker.AutoDetectChangesEnabled = true;
+ ConfigureValueGeneratedMethodInfo
+ .MakeGenericMethod(entityType.ClrType)
+ .Invoke(this, new object[] { modelBuilder, entityType });
}
}
-
+
public override async Task SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default)
{
try
@@ -541,6 +512,23 @@ namespace Volo.Abp.EntityFrameworkCore
}
}
+ protected virtual void ConfigureValueGenerated(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType)
+ where TEntity : class
+ {
+ if (!typeof(IEntity).IsAssignableFrom(typeof(TEntity)))
+ {
+ return;
+ }
+
+ var idPropertyBuilder = modelBuilder.Entity().Property(x => ((IEntity) x).Id);
+ if (idPropertyBuilder.Metadata.PropertyInfo.IsDefined(typeof(DatabaseGeneratedAttribute), true))
+ {
+ return;
+ }
+
+ idPropertyBuilder.ValueGeneratedNever();
+ }
+
protected virtual bool ShouldFilterEntity(IMutableEntityType entityType) where TEntity : class
{
if (typeof(IMultiTenant).IsAssignableFrom(typeof(TEntity)))
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/AbpDbContextConfigurationContext.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/AbpDbContextConfigurationContext.cs
index 1a21e129f3..b9cf4e3ceb 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/AbpDbContextConfigurationContext.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/AbpDbContextConfigurationContext.cs
@@ -2,6 +2,8 @@
using System.Data.Common;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.EntityFrameworkCore.DependencyInjection
@@ -29,7 +31,8 @@ namespace Volo.Abp.EntityFrameworkCore.DependencyInjection
ConnectionStringName = connectionStringName;
ExistingConnection = existingConnection;
- DbContextOptions = new DbContextOptionsBuilder();
+ DbContextOptions = new DbContextOptionsBuilder()
+ .UseLoggerFactory(serviceProvider.GetRequiredService());
}
}
@@ -49,7 +52,8 @@ namespace Volo.Abp.EntityFrameworkCore.DependencyInjection
connectionStringName,
existingConnection)
{
- base.DbContextOptions = new DbContextOptionsBuilder();
+ base.DbContextOptions = new DbContextOptionsBuilder()
+ .UseLoggerFactory(serviceProvider.GetRequiredService());
}
}
}
\ No newline at end of file
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 ee6150d403..49ea1b3f4c 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("N"));
+ return await FeatureStore.GetOrNullAsync(feature.Name, Name, editionId.Value.ToString());
}
}
}
\ No newline at end of file
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 5fb7c54293..9986af6275 100644
--- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs
+++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs
@@ -2,7 +2,6 @@
using Volo.Abp.Aspects;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
-using Volo.Abp.Threading;
namespace Volo.Abp.Features
{
@@ -16,18 +15,6 @@ namespace Volo.Abp.Features
_methodInvocationFeatureCheckerService = methodInvocationFeatureCheckerService;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.FeatureChecking))
- {
- invocation.Proceed();
- return;
- }
-
- AsyncHelper.RunSync(() => CheckFeaturesAsync(invocation));
- invocation.Proceed();
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.FeatureChecking))
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 d403acb993..5ae4b5f876 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("N"));
+ return await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString());
}
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj b/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj
index ffd81d0789..5510af3e25 100644
--- a/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj
+++ b/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/FluentObjectValidationContributor.cs b/framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/FluentObjectValidationContributor.cs
index f926782e2d..e699e0093a 100644
--- a/framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/FluentObjectValidationContributor.cs
+++ b/framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/FluentObjectValidationContributor.cs
@@ -32,7 +32,7 @@ namespace Volo.Abp.FluentValidation
context.Errors.AddRange(
result.Errors.Select(
error =>
- new ValidationResult(error.ErrorMessage)
+ new ValidationResult(error.ErrorMessage, new[] { error.PropertyName })
)
);
}
diff --git a/framework/src/Volo.Abp.HangFire/Volo.Abp.HangFire.csproj b/framework/src/Volo.Abp.HangFire/Volo.Abp.HangFire.csproj
index 867565f395..c87b39d494 100644
--- a/framework/src/Volo.Abp.HangFire/Volo.Abp.HangFire.csproj
+++ b/framework/src/Volo.Abp.HangFire/Volo.Abp.HangFire.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj
index de2e24e072..84413c7764 100644
--- a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj
+++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Http.Client.IdentityModelVolo.Abp.Http.Client.IdentityModel$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionDynamicHttpClientProxyExtensions.cs b/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionDynamicHttpClientProxyExtensions.cs
index 54387d2871..f34a732cb0 100644
--- a/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionDynamicHttpClientProxyExtensions.cs
+++ b/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionDynamicHttpClientProxyExtensions.cs
@@ -53,7 +53,7 @@ namespace Microsoft.Extensions.DependencyInjection
foreach (var serviceType in serviceTypes)
{
services.AddHttpClientProxy(
- serviceType,
+ serviceType,
remoteServiceConfigurationName,
asDefaultServices
);
@@ -153,7 +153,7 @@ namespace Microsoft.Extensions.DependencyInjection
var interceptorType = typeof(DynamicHttpProxyInterceptor<>).MakeGenericType(type);
services.AddTransient(interceptorType);
- var interceptorAdapterType = typeof(CastleAbpInterceptorAdapter<>).MakeGenericType(interceptorType);
+ var interceptorAdapterType = typeof(AbpAsyncDeterminationInterceptor<>).MakeGenericType(interceptorType);
if (asDefaultService)
{
@@ -174,7 +174,7 @@ namespace Microsoft.Extensions.DependencyInjection
var service = ProxyGeneratorInstance
.CreateInterfaceProxyWithoutTarget(
type,
- (IInterceptor) serviceProvider.GetRequiredService(interceptorAdapterType)
+ (IInterceptor)serviceProvider.GetRequiredService(interceptorAdapterType)
);
return Activator.CreateInstance(
diff --git a/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj b/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj
index 3555a61a8a..8a5172db8b 100644
--- a/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj
+++ b/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Http.ClientVolo.Abp.Http.Client$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -16,7 +16,7 @@
-
+
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 d2b57d32ef..3e0124237f 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
@@ -74,43 +74,33 @@ namespace Volo.Abp.Http.Client.DynamicProxying
Logger = NullLogger>.Instance;
}
- public override void Intercept(IAbpMethodInvocation invocation)
+ public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
- if (invocation.Method.ReturnType == typeof(void))
+ if (invocation.Method.ReturnType.GenericTypeArguments.IsNullOrEmpty())
{
- AsyncHelper.RunSync(() => MakeRequestAsync(invocation));
+ await MakeRequestAsync(invocation);
}
else
{
- var responseAsString = AsyncHelper.RunSync(() => MakeRequestAsync(invocation));
+ var result = (Task)GenericInterceptAsyncMethod
+ .MakeGenericMethod(invocation.Method.ReturnType.GenericTypeArguments[0])
+ .Invoke(this, new object[] { invocation });
- //TODO: Think on that
- if (TypeHelper.IsPrimitiveExtended(invocation.Method.ReturnType, true))
- {
- invocation.ReturnValue = Convert.ChangeType(responseAsString, invocation.Method.ReturnType);
- }
- else
- {
- invocation.ReturnValue = JsonSerializer.Deserialize(
- invocation.Method.ReturnType,
- responseAsString
- );
- }
+ invocation.ReturnValue = await GetResultAsync(
+ result,
+ invocation.Method.ReturnType.GetGenericArguments()[0]
+ );
}
+
}
- public override Task InterceptAsync(IAbpMethodInvocation invocation)
+ private async Task GetResultAsync(Task task, Type resultType)
{
- if (invocation.Method.ReturnType.GenericTypeArguments.IsNullOrEmpty())
- {
- return MakeRequestAsync(invocation);
- }
-
- invocation.ReturnValue = GenericInterceptAsyncMethod
- .MakeGenericMethod(invocation.Method.ReturnType.GenericTypeArguments[0])
- .Invoke(this, new object[] { invocation });
-
- return Task.CompletedTask;
+ await task;
+ return typeof(Task<>)
+ .MakeGenericType(resultType)
+ .GetProperty(nameof(Task.Result), BindingFlags.Instance | BindingFlags.Public)
+ .GetValue(task);
}
private async Task MakeRequestAndGetResultAsync(IAbpMethodInvocation invocation)
@@ -163,7 +153,6 @@ namespace Volo.Abp.Http.Client.DynamicProxying
return await response.Content.ReadAsStringAsync();
}
-
private ApiVersionInfo GetApiVersionInfo(ActionApiDescriptionModel action)
{
var apiVersion = FindBestApiVersion(action);
diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptManager.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptManager.cs
index 858b78a57f..a3df2c70a2 100644
--- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptManager.cs
+++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptManager.cs
@@ -18,21 +18,18 @@ namespace Volo.Abp.Http.ProxyScripting
private readonly IJsonSerializer _jsonSerializer;
private readonly IProxyScriptManagerCache _cache;
private readonly AbpApiProxyScriptingOptions _options;
- private readonly IJavascriptMinifier _javascriptMinifier;
public ProxyScriptManager(
IApiDescriptionModelProvider modelProvider,
IServiceProvider serviceProvider,
IJsonSerializer jsonSerializer,
IProxyScriptManagerCache cache,
- IOptions options,
- IJavascriptMinifier javascriptMinifier)
+ IOptions options)
{
_modelProvider = modelProvider;
_serviceProvider = serviceProvider;
_jsonSerializer = jsonSerializer;
_cache = cache;
- _javascriptMinifier = javascriptMinifier;
_options = options.Value;
}
@@ -67,8 +64,7 @@ namespace Volo.Abp.Http.ProxyScripting
using (var scope = _serviceProvider.CreateScope())
{
- var script = scope.ServiceProvider.GetRequiredService(generatorType).As().CreateScript(apiModel);
- return scriptingModel.Minify ? _javascriptMinifier.Minify(script) : script;
+ return scope.ServiceProvider.GetRequiredService(generatorType).As().CreateScript(apiModel);
}
}
diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs
index 6815c01ce5..5ab85a781b 100644
--- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs
+++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs
@@ -8,8 +8,6 @@ namespace Volo.Abp.Http.ProxyScripting
public bool UseCache { get; set; }
- public bool Minify { get; set; }
-
public string[] Modules { get; set; }
public string[] Controllers { get; set; }
@@ -18,11 +16,10 @@ namespace Volo.Abp.Http.ProxyScripting
public IDictionary Properties { get; set; }
- public ProxyScriptingModel(string generatorType, bool useCache = true, bool minify = false)
+ public ProxyScriptingModel(string generatorType, bool useCache = true)
{
GeneratorType = generatorType;
UseCache = useCache;
- Minify = minify;
Properties = new Dictionary();
}
diff --git a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj
index 0d8ef11967..886e092fdd 100644
--- a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj
+++ b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj b/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj
index 8964f2f4fe..d5407991c1 100644
--- a/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj
+++ b/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj
@@ -1,4 +1,4 @@
-
+
@@ -14,7 +14,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj
index 65ceed101e..aad9dcf58d 100644
--- a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj
+++ b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj
@@ -14,11 +14,12 @@
+
-
+
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 b1741d0ca0..d6b7073ee5 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpDictionaryBasedStringLocalizer.cs
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpDictionaryBasedStringLocalizer.cs
@@ -31,8 +31,7 @@ namespace Volo.Abp.Localization
includeParentCultures
);
}
-
-
+
public IEnumerable GetAllStrings(bool includeParentCultures, bool includeBaseLocalizers)
{
return GetAllStrings(
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 60df66feec..175e3f9d12 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.Localization.Resources.AbpValidation;
+using Volo.Abp.Localization.Resources.AbpLocalization;
+using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Abp.Settings;
using Volo.Abp.VirtualFileSystem;
@@ -27,10 +28,16 @@ namespace Volo.Abp.Localization
.Resources
.Add("en");
+ //TODO: Obsolete, Remove in the future version
options
.Resources
.Add("en")
- .AddVirtualJson("/Localization/Resources/AbpValidation");
+ .AddVirtualJson("/Volo/Abp/Validation/Localization");//load from Volo.Abp.Validation
+
+ options
+ .Resources
+ .Add("en")
+ .AddVirtualJson("/Localization/Resources/AbpLocalization");
});
}
}
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 c748156506..14afe69dac 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,5 @@
-using Volo.Abp.Settings;
+using Volo.Abp.Localization.Resources.AbpValidation;
+using Volo.Abp.Settings;
namespace Volo.Abp.Localization
{
@@ -7,8 +8,17 @@ namespace Volo.Abp.Localization
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(LocalizationSettingNames.DefaultLanguage, "en", isVisibleToClients: true)
+ new SettingDefinition(LocalizationSettingNames.DefaultLanguage,
+ "en",
+ L("DisplayName:Abp.Localization.DefaultLanguage"),
+ L("Description:Abp.Localization.DefaultLanguage"),
+ isVisibleToClients: true)
);
}
+
+ private static LocalizableString L(string 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
new file mode 100644
index 0000000000..abfd1688b7
--- /dev/null
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Volo.Abp.Localization.Resources.AbpLocalization
+{
+ [LocalizationResourceName("AbpLocalization")]
+ public class AbpLocalizationResource
+ {
+
+ }
+}
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json
new file mode 100644
index 0000000000..aee47a44b6
--- /dev/null
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json
@@ -0,0 +1,7 @@
+{
+ "culture": "en",
+ "texts": {
+ "DisplayName:Abp.Localization.DefaultLanguage": "Default language",
+ "Description:Abp.Localization.DefaultLanguage": "The default language of the application."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json
new file mode 100644
index 0000000000..7167aac9fd
--- /dev/null
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json
@@ -0,0 +1,7 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "DisplayName:Abp.Localization.DefaultLanguage": "默认语言",
+ "Description:Abp.Localization.DefaultLanguage": "应用程序的默认语言."
+ }
+}
\ No newline at end of file
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
index 667244886c..5d0151fe66 100644
--- 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
@@ -1,8 +1,11 @@
-namespace Volo.Abp.Localization.Resources.AbpValidation
+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.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs
index 68b9beeb6e..b81aa7ae87 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
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
@@ -25,40 +26,52 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
DatabaseProvider = databaseProvider;
}
- public override TEntity Insert(TEntity entity, bool autoSave = false)
+ protected override IQueryable GetQueryable()
{
- Collection.Add(entity);
- return entity;
+ return ApplyDataFilters(Collection.AsQueryable());
}
- public override TEntity Update(TEntity entity, bool autoSave = false)
+ public override Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
- Collection.Update(entity);
- return entity;
+ var entities = Collection.AsQueryable().Where(predicate).ToList();
+ foreach (var entity in entities)
+ {
+ Collection.Remove(entity);
+ }
+
+ return Task.CompletedTask;
}
- public override void Delete(TEntity entity, bool autoSave = false)
+ public override Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
- Collection.Remove(entity);
+ Collection.Add(entity);
+ return Task.FromResult(entity);
+ }
+
+ public override Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
+ {
+ Collection.Update(entity);
+ return Task.FromResult(entity);
}
- public override List GetList(bool includeDetails = false)
+ public override Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
- return Collection.ToList();
+ Collection.Remove(entity);
+ return Task.CompletedTask;
}
- public override long GetCount()
+ public override Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
- return Collection.Count();
+ return Task.FromResult(Collection.ToList());
}
- protected override IQueryable GetQueryable()
+ public override Task GetCountAsync(CancellationToken cancellationToken = default)
{
- return ApplyDataFilters(Collection.AsQueryable());
+ return Task.FromResult(Collection.LongCount());
}
}
- public class MemoryDbRepository : MemoryDbRepository, IMemoryDbRepository
+ public class MemoryDbRepository : MemoryDbRepository, IMemoryDbRepository
where TMemoryDbContext : MemoryDbContext
where TEntity : class, IEntity
{
@@ -67,16 +80,16 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
{
}
- public override TEntity Insert(TEntity entity, bool autoSave = false)
+ public override Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
SetIdIfNeeded(entity);
- return base.Insert(entity, autoSave);
+ return base.InsertAsync(entity, autoSave, cancellationToken);
}
protected virtual void SetIdIfNeeded(TEntity entity)
{
- if (typeof(TKey) == typeof(int) ||
- typeof(TKey) == typeof(long) ||
+ if (typeof(TKey) == typeof(int) ||
+ typeof(TKey) == typeof(long) ||
typeof(TKey) == typeof(Guid))
{
if (EntityHelper.HasDefaultId(entity))
@@ -86,14 +99,9 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
}
}
- public virtual TEntity Find(TKey id, bool includeDetails = true)
- {
- return GetQueryable().FirstOrDefault(e => e.Id.Equals(id));
- }
-
- public virtual TEntity Get(TKey id, bool includeDetails = true)
+ public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
- var entity = Find(id, includeDetails);
+ var entity = await FindAsync(id, includeDetails, cancellationToken);
if (entity == null)
{
@@ -103,31 +111,20 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
return entity;
}
- public virtual Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Get(id, includeDetails));
- }
-
public virtual Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
- return Task.FromResult(Find(id, includeDetails));
+ return Task.FromResult(GetQueryable().FirstOrDefault(e => e.Id.Equals(id)));
}
- public virtual void Delete(TKey id, bool autoSave = false)
+ public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
- var entity = Find(id);
+ var entity = await FindAsync(id, cancellationToken: cancellationToken);
if (entity == null)
{
return;
}
- Delete(entity);
- }
-
- public virtual Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(id);
- return Task.CompletedTask;
+ await DeleteAsync(entity, autoSave, cancellationToken);
}
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj
index 9f07fb9346..5cf143f99a 100644
--- a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj
+++ b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj
@@ -14,7 +14,7 @@
-
+
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 057f72bbb5..4e8ccaa82e 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
@@ -53,20 +53,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
EntityChangeEventHelper = NullEntityChangeEventHelper.Instance;
}
- public override TEntity Insert(TEntity entity, bool autoSave = false)
- {
- /* EntityCreatedEvent (OnUowCompleted) is triggered as the first because it should be
- * triggered before other events triggered inside an EntityCreating event handler.
- * This is also true for other "ed" & "ing" events.
- */
-
- AsyncHelper.RunSync(() => ApplyAbpConceptsForAddedEntityAsync(entity));
-
- Collection.InsertOne(entity);
-
- return entity;
- }
-
public override async Task InsertAsync(
TEntity entity,
bool autoSave = false,
@@ -82,37 +68,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
return entity;
}
- public override TEntity Update(TEntity entity, bool autoSave = false)
- {
- SetModificationAuditProperties(entity);
-
- if (entity is ISoftDelete softDeleteEntity && softDeleteEntity.IsDeleted)
- {
- SetDeletionAuditProperties(entity);
- AsyncHelper.RunSync(() => TriggerEntityDeleteEventsAsync(entity));
- }
- else
- {
- AsyncHelper.RunSync(() => TriggerEntityUpdateEventsAsync(entity));
- }
-
- AsyncHelper.RunSync(() => TriggerDomainEventsAsync(entity));
-
- var oldConcurrencyStamp = SetNewConcurrencyStamp(entity);
-
- var result = Collection.ReplaceOne(
- CreateEntityFilter(entity, true, oldConcurrencyStamp),
- entity
- );
-
- if (result.MatchedCount <= 0)
- {
- ThrowOptimisticConcurrencyException();
- }
-
- return entity;
- }
-
public override async Task UpdateAsync(
TEntity entity,
bool autoSave = false,
@@ -148,37 +103,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
return entity;
}
- public override void Delete(TEntity entity, bool autoSave = false)
- {
- AsyncHelper.RunSync(() => ApplyAbpConceptsForDeletedEntityAsync(entity));
- var oldConcurrencyStamp = SetNewConcurrencyStamp(entity);
-
- if (entity is ISoftDelete softDeleteEntity)
- {
- softDeleteEntity.IsDeleted = true;
- var result = Collection.ReplaceOne(
- CreateEntityFilter(entity, true, oldConcurrencyStamp),
- entity
- );
-
- if (result.MatchedCount <= 0)
- {
- ThrowOptimisticConcurrencyException();
- }
- }
- else
- {
- var result = Collection.DeleteOne(
- CreateEntityFilter(entity, true, oldConcurrencyStamp)
- );
-
- if (result.DeletedCount <= 0)
- {
- ThrowOptimisticConcurrencyException();
- }
- }
- }
-
public override async Task DeleteAsync(
TEntity entity,
bool autoSave = false,
@@ -215,38 +139,16 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
}
}
- public override List GetList(bool includeDetails = false)
- {
- return GetMongoQueryable().ToList();
- }
-
public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
return await GetMongoQueryable().ToListAsync(GetCancellationToken(cancellationToken));
}
- public override long GetCount()
- {
- return GetMongoQueryable().LongCount();
- }
-
public override async Task GetCountAsync(CancellationToken cancellationToken = default)
{
return await GetMongoQueryable().LongCountAsync(GetCancellationToken(cancellationToken));
}
- public override void Delete(Expression> predicate, bool autoSave = false)
- {
- var entities = GetMongoQueryable()
- .Where(predicate)
- .ToList();
-
- foreach (var entity in entities)
- {
- Delete(entity, autoSave);
- }
- }
-
public override async Task DeleteAsync(
Expression> predicate,
bool autoSave = false,
@@ -417,18 +319,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
}
- public virtual TEntity Get(TKey id, bool includeDetails = true)
- {
- var entity = Find(id, includeDetails);
-
- if (entity == null)
- {
- throw new EntityNotFoundException(typeof(TEntity), id);
- }
-
- return entity;
- }
-
public virtual async Task GetAsync(
TKey id,
bool includeDetails = true,
@@ -454,16 +344,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
- public virtual TEntity Find(TKey id, bool includeDetails = true)
- {
- return Collection.Find(CreateEntityFilter(id, true)).FirstOrDefault();
- }
-
- public virtual void Delete(TKey id, bool autoSave = false)
- {
- Collection.DeleteOne(CreateEntityFilter(id));
- }
-
public virtual Task DeleteAsync(
TKey id,
bool autoSave = false,
diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/Resource/es.json b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/Resource/es.json
new file mode 100644
index 0000000000..ba27a9193c
--- /dev/null
+++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/Resource/es.json
@@ -0,0 +1,6 @@
+{
+ "culture": "es",
+ "texts": {
+ "Menu:Administration": "Administración"
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json
index b67fc568b3..28c9a5e33f 100644
--- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json
+++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json
@@ -46,6 +46,13 @@
"DatatableActionDropdownDefaultText": "Akce",
"ChangePassword": "Změnit heslo",
"PersonalInfo": "Můj profil",
- "AreYouSureYouWantToCancelEditingWarningMessage": "Máte neuložené změny."
+ "AreYouSureYouWantToCancelEditingWarningMessage": "Máte neuložené změny.",
+ "UnhandledException": "Neošetřená výjimka!",
+ "401Message": "Neoprávněno",
+ "403Message": "Zakázáno",
+ "404Message": "Stránka nenalezena",
+ "500Message": "Interní chyba serveru",
+ "GoHomePage": "Přejít na domovskou stránku",
+ "GoBack": "Jít zpět"
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json
index 4f44ae87c2..0bd6ba5462 100644
--- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json
+++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json
@@ -4,7 +4,7 @@
"InternalServerErrorMessage": "An internal error occurred during your request!",
"ValidationErrorMessage": "Your request is not valid!",
"ValidationNarrativeErrorMessageTitle": "The following errors were detected during validation.",
- "DefaultErrorMessage": "An error has been occurred!",
+ "DefaultErrorMessage": "An error has occurred!",
"DefaultErrorMessageDetail": "Error detail not sent by server.",
"DefaultErrorMessage401": "You are not authenticated!",
"DefaultErrorMessage401Detail": "You should sign in to perform this operation.",
@@ -55,4 +55,4 @@
"GoHomePage": "Go to the homepage",
"GoBack": "Go back"
}
-}
\ No newline at end of file
+}
diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json
new file mode 100644
index 0000000000..4997156c8d
--- /dev/null
+++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json
@@ -0,0 +1,58 @@
+{
+ "culture": "es",
+ "texts": {
+ "InternalServerErrorMessage": "Ocurrió un error interno en su pedido!",
+ "ValidationErrorMessage": "Su pedido no es válido!",
+ "ValidationNarrativeErrorMessageTitle": "Los siguientes errores se encontraton durante la validación.",
+ "DefaultErrorMessage": "Ocurrió un error!",
+ "DefaultErrorMessageDetail": "El servidor no envió el detalle del error.",
+ "DefaultErrorMessage401": "Usted no ha iniciado sessión!",
+ "DefaultErrorMessage401Detail": "Debe iniciar sessión para ejecutar esta operación.",
+ "DefaultErrorMessage403": "Usted no está autorizado!",
+ "DefaultErrorMessage403Detail": "Usted no puede hacer esta operación!",
+ "DefaultErrorMessage404": "No se encontró el recurso!",
+ "DefaultErrorMessage404Detail": "El recurso solicitado no se encontró en el servidor!",
+ "EntityNotFoundErrorMessage": "No hay una entidad {0} con el id = {1}!",
+ "Error": "Error",
+ "AreYouSure": "¿Está seguro?",
+ "Cancel": "Cancelar",
+ "Yes": "Si",
+ "No": "No",
+ "Close": "Cerrar",
+ "Save": "Guardar",
+ "SavingWithThreeDot": "Guardando...",
+ "Actions": "Acciones",
+ "Delete": "Eliminar",
+ "Edit": "Editar",
+ "Refresh": "Refrescar",
+ "ProcessingWithThreeDot": "Procesando...",
+ "LoadingWithThreeDot": "Cargando...",
+ "Welcome": "Bienvenido",
+ "Login": "Iniciar session",
+ "Register": "Registrarse",
+ "Logout": "Cerrar sessión",
+ "Submit": "Enviar",
+ "Back": "Atrás",
+ "PagerSearch": "Buscar",
+ "PagerNext": "Siguiente",
+ "PagerPrevious": "Anterior",
+ "PagerFirst": "Primero",
+ "PagerLast": "Último",
+ "PagerInfo": "Mostrando desde _START_ hasta _END_ total _TOTAL_",
+ "PagerInfoEmpty": "Mostrando desde 0 hasta 0 de 0 registros",
+ "PagerInfoFiltered": "(filtrado de un total de _MAX_ registros)",
+ "NoDataAvailableInDatatable": "No hay datos",
+ "PagerShowMenuEntries": "Mostrar _MENU_ registros",
+ "DatatableActionDropdownDefaultText": "Acciones",
+ "ChangePassword": "Cambiar contraseña",
+ "PersonalInfo": "My perfil",
+ "AreYouSureYouWantToCancelEditingWarningMessage": "Tiene cambios sin guardar.",
+ "UnhandledException": "Excepción no controlada!",
+ "401Message": "No autorizado",
+ "403Message": "Prohibido",
+ "404Message": "La página no existe",
+ "500Message": "Error interno del servidor",
+ "GoHomePage": "Ir a la página principal",
+ "GoBack": "Atras"
+ }
+}
diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ChildUnitOfWork.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ChildUnitOfWork.cs
index 0d2686cdfe..d1d90b6f6f 100644
--- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ChildUnitOfWork.cs
+++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ChildUnitOfWork.cs
@@ -53,31 +53,16 @@ namespace Volo.Abp.Uow
_parent.Reserve(reservationName);
}
- public void SaveChanges()
- {
- _parent.SaveChanges();
- }
-
public Task SaveChangesAsync(CancellationToken cancellationToken = default)
{
return _parent.SaveChangesAsync(cancellationToken);
}
- public void Complete()
- {
-
- }
-
public Task CompleteAsync(CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
- public void Rollback()
- {
- _parent.Rollback();
- }
-
public Task RollbackAsync(CancellationToken cancellationToken = default)
{
return _parent.RollbackAsync(cancellationToken);
diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWork.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWork.cs
index cf65ca69e7..32ef781133 100644
--- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWork.cs
+++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWork.cs
@@ -32,16 +32,10 @@ namespace Volo.Abp.Uow
void Reserve([NotNull] string reservationName);
- void SaveChanges();
-
Task SaveChangesAsync(CancellationToken cancellationToken = default);
- void Complete();
-
Task CompleteAsync(CancellationToken cancellationToken = default);
- void Rollback();
-
Task RollbackAsync(CancellationToken cancellationToken = default);
void OnCompleted(Func handler);
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 5b857e8828..e7e86774b5 100644
--- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs
+++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs
@@ -5,7 +5,6 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;
-using Volo.Abp.Threading;
namespace Volo.Abp.Uow
{
@@ -75,14 +74,6 @@ namespace Volo.Abp.Uow
Outer = outer;
}
- public virtual void SaveChanges()
- {
- foreach (var databaseApi in GetAllActiveDatabaseApis())
- {
- (databaseApi as ISupportsSavingChanges)?.SaveChanges();
- }
- }
-
public virtual async Task SaveChangesAsync(CancellationToken cancellationToken = default)
{
foreach (var databaseApi in GetAllActiveDatabaseApis())
@@ -104,30 +95,6 @@ namespace Volo.Abp.Uow
return _transactionApis.Values.ToImmutableList();
}
- public virtual void Complete()
- {
- if (_isRolledback)
- {
- return;
- }
-
- PreventMultipleComplete();
-
- try
- {
- _isCompleting = true;
- SaveChanges();
- CommitTransactions();
- IsCompleted = true;
- OnCompleted();
- }
- catch (Exception ex)
- {
- _exception = ex;
- throw;
- }
- }
-
public virtual async Task CompleteAsync(CancellationToken cancellationToken = default)
{
if (_isRolledback)
@@ -152,18 +119,6 @@ namespace Volo.Abp.Uow
}
}
- public virtual void Rollback()
- {
- if (_isRolledback)
- {
- return;
- }
-
- _isRolledback = true;
-
- RollbackAll();
- }
-
public virtual async Task RollbackAsync(CancellationToken cancellationToken = default)
{
if (_isRolledback)
@@ -235,19 +190,6 @@ namespace Volo.Abp.Uow
CompletedHandlers.Add(handler);
}
- public void OnFailed(Func handler)
- {
- throw new NotImplementedException();
- }
-
- protected virtual void OnCompleted()
- {
- foreach (var handler in CompletedHandlers)
- {
- AsyncHelper.RunSync(handler);
- }
- }
-
protected virtual async Task OnCompletedAsync()
{
foreach (var handler in CompletedHandlers)
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 1ca6681189..81bd132a5e 100644
--- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs
+++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs
@@ -18,21 +18,6 @@ namespace Volo.Abp.Uow
_defaultOptions = options.Value;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- if (!UnitOfWorkHelper.IsUnitOfWorkMethod(invocation.Method, out var unitOfWorkAttribute))
- {
- invocation.Proceed();
- return;
- }
-
- using (var uow = _unitOfWorkManager.Begin(CreateOptions(invocation, unitOfWorkAttribute)))
- {
- invocation.Proceed();
- uow.Complete();
- }
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
if (!UnitOfWorkHelper.IsUnitOfWorkMethod(invocation.Method, out var unitOfWorkAttribute))
diff --git a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj
index c8cc738e98..9e1e81b1d9 100644
--- a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj
+++ b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj
@@ -1,4 +1,4 @@
-
+
@@ -13,8 +13,14 @@
+
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs
index bb2d41f927..ad2be911de 100644
--- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs
+++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs
@@ -1,10 +1,16 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Localization;
using Volo.Abp.Modularity;
+using Volo.Abp.Validation.Localization;
+using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.Validation
{
+ [DependsOn(
+ typeof(AbpLocalizationModule)
+ )]
public class AbpValidationModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
@@ -12,6 +18,20 @@ namespace Volo.Abp.Validation
context.Services.OnRegistred(ValidationInterceptorRegistrar.RegisterIfNeeded);
AutoAddObjectValidationContributors(context.Services);
}
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.FileSets.AddEmbedded();
+ });
+
+ Configure(options =>
+ {
+ options.Resources
+ .Add("en")
+ .AddVirtualJson("/Volo/Abp/Validation/Localization");
+ });
+ }
private static void AutoAddObjectValidationContributors(IServiceCollection services)
{
diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs
new file mode 100644
index 0000000000..0de105747d
--- /dev/null
+++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs
@@ -0,0 +1,10 @@
+using Volo.Abp.Localization;
+
+namespace Volo.Abp.Validation.Localization
+{
+ [LocalizationResourceName("AbpValidation")]
+ public class AbpValidationResource
+ {
+
+ }
+}
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/cs.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/cs.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/cs.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/cs.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json
diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/es.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/es.json
new file mode 100644
index 0000000000..25ed44d7ad
--- /dev/null
+++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/es.json
@@ -0,0 +1,34 @@
+{
+ "culture": "es",
+ "texts": {
+ "'{0}' and '{1}' do not match.": "'{0} \" y \"{1} \" no coinciden.",
+ "The {0} field is not a valid credit card number.": "{0} no es un número de tarjeta de crédito.",
+ "{0} is not valid.": "{0} no es válido.",
+ "The {0} field is not a valid e-mail address.": "{0} no es una dirección de correo electrónico válida.",
+ "The {0} field only accepts files with the following extensions: {1}": "{0} campo sólo acepta archivos con las siguientes extensiones: {1}",
+ "The field {0} must be a string or array type with a maximum length of '{1}'.": "El campo {0} debe ser una cadena o un array con una longitud máxima de '{1}'.",
+ "The field {0} must be a string or array type with a minimum length of '{1}'.": "El campo {0} debe ser una cadena o un array con una longitud mínima de '{1}'.",
+ "The {0} field is not a valid phone number.": "{0} no es un número de teléfono válido.",
+ "The field {0} must be between {1} and {2}.": "El campo {0} debe ser entre {1} y {2}.",
+ "The field {0} must match the regular expression '{1}'.": "El campo {0} debe coincidir con la expresión regular '{1}'.",
+ "The {0} field is required.": "La {0} campo es obligatorio.",
+ "The field {0} must be a string with a maximum length of {1}.": "El campo {0} debe ser una cadena con una longitud máxima de {1}.",
+ "The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "El campo {0} debe ser una cadena con una longitud mínima de {2} y una longitud máxima de {1}.",
+ "The {0} field is not a valid fully-qualified http, https, or ftp URL.": "El campo {0} no es una dirección URL válida http, https o ftp.",
+ "The field {0} is invalid.": "El campo {0} no es válido.",
+ "ThisFieldIsNotAValidCreditCardNumber.": "Este campo no es un número de tarjeta de crédito.",
+ "ThisFieldIsNotValid.": "Este campo no es válido.",
+ "ThisFieldIsNotAValidEmailAddress.": "Este campo no es una dirección de correo electrónico válida.",
+ "ThisFieldOnlyAcceptsFilesWithTheFollowingExtensions:{0}": "Este campo sólo acepta archivos con las siguientes extensiones: {0}",
+ "ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthoOf{0}": "Este campo debe ser una cadena o un array con una longitud máxima de '{0}'.",
+ "ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}": "Este campo debe ser una cadena o un array con una longitud mínima de '{0}'.",
+ "ThisFieldIsNotAValidPhoneNumber.": "Este campo no es un número de teléfono válido.",
+ "ThisFieldMustBeBetween{0}And{1}": "Este campo debe tener un valor entre {0} y {1}.",
+ "ThisFieldMustMatchTheRegularExpression{0}": "Este campo debe coincidir con la expresión regular '{0}'.",
+ "ThisFieldIsRequired.": "Este campo es obligatorio.",
+ "ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "Este campo debe ser una cadena de caracteres con una longitud máxima de {0}.",
+ "ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "Este campo debe ser una cadena de caracteres con una longitud mínima de {1} y una longitud máxima de {0}.",
+ "ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "Este campo no es una dirección URL válida http, https o ftp.",
+ "ThisFieldIsInvalid.": "Este campo no es válido."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pl.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pl.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pl.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pl.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pt-BR.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pt-BR.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pt-BR.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pt-BR.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/tr.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/tr.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/tr.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/tr.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/vi.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/vi.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/vi.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/vi.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json
similarity index 98%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json
index d56c893c38..ac0c014967 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
+++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json
@@ -29,6 +29,6 @@
"ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "字段必须是长度为{0}的字符串.",
"ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "字段必须是最小长度为{1}并且最大长度{*}的字符串.",
"ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "字段{0}不是有效的完全限定的http,https或ftp URL.",
- "ThisFieldIsInvalid.": "字段是无效值."
+ "ThisFieldIsInvalid.": "该字段无效."
}
}
\ No newline at end of file
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 ed8c107005..b4ce642471 100644
--- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs
+++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs
@@ -13,12 +13,6 @@ namespace Volo.Abp.Validation
_methodInvocationValidator = methodInvocationValidator;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- Validate(invocation);
- invocation.Proceed();
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
Validate(invocation);
diff --git a/framework/src/Volo.Abp.VirtualFileSystem/Volo.Abp.VirtualFileSystem.csproj b/framework/src/Volo.Abp.VirtualFileSystem/Volo.Abp.VirtualFileSystem.csproj
index 7d8ae348b7..512c901b69 100644
--- a/framework/src/Volo.Abp.VirtualFileSystem/Volo.Abp.VirtualFileSystem.csproj
+++ b/framework/src/Volo.Abp.VirtualFileSystem/Volo.Abp.VirtualFileSystem.csproj
@@ -14,8 +14,8 @@
-
-
+
+
diff --git a/framework/test/AbpTestBase/AbpTestBase.csproj b/framework/test/AbpTestBase/AbpTestBase.csproj
index 6547230b39..566bfde770 100644
--- a/framework/test/AbpTestBase/AbpTestBase.csproj
+++ b/framework/test/AbpTestBase/AbpTestBase.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1AbpTestBaseAbpTestBase
@@ -14,7 +14,7 @@
-
+
diff --git a/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj b/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj
index 6138532877..133f84bd10 100644
--- a/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj
+++ b/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj
@@ -2,7 +2,7 @@
Exe
- netcoreapp3.0
+ netcoreapp3.1
@@ -18,7 +18,7 @@
-
+
diff --git a/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj
index e7f6b3b985..2e6a7187fd 100644
--- a/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj
+++ b/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1latestVolo.Abp.AspNetCore.Authentication.OAuth.TestsVolo.Abp.AspNetCore.Authentication.OAuth.Tests
@@ -17,7 +17,7 @@
-
+
diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj
index c997e76b13..06b6fbcd94 100644
--- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj
+++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AspNetCore.MultiTenancy.TestsVolo.Abp.AspNetCore.MultiTenancy.Tests
@@ -12,7 +12,7 @@
-
+
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj
index 56499edf0a..4dad128d56 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;Volo.Abp.AspNetCore.Mvc.TestsVolo.Abp.AspNetCore.Mvc.Tests
@@ -20,7 +20,7 @@
-
+
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs
similarity index 88%
rename from framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs
rename to framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs
index 8bf86a3ace..96a79d8971 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs
@@ -19,13 +19,13 @@ namespace Volo.Abp.AspNetCore.Mvc
{
//TODO: Refactor to make tests easier.
- public class PersonAppService_Tests : AspNetCoreMvcTestBase
+ public class PeopleAppService_Tests : AspNetCoreMvcTestBase
{
private readonly IRepository _personRepository;
private readonly IJsonSerializer _jsonSerializer;
private readonly IObjectMapper _objectMapper;
- public PersonAppService_Tests()
+ public PeopleAppService_Tests()
{
_personRepository = ServiceProvider.GetRequiredService>();
_jsonSerializer = ServiceProvider.GetRequiredService();
@@ -42,7 +42,7 @@ namespace Volo.Abp.AspNetCore.Mvc
[Fact]
public async Task Get_Test()
{
- var firstPerson = _personRepository.First();
+ var firstPerson = (await _personRepository.GetListAsync()).First();
var result = await GetResponseAsObjectAsync($"/api/app/people/{firstPerson.Id}");
result.Name.ShouldBe(firstPerson.Name);
@@ -51,7 +51,7 @@ namespace Volo.Abp.AspNetCore.Mvc
[Fact]
public async Task Delete_Test()
{
- var firstPerson = _personRepository.First();
+ var firstPerson = (await _personRepository.GetListAsync()).First();
await Client.DeleteAsync($"/api/app/people/{firstPerson.Id}");
@@ -89,7 +89,7 @@ namespace Volo.Abp.AspNetCore.Mvc
{
//Arrange
- var firstPerson = _personRepository.First();
+ var firstPerson = (await _personRepository.GetListAsync()).First();
var firstPersonAge = firstPerson.Age; //Persist to a variable since we are using in-memory database which shares same entity.
var updateDto = _objectMapper.Map(firstPerson);
updateDto.Age = updateDto.Age + 1;
@@ -123,7 +123,7 @@ namespace Volo.Abp.AspNetCore.Mvc
{
//Arrange
- var personToAddNewPhone = _personRepository.First();
+ var personToAddNewPhone = (await _personRepository.GetListAsync()).First();
var phoneNumberToAdd = RandomHelper.GetRandom(1000000, 9000000).ToString();
//Act
@@ -152,7 +152,7 @@ namespace Volo.Abp.AspNetCore.Mvc
[Fact]
public async Task GetPhones_Test()
{
- var douglas = _personRepository.First(p => p.Name == "Douglas");
+ var douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas");
var result = await GetResponseAsObjectAsync>($"/api/app/people/{douglas.Id}/phones");
result.Items.Count.ShouldBe(douglas.Phones.Count);
@@ -161,12 +161,12 @@ namespace Volo.Abp.AspNetCore.Mvc
[Fact]
public async Task DeletePhone_Test()
{
- var douglas = _personRepository.First(p => p.Name == "Douglas");
+ 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}");
- douglas = _personRepository.First(p => p.Name == "Douglas");
+ 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 bd7366b931..c7dce93b3a 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
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
+using Microsoft.Extensions.Options;
using Shouldly;
using Xunit;
@@ -16,7 +17,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting
[Fact]
public async Task GetAllWithMinify()
{
+ GetRequiredService>().Value.MinifyGeneratedScript = false;
var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript");
+
+ GetRequiredService>().Value.MinifyGeneratedScript = true;
var minifyScript = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true");
script.Length.ShouldBeGreaterThan(0);
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/TestUnitOfWork.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/TestUnitOfWork.cs
index 079120e8d3..3b9ec55e75 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/TestUnitOfWork.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/TestUnitOfWork.cs
@@ -19,12 +19,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
_config = config;
}
- public override void Complete()
- {
- ThrowExceptionIfRequested();
- base.Complete();
- }
-
public override Task CompleteAsync(CancellationToken cancellationToken = default(CancellationToken))
{
ThrowExceptionIfRequested();
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkTestController.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkTestController.cs
index 4d8d51c3c8..705a9a7212 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkTestController.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkTestController.cs
@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Shouldly;
-using Volo.Abp.UI;
using Volo.Abp.Uow;
namespace Volo.Abp.AspNetCore.Mvc.Uow
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj
index e0f67c68eb..8a76a15f5d 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.TestsVolo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests
@@ -19,7 +19,7 @@
-
+
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Dockerfile b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Dockerfile
index f1e0e4eccc..41b878cf7a 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Dockerfile
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Dockerfile
@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS base
+FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
COPY bin/Release/publish .
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj
index 0675a67f58..3384fcf332 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj
@@ -3,12 +3,12 @@
- netcoreapp3.0
+ netcoreapp3.1true
-
+
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj
index 2936cfb847..0a19e5dbdf 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;Volo.Abp.AspNetCore.Mvc.UI.TestsVolo.Abp.AspNetCore.Mvc.UI.Tests
@@ -15,7 +15,7 @@
-
+
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj
index 27b0913457..9ed9312919 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;Volo.Abp.AspNetCore.Mvc.Versioning.TestsVolo.Abp.AspNetCore.Mvc.Versioning.Tests
@@ -15,7 +15,7 @@
-
+
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/ITodoAppService.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/ITodoAppService.cs
index 3e82da0329..7ed6be1ac2 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/ITodoAppService.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/ITodoAppService.cs
@@ -1,9 +1,10 @@
+using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v1
{
public interface ITodoAppService : IApplicationService
{
- string Get(int id);
+ Task GetAsync(int id);
}
}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/TodoAppService.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/TodoAppService.cs
index f3f900148d..eee0248a61 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/TodoAppService.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/TodoAppService.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.ApiVersioning;
+using System.Threading.Tasks;
+using Volo.Abp.ApiVersioning;
using Volo.Abp.Application.Services;
namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v1
@@ -12,9 +13,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v1
_requestedApiVersion = requestedApiVersion;
}
- public string Get(int id)
+ public Task GetAsync(int id)
{
- return $"Compat-{id}-{GetVersionOrNone()}";
+ return Task.FromResult($"Compat-{id}-{GetVersionOrNone()}");
}
private string GetVersionOrNone()
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/ITodoAppService.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/ITodoAppService.cs
index ae4afea6e1..196cc82503 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/ITodoAppService.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/ITodoAppService.cs
@@ -1,9 +1,10 @@
+using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v2
{
public interface ITodoAppService : IApplicationService
{
- string Get(int id);
+ Task GetAsync(int id);
}
}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/TodoAppService.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/TodoAppService.cs
index b97af873b7..24f8604227 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/TodoAppService.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/TodoAppService.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.ApiVersioning;
+using System.Threading.Tasks;
+using Volo.Abp.ApiVersioning;
using Volo.Abp.Application.Services;
namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v2
@@ -12,9 +13,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v2
_requestedApiVersion = requestedApiVersion;
}
- public string Get(int id)
+ public Task GetAsync(int id)
{
- return id + "-" + GetVersionOrNone();
+ return Task.FromResult(id + "-" + GetVersionOrNone());
}
private string GetVersionOrNone()
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 7b461a3902..f5b86cf7d7 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
@@ -1,4 +1,5 @@
-using Microsoft.Extensions.DependencyInjection;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.AspNetCore.Mvc.Versioning.App.v1;
using Xunit;
@@ -15,9 +16,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test.v1
}
[Fact]
- public void Get()
+ public async Task GetAsync()
{
- _todoAppService.Get(42).ShouldBe("Compat-42-1.0");
+ (await _todoAppService.GetAsync(42)).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 f4cd122afc..d6b681aa2e 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
@@ -1,4 +1,5 @@
-using Microsoft.Extensions.DependencyInjection;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.AspNetCore.Mvc.Versioning.App.v2;
using Xunit;
@@ -15,9 +16,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test.v2
}
[Fact]
- public void Get()
+ public async Task GetAsync()
{
- _todoAppService.Get(42).ShouldBe("42-2.0");
+ (await _todoAppService.GetAsync(42)).ShouldBe("42-2.0");
}
}
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj
index f00a809174..dd8b1fc805 100644
--- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj
+++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AspNetCore.TestsVolo.Abp.AspNetCore.Teststrue
@@ -25,7 +25,7 @@
-
+
diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj b/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj
index 1dbc542b85..770ad82870 100644
--- a/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj
+++ b/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Auditing.TestsVolo.Abp.Auditing.Teststrue
@@ -14,7 +14,7 @@
-
+
diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj b/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj
index 9e3aaa958b..5abc0fc670 100644
--- a/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj
+++ b/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Authorization.TestsVolo.Abp.Authorization.Teststrue
@@ -14,7 +14,7 @@
-
+
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 fa069348cd..104d75c11b 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
@@ -18,11 +18,11 @@ namespace Volo.Abp.Authorization
}
[Fact]
- public void Should_Not_Allow_To_Call_Method_If_Has_No_Permission_ProtectedByClass()
+ public async Task Should_Not_Allow_To_Call_Method_If_Has_No_Permission_ProtectedByClass()
{
- Assert.Throws(() =>
+ await Assert.ThrowsAsync(async () =>
{
- _myAuthorizedService1.ProtectedByClass();
+ await _myAuthorizedService1.ProtectedByClass();
});
}
@@ -36,9 +36,9 @@ namespace Volo.Abp.Authorization
}
[Fact]
- public void Should_Allow_To_Call_Anonymous_Method()
+ public async Task Should_Allow_To_Call_Anonymous_Method()
{
- _myAuthorizedService1.Anonymous().ShouldBe(42);
+ (await _myAuthorizedService1.Anonymous()).ShouldBe(42);
}
[Fact]
diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/IMyAuthorizedService1.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/IMyAuthorizedService1.cs
index 0ef6bde8a0..b3841c4fed 100644
--- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/IMyAuthorizedService1.cs
+++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/IMyAuthorizedService1.cs
@@ -4,11 +4,11 @@ namespace Volo.Abp.Authorization.TestServices
{
public interface IMyAuthorizedService1
{
- int Anonymous();
+ Task Anonymous();
Task AnonymousAsync();
- int ProtectedByClass();
+ Task ProtectedByClass();
Task ProtectedByClassAsync();
}
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 0b33dd0c98..b1b2a4c43f 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
@@ -8,9 +8,9 @@ namespace Volo.Abp.Authorization.TestServices
public class MyAuthorizedService1 : IMyAuthorizedService1, ITransientDependency
{
[AllowAnonymous]
- public virtual int Anonymous()
+ public virtual Task Anonymous()
{
- return 42;
+ return Task.FromResult(42);
}
[AllowAnonymous]
@@ -20,9 +20,9 @@ namespace Volo.Abp.Authorization.TestServices
return 42;
}
- public virtual int ProtectedByClass()
+ public virtual Task ProtectedByClass()
{
- return 42;
+ return Task.FromResult(42);
}
public virtual async Task ProtectedByClassAsync()
diff --git a/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj b/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj
index 5a70b9c23a..4bf0661800 100644
--- a/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj
+++ b/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.AutoMapper.TestsVolo.Abp.AutoMapper.Tests
@@ -12,7 +12,7 @@
-
+
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj b/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj
index ff48454a8b..bbbee3bbbb 100644
--- a/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj
+++ b/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Autofac.TestsVolo.Abp.Autofac.Teststrue
@@ -14,7 +14,7 @@
-
+
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj
index 758a6187ea..b352c05455 100644
--- a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj
+++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.BackgroundJobs.TestsVolo.Abp.BackgroundJobs.Tests
@@ -13,7 +13,7 @@
-
+
\ No newline at end of file
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 566c69c318..81c76f2559 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
@@ -1,4 +1,4 @@
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using Shouldly;
using Xunit;
@@ -35,5 +35,28 @@ namespace Volo.Abp.BackgroundJobs
jobObject.ExecutedValues.ShouldContain("42");
}
+
+ [Fact]
+ public async Task Should_Execute_Async_Tasks()
+ {
+ //Arrange
+
+ var jobObject = GetRequiredService();
+ jobObject.ExecutedValues.ShouldBeEmpty();
+
+ //Act
+
+ _backgroundJobExecuter.Execute(
+ new JobExecutionContext(
+ ServiceProvider,
+ typeof(MyAsyncJob),
+ new MyAsyncJobArgs("42")
+ )
+ );
+
+ //Assert
+
+ jobObject.ExecutedValues.ShouldContain("42");
+ }
}
}
\ No newline at end of file
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 2c00573bc7..3a84e38df1 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
@@ -23,5 +23,13 @@ namespace Volo.Abp.BackgroundJobs
jobIdAsString.ShouldNotBe(default);
(await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString))).ShouldNotBeNull();
}
+
+ [Fact]
+ public async Task Should_Store_Async_Jobs()
+ {
+ var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyAsyncJobArgs("42"));
+ jobIdAsString.ShouldNotBe(default);
+ (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString))).ShouldNotBeNull();
+ }
}
}
diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/MyAsyncJob.cs b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/MyAsyncJob.cs
new file mode 100644
index 0000000000..a728d85deb
--- /dev/null
+++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/MyAsyncJob.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.BackgroundJobs
+{
+ public class MyAsyncJob : AsyncBackgroundJob, ISingletonDependency
+ {
+ public List ExecutedValues { get; } = new List();
+
+ public override Task ExecuteAsync(MyAsyncJobArgs args)
+ {
+ ExecutedValues.Add(args.Value);
+
+ return Task.CompletedTask;
+ }
+ }
+}
diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/MyAsyncJobArgs.cs b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/MyAsyncJobArgs.cs
new file mode 100644
index 0000000000..7a12d2a925
--- /dev/null
+++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/MyAsyncJobArgs.cs
@@ -0,0 +1,17 @@
+namespace Volo.Abp.BackgroundJobs
+{
+ public class MyAsyncJobArgs
+ {
+ public string Value { get; set; }
+
+ public MyAsyncJobArgs()
+ {
+
+ }
+
+ public MyAsyncJobArgs(string value)
+ {
+ Value = value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj b/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj
index b4ebdbc8bb..4301d8c1f4 100644
--- a/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj
+++ b/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Caching.TestsVolo.Abp.Caching.Tests
@@ -12,7 +12,7 @@
-
+
diff --git a/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj b/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj
index 7be716ebcc..9911775a60 100644
--- a/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj
+++ b/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj b/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj
index 257818f611..76de07406a 100644
--- a/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj
+++ b/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj b/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj
index d0e9f58e54..5a5d49e9e0 100644
--- a/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj
+++ b/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
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 27b3bf5d81..c6e9f03927 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
@@ -12,7 +12,6 @@ namespace Volo.Abp.DynamicProxy
protected override void BeforeAddApplication(IServiceCollection services)
{
services.AddTransient();
- services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -24,7 +23,6 @@ namespace Volo.Abp.DynamicProxy
if (typeof(SimpleInterceptionTargetClass) == registration.ImplementationType)
{
registration.Interceptors.Add();
- registration.Interceptors.Add();
registration.Interceptors.Add();
}
@@ -48,16 +46,14 @@ namespace Volo.Abp.DynamicProxy
//Assert
- target.Logs.Count.ShouldBe(9);
+ target.Logs.Count.ShouldBe(7);
target.Logs[0].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_BeforeInvocation");
- target.Logs[1].ShouldBe("SimpleSyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[2].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_BeforeInvocation");
- target.Logs[3].ShouldBe("EnterDoItAsync");
- target.Logs[4].ShouldBe("MiddleDoItAsync");
- target.Logs[5].ShouldBe("ExitDoItAsync");
- target.Logs[6].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_AfterInvocation");
- target.Logs[7].ShouldBe("SimpleSyncInterceptor_Intercept_AfterInvocation");
- target.Logs[8].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_AfterInvocation");
+ target.Logs[1].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_BeforeInvocation");
+ target.Logs[2].ShouldBe("EnterDoItAsync");
+ target.Logs[3].ShouldBe("MiddleDoItAsync");
+ target.Logs[4].ShouldBe("ExitDoItAsync");
+ target.Logs[5].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_AfterInvocation");
+ target.Logs[6].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_AfterInvocation");
}
[Fact]
@@ -73,77 +69,15 @@ namespace Volo.Abp.DynamicProxy
//Assert
- result.ShouldBe(42);
- target.Logs.Count.ShouldBe(9);
- target.Logs[0].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_BeforeInvocation");
- target.Logs[1].ShouldBe("SimpleSyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[2].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_BeforeInvocation");
- target.Logs[3].ShouldBe("EnterGetValueAsync");
- target.Logs[4].ShouldBe("MiddleGetValueAsync");
- target.Logs[5].ShouldBe("ExitGetValueAsync");
- target.Logs[6].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_AfterInvocation");
- target.Logs[7].ShouldBe("SimpleSyncInterceptor_Intercept_AfterInvocation");
- target.Logs[8].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_AfterInvocation");
- }
-
- [Fact]
- public void Should_Intercept_Sync_Method_Without_Return_Value()
- {
- //Arrange
-
- var target = ServiceProvider.GetService();
-
- //Act
-
- target.DoIt();
-
- //Assert
- target.Logs.Count.ShouldBe(7);
- target.Logs[0].ShouldBe("SimpleAsyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[1].ShouldBe("SimpleSyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[2].ShouldBe("SimpleAsyncInterceptor2_Intercept_BeforeInvocation");
- target.Logs[3].ShouldBe("ExecutingDoIt");
- target.Logs[4].ShouldBe("SimpleAsyncInterceptor2_Intercept_AfterInvocation");
- target.Logs[5].ShouldBe("SimpleSyncInterceptor_Intercept_AfterInvocation");
- target.Logs[6].ShouldBe("SimpleAsyncInterceptor_Intercept_AfterInvocation");
- }
-
- [Fact]
- public void Should_Intercept_Sync_Method_With_Return_Value()
- {
- //Arrange
-
- var target = ServiceProvider.GetService();
-
- //Act
-
- var result = target.GetValue();
-
- //Assert
-
result.ShouldBe(42);
target.Logs.Count.ShouldBe(7);
- target.Logs[0].ShouldBe("SimpleAsyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[1].ShouldBe("SimpleSyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[2].ShouldBe("SimpleAsyncInterceptor2_Intercept_BeforeInvocation");
- target.Logs[3].ShouldBe("ExecutingGetValue");
- target.Logs[4].ShouldBe("SimpleAsyncInterceptor2_Intercept_AfterInvocation");
- target.Logs[5].ShouldBe("SimpleSyncInterceptor_Intercept_AfterInvocation");
- target.Logs[6].ShouldBe("SimpleAsyncInterceptor_Intercept_AfterInvocation");
- }
-
- [Fact]
- public void Should_Cache_Results()
- {
- //Arrange
-
- var target = ServiceProvider.GetService();
-
- //Act & Assert
-
- target.GetValue(42).ShouldBe(42); //First run, not cached yet
- target.GetValue(43).ShouldBe(42); //First run, cached previous value
- target.GetValue(44).ShouldBe(42); //First run, cached previous value
+ target.Logs[0].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_BeforeInvocation");
+ target.Logs[1].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_BeforeInvocation");
+ target.Logs[2].ShouldBe("EnterGetValueAsync");
+ target.Logs[3].ShouldBe("MiddleGetValueAsync");
+ target.Logs[4].ShouldBe("ExitGetValueAsync");
+ target.Logs[5].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_AfterInvocation");
+ target.Logs[6].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_AfterInvocation");
}
[Fact]
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 f1f868700a..9427298e62 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
@@ -5,14 +5,7 @@ namespace Volo.Abp.DynamicProxy
{
public class SimpleAsyncInterceptor : AbpInterceptor
{
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_Intercept_BeforeInvocation");
- invocation.ProceedAsync();
- (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_Intercept_AfterInvocation");
- }
-
- public override async Task InterceptAsync(IAbpMethodInvocation invocation)
+ public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
await Task.Delay(5);
(invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_InterceptAsync_BeforeInvocation");
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 1712d316a8..e5e4d39790 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
@@ -12,16 +12,7 @@ namespace Volo.Abp.DynamicProxy
{
_cache = new ConcurrentDictionary();
}
-
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- invocation.ReturnValue = _cache.GetOrAdd(invocation.Method, m =>
- {
- invocation.Proceed();
- return invocation.ReturnValue;
- });
- }
-
+
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
if (_cache.ContainsKey(invocation.Method))
diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleSyncInterceptor.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleSyncInterceptor.cs
deleted file mode 100644
index fc43e31525..0000000000
--- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleSyncInterceptor.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Volo.Abp.TestBase.Logging;
-
-namespace Volo.Abp.DynamicProxy
-{
- public class SimpleSyncInterceptor : AbpInterceptor
- {
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_Intercept_BeforeInvocation");
- invocation.Proceed();
- (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_Intercept_AfterInvocation");
- }
- }
-}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj b/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj
index b4fd6fcae5..33bdd870e2 100644
--- a/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj
+++ b/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -13,8 +13,8 @@
-
-
+
+
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj b/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj
index 36a3199bf6..9e7cb21644 100644
--- a/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj
+++ b/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj b/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj
index af8fbd8e37..6c7bcc9ca5 100644
--- a/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj
+++ b/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
index 820a62892e..7e1dd24ae6 100644
--- a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
+++ b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
@@ -239,51 +240,47 @@ namespace Volo.Abp.Domain.Repositories
public class MyTestDefaultRepository : RepositoryBase
where TEntity : class, IEntity
{
- public override TEntity Insert(TEntity entity, bool autoSave = false)
- {
- throw new NotImplementedException();
- }
- public override TEntity Update(TEntity entity, bool autoSave = false)
+ protected override IQueryable GetQueryable()
{
throw new NotImplementedException();
}
- public override void Delete(TEntity entity, bool autoSave = false)
+ public override Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- public override List GetList(bool includeDetails = false)
+ public override Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- public override long GetCount()
+ public override Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- protected override IQueryable GetQueryable()
+ public override Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- }
- public class MyTestDefaultRepository : MyTestDefaultRepository, IRepository
- where TEntity : class, IEntity
- {
- public TEntity Get(TKey id, bool includeDetails = true)
+ public override Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- public Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
+ public override Task GetCountAsync(CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
+ }
- public TEntity Find(TKey id, bool includeDetails = true)
+ public class MyTestDefaultRepository : MyTestDefaultRepository, IRepository
+ where TEntity : class, IEntity
+ {
+ public Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
@@ -293,11 +290,6 @@ namespace Volo.Abp.Domain.Repositories
throw new NotImplementedException();
}
- public void Delete(TKey id, bool autoSave = false)
- {
- throw new NotImplementedException();
- }
-
public Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj b/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj
index 38198cf1bd..3a1b803370 100644
--- a/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj
+++ b/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -18,7 +18,7 @@
-
+
diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/cs.json b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/cs.json
index b03a2b3fb1..5f6e35488e 100644
--- a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/cs.json
+++ b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/cs.json
@@ -1,6 +1,6 @@
{
"culture": "cs",
"texts": {
- "hello": "hello"
+ "hello": "ahoj"
}
}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo.Abp.EntityFrameworkCore.Tests.SecondContext.csproj b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo.Abp.EntityFrameworkCore.Tests.SecondContext.csproj
index bace3a67e5..14d04a597a 100644
--- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo.Abp.EntityFrameworkCore.Tests.SecondContext.csproj
+++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo.Abp.EntityFrameworkCore.Tests.SecondContext.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;truetrue
diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs
index 02142f06d9..80ece93c07 100644
--- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs
+++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore.TestApp.ThirdDbContext;
using Volo.Abp.Modularity;
+using Volo.Abp.Threading;
namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
{
@@ -29,9 +30,9 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
{
using (var scope = context.ServiceProvider.CreateScope())
{
- scope.ServiceProvider
+ AsyncHelper.RunSync(() => scope.ServiceProvider
.GetRequiredService()
- .Build();
+ .BuildAsync());
}
}
}
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 0b89576f34..c65cd8d7f4 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
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
@@ -16,9 +17,9 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
_guidGenerator = guidGenerator;
}
- public void Build()
+ public async Task BuildAsync()
{
- _bookRepository.Insert(
+ await _bookRepository.InsertAsync(
new BookInSecondDbContext(
_guidGenerator.Create(),
"TestBook1"
diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj
index 38b82aca84..a01e3d111a 100644
--- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj
+++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -16,8 +16,8 @@
-
-
+
+
\ 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 8ada582fa6..7bc4af2e31 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
@@ -1,9 +1,11 @@
using System;
+using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EntityFrameworkCore.TestApp.ThirdDbContext;
using Volo.Abp.TestApp.EntityFrameworkCore;
+using Volo.Abp.Uow;
using Xunit;
namespace Volo.Abp.EntityFrameworkCore
@@ -11,19 +13,26 @@ namespace Volo.Abp.EntityFrameworkCore
public class DbContext_Replace_Tests : EntityFrameworkCoreTestBase
{
private readonly IBasicRepository _dummyRepository;
+ private readonly IUnitOfWorkManager _unitOfWorkManager;
public DbContext_Replace_Tests()
{
_dummyRepository = ServiceProvider.GetRequiredService>();
+ _unitOfWorkManager = ServiceProvider.GetRequiredService();
}
[Fact]
- public void Should_Replace_DbContext()
+ public async Task Should_Replace_DbContext()
{
(ServiceProvider.GetRequiredService() is TestAppDbContext).ShouldBeTrue();
- (_dummyRepository.GetDbContext() is IThirdDbContext).ShouldBeTrue();
- (_dummyRepository.GetDbContext() is TestAppDbContext).ShouldBeTrue();
+ using (_unitOfWorkManager.Begin())
+ {
+ (_dummyRepository.GetDbContext() is IThirdDbContext).ShouldBeTrue();
+ (_dummyRepository.GetDbContext() is TestAppDbContext).ShouldBeTrue();
+
+ await _unitOfWorkManager.Current.CompleteAsync();
+ }
}
}
}
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 bd4859784a..a5b8aa0577 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
@@ -1,5 +1,6 @@
using System;
using System.Linq;
+using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
@@ -23,31 +24,34 @@ namespace Volo.Abp.EntityFrameworkCore.Repositories
}
[Fact]
- public void GetBookList()
+ public async Task GetBookList()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
_bookRepository.Any().ShouldBeTrue();
+ return Task.CompletedTask;
});
}
[Fact]
- public void GetPhoneInSecondDbContextList()
+ public async Task GetPhoneInSecondDbContextList()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
_phoneInSecondDbContextRepository.Any().ShouldBeTrue();
+ return Task.CompletedTask;
});
}
[Fact]
- public void EfCore_Include_Extension()
+ public async Task EfCore_Include_Extension()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
var person = PersonRepository.Include(p => p.Phones).Single(p => p.Id == TestDataBuilder.UserDouglasId);
person.Name.ShouldBe("Douglas");
person.Phones.Count.ShouldBe(2);
+ return Task.CompletedTask;
});
}
}
diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj b/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj
index 21c743d4e9..6a7a017f4e 100644
--- a/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj
+++ b/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -12,7 +12,7 @@
-
+
diff --git a/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj b/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj
index f9c04ed5c4..7cf1656de6 100644
--- a/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj
+++ b/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -11,7 +11,7 @@
-
+
diff --git a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/ClassFeatureTestService.cs b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/ClassFeatureTestService.cs
index 425f69337f..13dd19da19 100644
--- a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/ClassFeatureTestService.cs
+++ b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/ClassFeatureTestService.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.DependencyInjection;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Features
{
@@ -10,14 +11,14 @@ namespace Volo.Abp.Features
*/
[RequiresFeature("BooleanTestFeature2")]
- public virtual int Feature2()
+ public virtual Task Feature2Async()
{
- return 42;
+ return Task.FromResult(42);
}
- public virtual void NoAdditionalFeature()
+ public virtual Task NoAdditionalFeatureAsync()
{
-
+ return Task.CompletedTask;
}
}
}
\ No newline at end of file
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 159e2ff241..bdc17a1d5f 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
@@ -27,14 +27,14 @@ namespace Volo.Abp.Features
{
using (_currentTenant.Change(ParseNullableGuid(tenantIdValue)))
{
- Assert.Throws(() =>
+ await Assert.ThrowsAsync(async () =>
{
- _classFeatureTestService.NoAdditionalFeature();
+ await _classFeatureTestService.NoAdditionalFeatureAsync();
});
- Assert.Throws(() =>
+ await Assert.ThrowsAsync(async () =>
{
- _classFeatureTestService.Feature2();
+ await _classFeatureTestService.Feature2Async();
});
await Assert.ThrowsAsync(async () =>
@@ -50,8 +50,8 @@ namespace Volo.Abp.Features
//Features were enabled for Tenant 1
using (_currentTenant.Change(TestFeatureStore.Tenant1Id))
{
- _classFeatureTestService.NoAdditionalFeature();
- _classFeatureTestService.Feature2().ShouldBe(42);
+ await _classFeatureTestService.NoAdditionalFeatureAsync();
+ (await _classFeatureTestService.Feature2Async()).ShouldBe(42);
(await _methodFeatureTestService.Feature1Async()).ShouldBe(42);
}
}
diff --git a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/TestFeatureStore.cs b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/TestFeatureStore.cs
index 4592a18365..87fef33a8d 100644
--- a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/TestFeatureStore.cs
+++ b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/TestFeatureStore.cs
@@ -20,9 +20,9 @@ namespace Volo.Abp.Features
{
_settingRecords = new List
{
- new SettingRecord("BooleanTestFeature1", TenantFeatureValueProvider.ProviderName, Tenant1Id.ToString("N"), "true"),
- new SettingRecord("BooleanTestFeature2", TenantFeatureValueProvider.ProviderName, Tenant1Id.ToString("N"), "true"),
- new SettingRecord("IntegerTestFeature1", TenantFeatureValueProvider.ProviderName, Tenant2Id.ToString("N"), "34")
+ new SettingRecord("BooleanTestFeature1", TenantFeatureValueProvider.ProviderName, Tenant1Id.ToString(), "true"),
+ new SettingRecord("BooleanTestFeature2", TenantFeatureValueProvider.ProviderName, Tenant1Id.ToString(), "true"),
+ new SettingRecord("IntegerTestFeature1", TenantFeatureValueProvider.ProviderName, Tenant2Id.ToString(), "34")
};
}
diff --git a/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj b/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj
index cdcb8b0b25..7f62578e7d 100644
--- a/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj
+++ b/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -11,7 +11,7 @@
-
+
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 0cde05efd4..82541a5aa4 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
@@ -1,3 +1,4 @@
+using System.Linq;
using System.Threading.Tasks;
using FluentValidation;
using Microsoft.Extensions.DependencyInjection;
@@ -27,21 +28,6 @@ namespace Volo.Abp.FluentValidation
[Fact]
public async Task Should_Work_Proper_With_Right_Inputs()
{
- // MyStringValue should be aaa, MyStringValue2 should be bbb. MyStringValue3 should be ccc
- var output = _myAppService.MyMethod(new MyMethodInput
- {
- MyStringValue = "aaa",
- MyMethodInput2 = new MyMethodInput2
- {
- MyStringValue2 = "bbb"
- },
- MyMethodInput3 = new MyMethodInput3
- {
- MyStringValue3 = "ccc"
- }
- });
- output.ShouldBe("aaabbbccc");
-
var asyncOutput = await _myAppService.MyMethodAsync(new MyMethodInput
{
MyStringValue = "aaa",
@@ -63,20 +49,28 @@ namespace Volo.Abp.FluentValidation
{
// MyStringValue should be aaa, MyStringValue2 should be bbb. MyStringValue3 should be ccc
- Assert.Throws(() => _myAppService.MyMethod(new MyMethodInput
- {
- MyStringValue = "a",
- MyMethodInput2 = new MyMethodInput2
- {
- MyStringValue2 = "b"
- },
- MyMethodInput3 = new MyMethodInput3
- {
- MyStringValue3 = "c"
- }
- }));
-
- await Assert.ThrowsAsync(async () => await _myAppService.MyMethodAsync(
+ var exception = await Assert.ThrowsAsync(
+ async () => await _myAppService.MyMethodAsync(
+ new MyMethodInput
+ {
+ MyStringValue = "a",
+ MyMethodInput2 = new MyMethodInput2
+ {
+ MyStringValue2 = "b"
+ },
+ MyMethodInput3 = new MyMethodInput3
+ {
+ MyStringValue3 = "c"
+ }
+ }
+ )
+ );
+
+ 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"));
+
+ exception = await Assert.ThrowsAsync(async () => await _myAppService.MyMethodAsync(
new MyMethodInput
{
MyStringValue = "a",
@@ -89,12 +83,15 @@ namespace Volo.Abp.FluentValidation
MyStringValue3 = "c"
}
}));
+ 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"));
}
[Fact]
- public void NotValidateMyMethod_Test()
+ public async Task NotValidateMyMethod_Test()
{
- var output = _myAppService.NotValidateMyMethod(new MyMethodInput4
+ var output = await _myAppService.NotValidateMyMethod(new MyMethodInput4
{
MyStringValue4 = "444"
});
@@ -125,29 +122,22 @@ namespace Volo.Abp.FluentValidation
public interface IMyAppService
{
- string MyMethod(MyMethodInput input);
-
Task MyMethodAsync(MyMethodInput input);
- string NotValidateMyMethod(MyMethodInput4 input);
+ Task NotValidateMyMethod(MyMethodInput4 input);
}
public class MyAppService : IMyAppService, ITransientDependency
{
- public string MyMethod(MyMethodInput input)
- {
- return input.MyStringValue + input.MyMethodInput2.MyStringValue2 + input.MyMethodInput3.MyStringValue3;
- }
-
public Task MyMethodAsync(MyMethodInput input)
{
return Task.FromResult(input.MyStringValue + input.MyMethodInput2.MyStringValue2 +
input.MyMethodInput3.MyStringValue3);
}
- public string NotValidateMyMethod(MyMethodInput4 input)
+ public Task NotValidateMyMethod(MyMethodInput4 input)
{
- return input.MyStringValue4;
+ return Task.FromResult(input.MyStringValue4);
}
}
diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj b/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj
index 7e84f08807..db0f9d45bf 100644
--- a/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj
+++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -11,7 +11,7 @@
-
+
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/IRegularTestController.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/IRegularTestController.cs
index cd8c92c66d..0e7b9d9163 100644
--- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/IRegularTestController.cs
+++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/IRegularTestController.cs
@@ -4,8 +4,6 @@ namespace Volo.Abp.Http.DynamicProxying
{
public interface IRegularTestController
{
- int IncrementValue(int value);
-
Task IncrementValueAsync(int value);
Task GetException1Async();
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 2df9ad62a1..0c75fc68ff 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
@@ -27,7 +27,7 @@ namespace Volo.Abp.Http.DynamicProxying
[Fact]
public async Task Get()
{
- var firstPerson = _personRepository.First();
+ var firstPerson = (await _personRepository.GetListAsync()).First();
var person = await _peopleAppService.GetAsync(firstPerson.Id);
person.ShouldNotBeNull();
@@ -46,11 +46,11 @@ namespace Volo.Abp.Http.DynamicProxying
[Fact]
public async Task Delete()
{
- var firstPerson = _personRepository.First();
+ var firstPerson = (await _personRepository.GetListAsync()).First();
await _peopleAppService.DeleteAsync(firstPerson.Id);
- firstPerson = _personRepository.FirstOrDefault(p => p.Id == firstPerson.Id);
+ firstPerson = (await _personRepository.GetListAsync()).FirstOrDefault(p => p.Id == firstPerson.Id);
firstPerson.ShouldBeNull();
}
@@ -70,7 +70,7 @@ namespace Volo.Abp.Http.DynamicProxying
person.Id.ShouldNotBe(Guid.Empty);
person.Name.ShouldBe(uniquePersonName);
- var personInDb = _personRepository.FirstOrDefault(p => p.Name == uniquePersonName);
+ var personInDb = (await _personRepository.GetListAsync()).FirstOrDefault(p => p.Name == uniquePersonName);
personInDb.ShouldNotBeNull();
personInDb.Id.ShouldBe(person.Id);
}
@@ -78,7 +78,7 @@ namespace Volo.Abp.Http.DynamicProxying
[Fact]
public async Task Update()
{
- var firstPerson = _personRepository.First();
+ var firstPerson = (await _personRepository.GetListAsync()).First();
var uniquePersonName = Guid.NewGuid().ToString();
var person = await _peopleAppService.UpdateAsync(
@@ -96,7 +96,7 @@ namespace Volo.Abp.Http.DynamicProxying
person.Name.ShouldBe(uniquePersonName);
person.Age.ShouldBe(firstPerson.Age);
- var personInDb = _personRepository.FirstOrDefault(p => p.Id == firstPerson.Id);
+ var personInDb = (await _personRepository.GetListAsync()).FirstOrDefault(p => p.Id == firstPerson.Id);
personInDb.ShouldNotBeNull();
personInDb.Id.ShouldBe(person.Id);
personInDb.Name.ShouldBe(person.Name);
diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestController.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestController.cs
index 34f8c5820d..717b62701e 100644
--- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestController.cs
+++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestController.cs
@@ -11,13 +11,6 @@ namespace Volo.Abp.Http.DynamicProxying
//[ApiExplorerSettings(IgnoreApi = false)] //alternative
public class RegularTestController : AbpController, IRegularTestController
{
- [HttpGet]
- [Route("increment/{value}")] //full URL: .../api/regular-test-controller/increment/{value}
- public int IncrementValue(int value)
- {
- return value + 1;
- }
-
[HttpGet]
[Route("increment")]
public Task IncrementValueAsync(int value)
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 22d9354624..cabbac6775 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
@@ -17,12 +17,6 @@ namespace Volo.Abp.Http.DynamicProxying
_controller = ServiceProvider.GetRequiredService();
}
- [Fact]
- public void IncrementValue()
- {
- _controller.IncrementValue(42).ShouldBe(43);
- }
-
[Fact]
public async Task IncrementValueAsync()
{
diff --git a/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj b/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj
index 086aba2bc6..8f803774b2 100644
--- a/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj
+++ b/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj
@@ -3,12 +3,12 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj b/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj
index c380bfaafe..b3afc78948 100644
--- a/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj
+++ b/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -14,7 +14,7 @@
-
+
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 eab7a580c5..46f34e054d 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
@@ -66,6 +66,12 @@ namespace Volo.Abp.Localization
{
_localizer["Car"].Value.ShouldBe("Auto");
}
+
+ using (AbpCultureHelper.Use("es"))
+ {
+ _localizer["Car"].Value.ShouldBe("Auto");
+ }
+
}
[Fact]
@@ -85,6 +91,12 @@ namespace Volo.Abp.Localization
{
_localizer["SeeYou"].Value.ShouldBe("Ci vediamo");
}
+
+ using (AbpCultureHelper.Use("es"))
+ {
+ _localizer["SeeYou"].Value.ShouldBe("Nos vemos");
+ }
+
}
[Fact]
@@ -102,6 +114,15 @@ namespace Volo.Abp.Localization
{
_localizer["USA"].Value.ShouldBe("Amerika Birleşik Devletleri"); //Inherited from CountryNames/tr.json
}
+
+ using (AbpCultureHelper.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
+
+ _localizer.GetAllStrings().ShouldContain(ls => ls.Name == "USA");
+ }
+
}
[Fact]
@@ -111,6 +132,13 @@ namespace Volo.Abp.Localization
{
_localizer["MaxLenghtErrorMessage", 42].Value.ShouldBe("This field's length can be maximum of '42' chars"); //Overriden in Source/en.json
}
+
+ using (AbpCultureHelper.Use("es"))
+ {
+ _localizer["MaxLenghtErrorMessage", 42].Value.ShouldBe("El campo puede tener un máximo de '42' caracteres"); //Overriden in Source/es.json
+ }
+
+
}
[Fact]
@@ -121,6 +149,10 @@ namespace Volo.Abp.Localization
_localizer.WithCulture(CultureInfo.GetCultureInfo("tr"))["Car"].Value.ShouldBe("Araba");
_localizer.WithCulture(CultureInfo.GetCultureInfo("tr"))["CarPlural"].Value.ShouldBe("Araba");
+
+ _localizer.WithCulture(CultureInfo.GetCultureInfo("es"))["Car"].Value.ShouldBe("Auto");
+ _localizer.WithCulture(CultureInfo.GetCultureInfo("es"))["CarPlural"].Value.ShouldBe("Autos");
+
}
[Fact]
@@ -142,6 +174,24 @@ namespace Volo.Abp.Localization
ls.ResourceNotFound == false
);
}
+
+ using (AbpCultureHelper.Use("es"))
+ {
+ var localizedStrings = _localizer.GetAllStrings(true).ToList();
+
+ localizedStrings.ShouldContain(
+ ls => ls.Name == "FortyTwo" &&
+ ls.Value == "Curenta y dos" &&
+ ls.ResourceNotFound == false
+ );
+
+ localizedStrings.ShouldContain(
+ ls => ls.Name == "Universe" &&
+ ls.Value == "Universo" &&
+ ls.ResourceNotFound == false
+ );
+ }
+
}
[Fact]
@@ -161,6 +211,22 @@ namespace Volo.Abp.Localization
ls.ResourceNotFound == false
);
}
+
+ using (AbpCultureHelper.Use("es"))
+ {
+ var localizedStrings = _localizer.GetAllStrings(false).ToList();
+
+ localizedStrings.ShouldNotContain(
+ ls => ls.Name == "FortyThree"
+ );
+
+ localizedStrings.ShouldContain(
+ ls => ls.Name == "Universe" &&
+ ls.Value == "Universo" &&
+ ls.ResourceNotFound == false
+ );
+ }
+
}
[Fact]
diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/CountryNames/es.json b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/CountryNames/es.json
new file mode 100644
index 0000000000..d9b29895b8
--- /dev/null
+++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/CountryNames/es.json
@@ -0,0 +1,7 @@
+{
+ "culture": "es",
+ "texts": {
+ "USA": "Estados unidos de América",
+ "Brazil": "Brasil"
+ }
+}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/Validation/es.json b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/Validation/es.json
new file mode 100644
index 0000000000..04e85b5f12
--- /dev/null
+++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/Validation/es.json
@@ -0,0 +1,7 @@
+{
+ "culture": "es",
+ "texts": {
+ "ThisFieldIsRequired": "El campo no puede estar vacío",
+ "MaxLenghtErrorMessage": "El campo puede tener un máximo de '{0}' caracteres"
+ }
+}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Source/es.json b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Source/es.json
new file mode 100644
index 0000000000..7b68ff6f2c
--- /dev/null
+++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Source/es.json
@@ -0,0 +1,11 @@
+{
+ "culture": "es",
+ "texts": {
+ "Hello {0}.": "Hola {0}.",
+ "Car": "Auto",
+ "CarPlural": "Autos",
+ "MaxLenghtErrorMessage": "El campo puede tener un máximo de '{0}' caracteres",
+ "Universe": "Universo",
+ "FortyTwo": "Curenta y dos"
+ }
+}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/SourceExt/es.json b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/SourceExt/es.json
new file mode 100644
index 0000000000..f02a049420
--- /dev/null
+++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/SourceExt/es.json
@@ -0,0 +1,6 @@
+{
+ "culture": "es",
+ "texts": {
+ "SeeYou": "Nos vemos"
+ }
+}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj b/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj
index df995f0bd1..b8f417d384 100644
--- a/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj
+++ b/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -11,7 +11,7 @@
-
+
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj b/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj
index 2301d45fcf..ad478b062a 100644
--- a/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj
+++ b/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -12,7 +12,7 @@
-
+
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Minify.Tests/Volo.Abp.Minify.Tests.csproj b/framework/test/Volo.Abp.Minify.Tests/Volo.Abp.Minify.Tests.csproj
index 57a7f4ea01..5d07377aa1 100644
--- a/framework/test/Volo.Abp.Minify.Tests/Volo.Abp.Minify.Tests.csproj
+++ b/framework/test/Volo.Abp.Minify.Tests/Volo.Abp.Minify.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj b/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj
index 65dace823e..cc1cb52a96 100644
--- a/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj
+++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -16,7 +16,7 @@
-
+
\ No newline at end of file
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 72774be545..efa64b3617 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
@@ -12,11 +12,14 @@ namespace Volo.Abp.MongoDB.Repositories
public class Repository_Basic_Tests : Repository_Basic_Tests
{
[Fact]
- public void Linq_Queries()
+ public async Task Linq_Queries()
{
- PersonRepository.FirstOrDefault(p => p.Name == "Douglas").ShouldNotBeNull();
-
- PersonRepository.Count().ShouldBeGreaterThan(0);
+ await WithUnitOfWorkAsync(() =>
+ {
+ PersonRepository.FirstOrDefault(p => p.Name == "Douglas").ShouldNotBeNull();
+ PersonRepository.Count().ShouldBeGreaterThan(0);
+ return Task.CompletedTask;
+ });
}
[Fact]
diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests_With_Int_Pk.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests_With_Int_Pk.cs
index 58914e8e50..c5885dfb4d 100644
--- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests_With_Int_Pk.cs
+++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests_With_Int_Pk.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.TestApp.Testing;
+using System.Threading.Tasks;
+using Volo.Abp.TestApp.Testing;
using Xunit;
namespace Volo.Abp.MongoDB.Repositories
@@ -6,9 +7,9 @@ namespace Volo.Abp.MongoDB.Repositories
public class Repository_Basic_Tests_With_Int_Pk : Repository_Basic_Tests_With_Int_Pk
{
[Fact(Skip = "Int PKs are not working for MongoDb")]
- public override void Get()
+ public override Task Get()
{
-
+ return Task.CompletedTask;
}
}
}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj b/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj
index 2d870fdc1d..808b58409e 100644
--- a/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj
+++ b/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj b/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj
index b4153300f6..a77a4e3301 100644
--- a/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj
+++ b/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj b/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj
index 6af4ddbac9..7688e0c040 100644
--- a/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj
+++ b/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj b/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj
index 3831500779..c973b4fcd1 100644
--- a/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj
+++ b/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj b/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj
index 8c460d0b74..183b0b6c81 100644
--- a/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj
+++ b/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -11,7 +11,7 @@
-
+
diff --git a/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj b/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj
index 9dc2245b22..6b836d2efe 100644
--- a/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj
+++ b/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj b/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj
index 19d8be4d2e..1d54a745ab 100644
--- a/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj
+++ b/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj
@@ -3,13 +3,13 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj b/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj
index f1c2b2107f..522d166014 100644
--- a/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj
+++ b/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -14,7 +14,7 @@
-
+
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 afe0f536d4..522f8d9794 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
@@ -13,7 +13,7 @@ namespace Volo.Abp.TestApp.Application
{
public class PeopleAppService : CrudAppService, IPeopleAppService
{
- public PeopleAppService(IRepository repository)
+ public PeopleAppService(IRepository repository)
: base(repository)
{
@@ -36,7 +36,7 @@ namespace Volo.Abp.TestApp.Application
var phone = new Phone(person.Id, phoneDto.Number, phoneDto.Type);
person.Phones.Add(phone);
- Repository.Update(person);
+ await Repository.UpdateAsync(person);
return ObjectMapper.Map(phone);
}
@@ -44,7 +44,7 @@ namespace Volo.Abp.TestApp.Application
{
var person = await GetEntityByIdAsync(id);
person.Phones.RemoveAll(p => p.Number == number);
- Repository.Update(person);
+ await Repository.UpdateAsync(person);
}
[Authorize]
diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs
index b9aef1ca2e..683c99d417 100644
--- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs
+++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs
@@ -6,6 +6,7 @@ using Volo.Abp.TestApp.Domain;
using Volo.Abp.AutoMapper;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.TestApp.Application.Dto;
+using Volo.Abp.Threading;
namespace Volo.Abp.TestApp
{
@@ -54,9 +55,9 @@ namespace Volo.Abp.TestApp
{
using (var scope = context.ServiceProvider.CreateScope())
{
- scope.ServiceProvider
+ AsyncHelper.RunSync(() => scope.ServiceProvider
.GetRequiredService()
- .Build();
+ .BuildAsync());
}
}
}
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 8900d8cfdf..a11ba60639 100644
--- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs
+++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.TestApp.Domain;
@@ -29,53 +30,53 @@ namespace Volo.Abp.TestApp
_entityWithIntPksRepository = entityWithIntPksRepository;
}
- public void Build()
+ public async Task BuildAsync()
{
- AddCities();
- AddPeople();
- AddEntitiesWithPks();
+ await AddCities();
+ await AddPeople();
+ await AddEntitiesWithPks();
}
- private void AddCities()
+ private async Task AddCities()
{
var istanbul = new City(IstanbulCityId, "Istanbul");
istanbul.Districts.Add(new District(istanbul.Id, "Bakirkoy", 1283999));
istanbul.Districts.Add(new District(istanbul.Id, "Mecidiyeköy", 2222321));
istanbul.Districts.Add(new District(istanbul.Id, "Uskudar", 726172));
- _cityRepository.Insert(new City(Guid.NewGuid(), "Tokyo"));
- _cityRepository.Insert(new City(Guid.NewGuid(), "Madrid"));
- _cityRepository.Insert(new City(LondonCityId, "London") {ExtraProperties = { { "Population", 10_470_000 } } });
- _cityRepository.Insert(istanbul);
- _cityRepository.Insert(new City(Guid.NewGuid(), "Paris"));
- _cityRepository.Insert(new City(Guid.NewGuid(), "Washington"));
- _cityRepository.Insert(new City(Guid.NewGuid(), "Sao Paulo"));
- _cityRepository.Insert(new City(Guid.NewGuid(), "Berlin"));
- _cityRepository.Insert(new City(Guid.NewGuid(), "Amsterdam"));
- _cityRepository.Insert(new City(Guid.NewGuid(), "Beijing"));
- _cityRepository.Insert(new City(Guid.NewGuid(), "Rome"));
+ 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"));
}
- private void AddPeople()
+ private async Task AddPeople()
{
var douglas = new Person(UserDouglasId, "Douglas", 42, cityId: LondonCityId);
douglas.Phones.Add(new Phone(douglas.Id, "123456789"));
douglas.Phones.Add(new Phone(douglas.Id, "123456780", PhoneType.Home));
- _personRepository.Insert(douglas);
+ await _personRepository.InsertAsync(douglas);
- _personRepository.Insert(new Person(UserJohnDeletedId, "John-Deleted", 33) { IsDeleted = true });
+ await _personRepository.InsertAsync(new Person(UserJohnDeletedId, "John-Deleted", 33) { IsDeleted = true });
var tenant1Person1 = new Person(Guid.NewGuid(), TenantId1 + "-Person1", 42, TenantId1);
var tenant1Person2 = new Person(Guid.NewGuid(), TenantId1 + "-Person2", 43, TenantId1);
- _personRepository.Insert(tenant1Person1);
- _personRepository.Insert(tenant1Person2);
+ await _personRepository.InsertAsync(tenant1Person1);
+ await _personRepository.InsertAsync(tenant1Person2);
}
- private void AddEntitiesWithPks()
+ private async Task AddEntitiesWithPks()
{
- _entityWithIntPksRepository.Insert(new EntityWithIntPk("Entity1"));
+ await _entityWithIntPksRepository.InsertAsync(new EntityWithIntPk("Entity1"));
}
}
}
\ No newline at end of file
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 184b7698be..fe4e0862f3 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
@@ -28,7 +28,7 @@ namespace Volo.Abp.TestApp.Testing
}
[Fact]
- public void Complex_Event_Test()
+ public async Task Complex_Event_Test()
{
var personName = Guid.NewGuid().ToString("N");
@@ -75,9 +75,9 @@ namespace Volo.Abp.TestApp.Testing
return Task.CompletedTask;
});
- PersonRepository.Insert(new Person(Guid.NewGuid(), personName, 15));
+ await PersonRepository.InsertAsync(new Person(Guid.NewGuid(), personName, 15));
- uow.Complete();
+ await uow.CompleteAsync();
}
creatingEventTriggered.ShouldBeTrue();
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 d763fdea5b..da3e33ffea 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
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using NSubstitute;
using Shouldly;
@@ -33,9 +34,9 @@ namespace Volo.Abp.TestApp.Testing
}
[Fact]
- public void Should_Get_Person_For_Current_Tenant()
+ public async Task Should_Get_Person_For_Current_Tenant()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
//TenantId = null
@@ -60,13 +61,15 @@ namespace Volo.Abp.TestApp.Testing
people = _personRepository.ToList();
people.Count.ShouldBe(0);
+
+ return Task.CompletedTask;
});
}
[Fact]
- public void Should_Get_All_People_When_MultiTenant_Filter_Is_Disabled()
+ public async Task Should_Get_All_People_When_MultiTenant_Filter_Is_Disabled()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
List people;
@@ -80,6 +83,8 @@ namespace Volo.Abp.TestApp.Testing
//Filter re-enabled automatically
people = _personRepository.ToList();
people.Count.ShouldBe(1);
+
+ return Task.CompletedTask;
});
}
}
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 f8a2f4e8e9..f873fe4265 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
@@ -1,4 +1,5 @@
using System.Linq;
+using System.Threading.Tasks;
using Shouldly;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Modularity;
@@ -18,22 +19,23 @@ namespace Volo.Abp.TestApp.Testing
}
[Fact]
- public virtual void FirstOrDefault()
+ public virtual async Task FirstOrDefault()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
var entity = EntityWithIntPkRepository.FirstOrDefault(e => e.Name == "Entity1");
entity.ShouldNotBeNull();
entity.Name.ShouldBe("Entity1");
+ return Task.CompletedTask;
});
}
[Fact]
- public virtual void Get()
+ public virtual async Task Get()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(async () =>
{
- var entity = EntityWithIntPkRepository.Get(1);
+ var entity = await EntityWithIntPkRepository.GetAsync(1);
entity.ShouldNotBeNull();
entity.Name.ShouldBe("Entity1");
});
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 b7436f7bc5..6078236380 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
@@ -1,5 +1,6 @@
using System;
using System.Linq;
+using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Domain.Repositories;
@@ -20,43 +21,47 @@ namespace Volo.Abp.TestApp.Testing
}
[Fact]
- public void Any()
+ public async Task Any()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
PersonRepository.Any().ShouldBeTrue();
+ return Task.CompletedTask;
});
}
[Fact]
- public void Single()
+ public async Task Single()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
var person = PersonRepository.Single(p => p.Id == TestDataBuilder.UserDouglasId);
person.Name.ShouldBe("Douglas");
+ return Task.CompletedTask;
});
}
[Fact]
- public void WithDetails()
+ public async Task WithDetails()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
var person = PersonRepository.WithDetails().Single(p => p.Id == TestDataBuilder.UserDouglasId);
person.Name.ShouldBe("Douglas");
person.Phones.Count.ShouldBe(2);
+ return Task.CompletedTask;
});
}
[Fact]
- public void WithDetails_Explicit()
+ public async Task WithDetails_Explicit()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
var person = PersonRepository.WithDetails(p => p.Phones).Single(p => p.Id == TestDataBuilder.UserDouglasId);
person.Name.ShouldBe("Douglas");
person.Phones.Count.ShouldBe(2);
+ return Task.CompletedTask;
});
}
}
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 a3e7907135..c26134b27c 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
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Linq.Expressions;
+using System.Threading.Tasks;
using Shouldly;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Modularity;
@@ -21,11 +22,12 @@ namespace Volo.Abp.TestApp.Testing
}
[Fact]
- public void SpecificationWithRepository_Test()
+ public async Task SpecificationWithRepository_Test()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
CityRepository.Count(new CitySpecification().ToExpression()).ShouldBe(1);
+ return Task.CompletedTask;
});
}
}
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 891691114e..f3ac8c301f 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
@@ -23,12 +23,13 @@ namespace Volo.Abp.TestApp.Testing
}
[Fact]
- public void Should_Not_Get_Deleted_Entities_Linq()
+ public async Task Should_Not_Get_Deleted_Entities_Linq()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
var person = PersonRepository.FirstOrDefault(p => p.Name == "John-Deleted");
person.ShouldBeNull();
+ return Task.CompletedTask;
});
}
@@ -43,20 +44,21 @@ namespace Volo.Abp.TestApp.Testing
}
[Fact]
- public void Should_Not_Get_Deleted_Entities_By_Default_ToList()
+ public async Task Should_Not_Get_Deleted_Entities_By_Default_ToList()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
var people = PersonRepository.ToList();
people.Count.ShouldBe(1);
people.Any(p => p.Name == "Douglas").ShouldBeTrue();
+ return Task.CompletedTask;
});
}
[Fact]
- public void Should_Get_Deleted_Entities_When_Filter_Is_Disabled()
+ public async Task Should_Get_Deleted_Entities_When_Filter_Is_Disabled()
{
- WithUnitOfWork(() =>
+ await WithUnitOfWorkAsync(() =>
{
//Soft delete is enabled by default
var people = PersonRepository.ToList();
@@ -88,6 +90,8 @@ namespace Volo.Abp.TestApp.Testing
people = PersonRepository.ToList();
people.Any(p => !p.IsDeleted).ShouldBeTrue();
people.Any(p => p.IsDeleted).ShouldBeFalse();
+
+ return Task.CompletedTask;
});
}
}
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 647e5eaa03..9f7ef1b34b 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
@@ -16,26 +16,6 @@ namespace Volo.Abp.TestApp.Testing
#region WithUnitOfWork
- protected virtual void WithUnitOfWork(Action action)
- {
- WithUnitOfWork(new AbpUnitOfWorkOptions(), action);
- }
-
- protected virtual void WithUnitOfWork(AbpUnitOfWorkOptions options, Action action)
- {
- using (var scope = ServiceProvider.CreateScope())
- {
- var uowManager = scope.ServiceProvider.GetRequiredService();
-
- using (var uow = uowManager.Begin(options))
- {
- action();
-
- uow.Complete();
- }
- }
- }
-
protected virtual Task WithUnitOfWorkAsync(Func func)
{
return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func);
@@ -56,26 +36,6 @@ namespace Volo.Abp.TestApp.Testing
}
}
- protected virtual TResult WithUnitOfWork(Func func)
- {
- return WithUnitOfWork(new AbpUnitOfWorkOptions(), func);
- }
-
- protected virtual TResult WithUnitOfWork(AbpUnitOfWorkOptions options, Func func)
- {
- using (var scope = ServiceProvider.CreateScope())
- {
- var uowManager = scope.ServiceProvider.GetRequiredService();
-
- using (var uow = uowManager.Begin(options))
- {
- var result = func();
- uow.Complete();
- return result;
- }
- }
- }
-
protected virtual Task WithUnitOfWorkAsync(Func> func)
{
return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func);
diff --git a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj
index 4ef9291f5e..51beb181a1 100644
--- a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj
+++ b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj b/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj
index 827c34823d..256dd07ed6 100644
--- a/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj
+++ b/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj
@@ -3,14 +3,14 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
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 4d9bfc8dd6..0da84a04a9 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
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Xunit;
@@ -15,7 +16,7 @@ namespace Volo.Abp.Uow
}
[Fact]
- public void Should_Trigger_Complete_On_Success()
+ public async Task Should_Trigger_Complete_On_Success()
{
var completed = false;
var disposed = false;
@@ -25,7 +26,7 @@ namespace Volo.Abp.Uow
uow.OnCompleted(async () => completed = true);
uow.Disposed += (sender, args) => disposed = true;
- uow.Complete();
+ await uow.CompleteAsync();
completed.ShouldBeTrue();
}
@@ -34,7 +35,7 @@ namespace Volo.Abp.Uow
}
[Fact]
- public void Should_Trigger_Complete_On_Success_In_Child_Uow()
+ public async Task Should_Trigger_Complete_On_Success_In_Child_Uow()
{
var completed = false;
var disposed = false;
@@ -46,7 +47,7 @@ namespace Volo.Abp.Uow
childUow.OnCompleted(async () => completed = true);
uow.Disposed += (sender, args) => disposed = true;
- childUow.Complete();
+ await childUow.CompleteAsync();
completed.ShouldBeFalse(); //Parent has not been completed yet!
disposed.ShouldBeFalse();
@@ -55,7 +56,7 @@ namespace Volo.Abp.Uow
completed.ShouldBeFalse(); //Parent has not been completed yet!
disposed.ShouldBeFalse();
- uow.Complete();
+ await uow.CompleteAsync();
completed.ShouldBeTrue(); //It's completed now!
disposed.ShouldBeFalse(); //But not disposed yet!
@@ -110,7 +111,7 @@ namespace Volo.Abp.Uow
[InlineData(true)]
[InlineData(false)]
[Theory]
- public void Should_Trigger_Failed_If_Rolled_Back(bool callComplete)
+ public async Task Should_Trigger_Failed_If_Rolled_Back(bool callComplete)
{
var completed = false;
var failed = false;
@@ -122,11 +123,11 @@ namespace Volo.Abp.Uow
uow.Failed += (sender, args) => { failed = true; args.IsRolledback.ShouldBeTrue(); };
uow.Disposed += (sender, args) => disposed = true;
- uow.Rollback();
+ await uow.RollbackAsync();
if (callComplete)
{
- uow.Complete();
+ await uow.CompleteAsync();
}
}
diff --git a/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj b/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj
index 1c18850d00..a16495ccda 100644
--- a/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj
+++ b/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj
@@ -3,15 +3,16 @@
- netcoreapp3.0
+ netcoreapp3.1
+
-
+
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 8ff4aa8bfd..2028ea60ca 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
@@ -1,8 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
+using Volo.Abp.Application.Dtos;
using Volo.Abp.Autofac;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Modularity;
@@ -25,36 +28,37 @@ namespace Volo.Abp.Validation
}
[Fact]
- public void Should_Work_Proper_With_Right_Inputs()
+ public async Task Should_Work_Proper_With_Right_Inputs()
{
- var output = _myAppService.MyMethod(new MyMethodInput { MyStringValue = "test" });
+ var output = await _myAppService.MyMethod(new MyMethodInput { MyStringValue = "test" });
output.Result.ShouldBe(42);
}
[Fact]
- public void Should_Not_Work_With_Wrong_Inputs()
+ public async Task Should_Not_Work_With_Wrong_Inputs()
{
- Assert.Throws(() => _myAppService.MyMethod(new MyMethodInput())); //MyStringValue is not supplied!
- Assert.Throws(() => _myAppService.MyMethod(new MyMethodInput { MyStringValue = "a" })); //MyStringValue's min length should be 3!
+ 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!
}
[Fact]
- public void Should_Work_With_Right_Nesned_Inputs()
+ public async Task Should_Work_With_Right_Nesned_Inputs()
{
- var output = _myAppService.MyMethod2(new MyMethod2Input
+ var output = await _myAppService.MyMethod2(new MyMethod2Input
{
MyStringValue2 = "test 1",
Input1 = new MyMethodInput { MyStringValue = "test 2" },
DateTimeValue = DateTime.Now
});
+
output.Result.ShouldBe(42);
}
[Fact]
- public void Should_Not_Work_With_Wrong_Nesned_Inputs_1()
+ public async Task Should_Not_Work_With_Wrong_Nesned_Inputs_1()
{
- Assert.Throws(() =>
- _myAppService.MyMethod2(new MyMethod2Input
+ await Assert.ThrowsAsync(async () =>
+ await _myAppService.MyMethod2(new MyMethod2Input
{
MyStringValue2 = "test 1",
Input1 = new MyMethodInput() //MyStringValue is not set
@@ -62,20 +66,20 @@ namespace Volo.Abp.Validation
}
[Fact]
- public void Should_Not_Work_With_Wrong_Nesned_Inputs_2()
+ public async Task Should_Not_Work_With_Wrong_Nesned_Inputs_2()
{
- Assert.Throws(() =>
- _myAppService.MyMethod2(new MyMethod2Input //Input1 is not set
+ await Assert.ThrowsAsync(async () =>
+ await _myAppService.MyMethod2(new MyMethod2Input //Input1 is not set
{
MyStringValue2 = "test 1"
}));
}
[Fact]
- public void Should_Not_Work_With_Wrong_List_Input_1()
+ public async Task Should_Not_Work_With_Wrong_List_Input_1()
{
- Assert.Throws(() =>
- _myAppService.MyMethod3(
+ await Assert.ThrowsAsync(async () =>
+ await _myAppService.MyMethod3(
new MyMethod3Input
{
MyStringValue2 = "test 1",
@@ -87,10 +91,10 @@ namespace Volo.Abp.Validation
}
[Fact]
- public void Should_Not_Work_With_Wrong_Array_Input_1()
+ public async Task Should_Not_Work_With_Wrong_Array_Input_1()
{
- Assert.Throws(() =>
- _myAppService.MyMethod3(
+ await Assert.ThrowsAsync(async () =>
+ await _myAppService.MyMethod3(
new MyMethod3Input
{
MyStringValue2 = "test 1",
@@ -102,47 +106,71 @@ namespace Volo.Abp.Validation
}
[Fact]
- public void Should_Not_Work_If_Array_Is_Null()
+ public async Task Should_Not_Work_If_Array_Is_Null()
{
- Assert.Throws(() =>
- _myAppService.MyMethod4(new MyMethod4Input()) //ArrayItems is null!
+ await Assert.ThrowsAsync(async () =>
+ await _myAppService.MyMethod4(new MyMethod4Input()) //ArrayItems is null!
);
}
[Fact]
- public void Should_Work_If_Array_Is_Null_But_DisabledValidation_For_Method()
+ public async Task Should_Work_If_Array_Is_Null_But_DisabledValidation_For_Method()
{
- _myAppService.MyMethod4_2(new MyMethod4Input());
+ await _myAppService.MyMethod4_2(new MyMethod4Input());
}
[Fact]
- public void Should_Work_If_Array_Is_Null_But_DisabledValidation_For_Property()
+ public async Task Should_Work_If_Array_Is_Null_But_DisabledValidation_For_Property()
{
- _myAppService.MyMethod5(new MyMethod5Input());
+ await _myAppService.MyMethod5(new MyMethod5Input());
}
[Fact]
- public void Should_Use_IValidatableObject()
+ public async Task Should_Use_IValidatableObject()
{
- Assert.Throws(() =>
+ await Assert.ThrowsAsync(async () =>
{
- _myAppService.MyMethod6(new MyMethod6Input
+ await _myAppService.MyMethod6(new MyMethod6Input
{
MyStringValue = "test value" //MyIntValue has not set!
});
});
}
+ //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.
+ [Fact]
+ public async Task LimitedResultRequestDto_Should_Throw_Exception_For_Requests_More_Than_MaxMaxResultCount()
+ {
+ var exception = await Assert.ThrowsAsync(async () =>
+ {
+ await _myAppService.MyMethodWithLimitedResult(new LimitedResultRequestDto
+ {
+ MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount + 1
+ });
+ });
+
+ exception.ValidationErrors.ShouldContain(e => e.MemberNames.Contains(nameof(LimitedResultRequestDto.MaxResultCount)));
+ }
+
[Fact]
- public void Should_Stop_Recursive_Validation_In_A_Constant_Depth()
+ public async Task LimitedResultRequestDto_Should_Be_Valid_For_Requests_Less_Than_MaxMaxResultCount()
{
- _myAppService.MyMethod8(new MyClassWithRecursiveReference { Value = "42" }).Result.ShouldBe(42);
+ await _myAppService.MyMethodWithLimitedResult(new LimitedResultRequestDto
+ {
+ MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount -1
+ });
}
[Fact]
- public void Should_Allow_Null_For_Nullable_Enums()
+ public async Task Should_Stop_Recursive_Validation_In_A_Constant_Depth()
{
- _myAppService.MyMethodWithNullableEnum(null);
+ (await _myAppService.MyMethod8(new MyClassWithRecursiveReference { Value = "42" })).Result.ShouldBe(42);
+ }
+
+ [Fact]
+ public async Task Should_Allow_Null_For_Nullable_Enums()
+ {
+ await _myAppService.MyMethodWithNullableEnum(null);
}
[Fact]
@@ -184,63 +212,69 @@ namespace Volo.Abp.Validation
public interface IMyAppService
{
- MyMethodOutput MyMethod(MyMethodInput input);
- MyMethodOutput MyMethod2(MyMethod2Input input);
- MyMethodOutput MyMethod3(MyMethod3Input input);
- MyMethodOutput MyMethod4(MyMethod4Input input);
- MyMethodOutput MyMethod4_2(MyMethod4Input input);
- MyMethodOutput MyMethod5(MyMethod5Input input);
- MyMethodOutput MyMethod6(MyMethod6Input input);
- MyMethodOutput MyMethod8(MyClassWithRecursiveReference input);
- void MyMethodWithNullableEnum(MyEnum? value);
+ Task MyMethod(MyMethodInput input);
+ Task MyMethod2(MyMethod2Input input);
+ Task MyMethod3(MyMethod3Input input);
+ Task MyMethod4(MyMethod4Input input);
+ Task MyMethod4_2(MyMethod4Input input);
+ Task MyMethod5(MyMethod5Input input);
+ Task MyMethod6(MyMethod6Input input);
+ Task MyMethod8(MyClassWithRecursiveReference input);
+ Task MyMethodWithNullableEnum(MyEnum? value);
+ Task MyMethodWithLimitedResult(LimitedResultRequestDto input);
}
public class MyAppService : IMyAppService, ITransientDependency
{
- public MyMethodOutput MyMethod(MyMethodInput input)
+ public Task MyMethod(MyMethodInput input)
{
- return new MyMethodOutput { Result = 42 };
+ return Task.FromResult(new MyMethodOutput { Result = 42 });
}
- public MyMethodOutput MyMethod2(MyMethod2Input input)
+ public Task MyMethod2(MyMethod2Input input)
{
- return new MyMethodOutput { Result = 42 };
+ return Task.FromResult(new MyMethodOutput { Result = 42 });
}
- public MyMethodOutput MyMethod3(MyMethod3Input input)
+ public Task MyMethod3(MyMethod3Input input)
{
- return new MyMethodOutput { Result = 42 };
+ return Task.FromResult(new MyMethodOutput { Result = 42 });
}
- public MyMethodOutput MyMethod4(MyMethod4Input input)
+ public Task MyMethod4(MyMethod4Input input)
{
- return new MyMethodOutput { Result = 42 };
+ return Task.FromResult(new MyMethodOutput { Result = 42 });
}
[DisableValidation]
- public MyMethodOutput MyMethod4_2(MyMethod4Input input)
+ public Task MyMethod4_2(MyMethod4Input input)
{
- return new MyMethodOutput { Result = 42 };
+ return Task.FromResult(new MyMethodOutput { Result = 42 });
}
- public MyMethodOutput MyMethod5(MyMethod5Input input)
+ public Task MyMethod5(MyMethod5Input input)
{
- return new MyMethodOutput { Result = 42 };
+ return Task.FromResult(new MyMethodOutput { Result = 42 });
}
- public MyMethodOutput MyMethod6(MyMethod6Input input)
+ public Task MyMethod6(MyMethod6Input input)
{
- return new MyMethodOutput { Result = 42 };
+ return Task.FromResult(new MyMethodOutput { Result = 42 });
}
- public MyMethodOutput MyMethod8(MyClassWithRecursiveReference input)
+ public Task MyMethod8(MyClassWithRecursiveReference input)
{
- return new MyMethodOutput { Result = 42 };
+ return Task.FromResult(new MyMethodOutput { Result = 42 });
}
- public void MyMethodWithNullableEnum(MyEnum? value)
+ public Task MyMethodWithLimitedResult(LimitedResultRequestDto input)
{
+ return Task.CompletedTask;
+ }
+ public Task MyMethodWithNullableEnum(MyEnum? value)
+ {
+ return Task.CompletedTask;
}
}
diff --git a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj
index f54dff4005..63617f36c0 100644
--- a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj
+++ b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -14,7 +14,7 @@
-
+
diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/cs.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/cs.json
index f0ec8ad410..b2d6fa9130 100644
--- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/cs.json
+++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/cs.json
@@ -14,8 +14,27 @@
"Login": "Přihlásit",
"Cancel": "Zrušit",
"Register": "Registrovat",
+ "AreYouANewUser": "Jste nový uživatel?",
+ "AlreadyRegistered": "Jste už zaregistrovaní?",
"InvalidLoginRequest": "Neplatný požadavek k přihlášení",
"ThereAreNoLoginSchemesConfiguredForThisClient": "Pro tohoto klienta nejsou nakonfigurovány žádné přihlašovací schémata.",
- "LogInUsingYourProviderAccount": "Přihlásit pomocí vašeho účtu {0}"
+ "LogInUsingYourProviderAccount": "Přihlásit pomocí vašeho účtu {0}",
+ "DisplayName:CurrentPassword": "Současné heslo",
+ "DisplayName:NewPassword": "Nové heslo",
+ "DisplayName:NewPasswordConfirm": "Potvrzení nového hesla",
+ "PasswordChangedMessage": "Vaše heslo bylo úspěšně změněno.",
+ "DisplayName:UserName": "Uživatelské jméno",
+ "DisplayName:Email": "Email",
+ "DisplayName:Name": "Jméno",
+ "DisplayName:Surname": "Příjmení",
+ "DisplayName:Password": "Heslo",
+ "DisplayName:EmailAddress": "Email adresa",
+ "DisplayName:PhoneNumber": "Telefonní číslo",
+ "PersonalSettings": "Osobní nastavení",
+ "PersonalSettingsSaved": "Osobní nastavení uloženo",
+ "PasswordChanged": "Heslo změněno",
+ "NewPasswordConfirmFailed": "Potvrďte nové heslo.",
+ "Manage": "Spravovat",
+ "ManageYourProfile": "Spravujte svůj profil"
}
}
\ No newline at end of file
diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
index bc507158b1..1f8c0f2eca 100644
--- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
+++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
@@ -35,6 +35,10 @@
"PasswordChanged": "Password changed",
"NewPasswordConfirmFailed": "Please confirm the new password.",
"Manage": "Manage",
- "ManageYourProfile": "Manage your profile"
+ "ManageYourProfile": "Manage your profile",
+ "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "Is self-registration enabled",
+ "Description:Abp.Account.IsSelfRegistrationEnabled": "Whether a user can register the account by him or herself.",
+ "DisplayName:Abp.Account.EnableLocalLogin": "Authenticate with a local account",
+ "Description:Abp.Account.EnableLocalLogin": "Indicates if Server will allow users to authenticate with a local account."
}
}
\ No newline at end of file
diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
index 1db38474ae..391dee0531 100644
--- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
+++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
@@ -35,6 +35,10 @@
"PasswordChanged": "修改密码",
"NewPasswordConfirmFailed": "请确认新密码",
"Manage": "管理",
- "ManageYourProfile": "管理你的个人资料"
+ "ManageYourProfile": "管理你的个人资料",
+ "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "启用自行注册",
+ "Description:Abp.Account.IsSelfRegistrationEnabled": "是否允许用户自行注册帐户.",
+ "DisplayName:Abp.Account.EnableLocalLogin": "使用本地帐户进行身份验证",
+ "Description:Abp.Account.EnableLocalLogin": "服务器是否将允许用户使用本地帐户进行身份验证。"
}
}
diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.csproj b/modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.csproj
index 288e7f4e9b..f5966d7e30 100644
--- a/modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.csproj
+++ b/modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj b/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj
index 9ecb118b9b..4a7602754a 100644
--- a/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj
+++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Account.HttpApi.ClientVolo.Abp.Account.HttpApi.Client
diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj b/modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj
index 2af9e29df4..3459ab0294 100644
--- a/modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj
+++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Account.HttpApiVolo.Abp.Account.HttpApi
diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs
index 0e210dd8de..c1e1e6be25 100644
--- a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs
+++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs
@@ -4,6 +4,7 @@ using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
+using Microsoft.Extensions.DependencyInjection;
namespace Volo.Abp.Account
{
@@ -13,6 +14,14 @@ namespace Volo.Abp.Account
typeof(AbpAspNetCoreMvcModule))]
public class AbpAccountHttpApiModule : AbpModule
{
+ public override void PreConfigureServices(ServiceConfigurationContext context)
+ {
+ PreConfigure(mvcBuilder =>
+ {
+ mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpAccountHttpApiModule).Assembly);
+ });
+ }
+
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure(options =>
diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj
index a03e55b51f..81f0ee4375 100644
--- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj
+++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Account.Web.IdentityServerVolo.Abp.Account.Web.IdentityServertrue
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 9f10b7aa1d..05f37067d4 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
@@ -49,6 +49,9 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers
public virtual async Task CheckPassword(UserLoginInfo login)
{
ValidateLoginInfo(login);
+
+ await ReplaceEmailToUsernameOfInputIfNeeds(login);
+
var identityUser = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress);
if (identityUser == null)
diff --git a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
index be16fa7045..53c2df6fbd 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
+++ b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
@@ -1,4 +1,6 @@
-using Volo.Abp.Settings;
+using Volo.Abp.Account.Localization;
+using Volo.Abp.Localization;
+using Volo.Abp.Settings;
namespace Volo.Abp.Account.Web.Settings
{
@@ -7,12 +9,25 @@ namespace Volo.Abp.Account.Web.Settings
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(AccountSettingNames.IsSelfRegistrationEnabled, "true")
+ new SettingDefinition(
+ AccountSettingNames.IsSelfRegistrationEnabled,
+ "true",
+ L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"),
+ L("Description:Abp.Account.IsSelfRegistrationEnabled"))
);
context.Add(
- new SettingDefinition(AccountSettingNames.EnableLocalLogin, "true")
+ new SettingDefinition(
+ AccountSettingNames.EnableLocalLogin,
+ "true",
+ L("DisplayName:Abp.Account.EnableLocalLogin"),
+ L("Description:Abp.Account.EnableLocalLogin"))
);
}
+
+ private static LocalizableString L(string name)
+ {
+ return LocalizableString.Create(name);
+ }
}
}
\ No newline at end of file
diff --git a/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj b/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj
index 3101861d54..880353ceab 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj
+++ b/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Abp.Account.WebVolo.Abp.Account.Web$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
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 d7153fa75f..e8d3f84ead 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
@@ -1,11 +1,11 @@
- netcoreapp3.0
+ netcoreapp3.1
-
+
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 7bbd51af12..0fc757b5e9 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
@@ -33,33 +33,6 @@ namespace Volo.Abp.AuditLogging
Logger = NullLogger.Instance;
}
- public void Save(AuditLogInfo auditInfo)
- {
- if (!Options.HideErrors)
- {
- SaveLog(auditInfo);
- return;
- }
-
- try
- {
- SaveLog(auditInfo);
- }
- catch (Exception ex)
- {
- Logger.LogException(ex, LogLevel.Error);
- }
- }
-
- protected virtual void SaveLog(AuditLogInfo auditInfo)
- {
- using (var uow = _unitOfWorkManager.Begin(true))
- {
- _auditLogRepository.Insert(new AuditLog(_guidGenerator, auditInfo));
- uow.SaveChanges();
- }
- }
-
public async Task SaveAsync(AuditLogInfo auditInfo)
{
if (!Options.HideErrors)
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 a0e3c31961..8beeff86a3 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
@@ -127,7 +127,12 @@ namespace Volo.Abp.AuditLogging.MongoDB
var result = await GetMongoQueryable()
.Where(a => a.ExecutionTime < endDate.AddDays(1) && a.ExecutionTime > startDate)
.OrderBy(t => t.ExecutionTime)
- .GroupBy(t => new { t.ExecutionTime.Date })
+ .GroupBy(t => new
+ {
+ t.ExecutionTime.Year,
+ t.ExecutionTime.Month,
+ t.ExecutionTime.Day
+ })
.Select(g => new { Day = g.Min(t => t.ExecutionTime), avgExecutionTime = g.Average(t => t.ExecutionDuration) })
.ToListAsync();
diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests.csproj b/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests.csproj
index f55f447489..8ee9a2e2f6 100644
--- a/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests.csproj
+++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -13,9 +13,9 @@
-
-
-
+
+
+
diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo/Abp/AuditLogging/EntityFrameworkCore/AuditLogRepository_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo/Abp/AuditLogging/EntityFrameworkCore/AuditLogRepository_Tests.cs
index 4f626c3636..7330e3292e 100644
--- a/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo/Abp/AuditLogging/EntityFrameworkCore/AuditLogRepository_Tests.cs
+++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo/Abp/AuditLogging/EntityFrameworkCore/AuditLogRepository_Tests.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Volo.Abp.AuditLogging.EntityFrameworkCore
+namespace Volo.Abp.AuditLogging.EntityFrameworkCore
{
public class AuditLogRepository_Tests : AuditLogRepository_Tests
{
diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj b/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj
index 7126bf3cef..b5c7084cf2 100644
--- a/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj
+++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo.Abp.AuditLogging.TestBase.csproj b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo.Abp.AuditLogging.TestBase.csproj
index e7d0174cc9..157301aecb 100644
--- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo.Abp.AuditLogging.TestBase.csproj
+++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo.Abp.AuditLogging.TestBase.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -14,8 +14,8 @@
-
-
+
+
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 27ab36f48e..54092ea248 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,5 +1,7 @@
-using System;
+using System;
using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
@@ -117,8 +119,8 @@ namespace Volo.Abp.AuditLogging
}
};
- AuditLogRepository.Insert(new AuditLog(GuidGenerator, log1));
- AuditLogRepository.Insert(new AuditLog(GuidGenerator, log2));
+ await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1));
+ await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2));
//Assert
var logs = await AuditLogRepository.GetListAsync();
@@ -221,12 +223,116 @@ namespace Volo.Abp.AuditLogging
}
};
- AuditLogRepository.Insert(new AuditLog(GuidGenerator, log1));
- AuditLogRepository.Insert(new AuditLog(GuidGenerator, log2));
+ await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1));
+ await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2));
//Assert
var logs = await AuditLogRepository.GetCountAsync();
logs.ShouldBe(2);
}
+
+ [Fact]
+ public async Task GetAverageExecutionDurationPerDayAsync()
+ {
+ // Arrange
+ var userId = new Guid("4456fb0d-74cc-4807-9eee-23e551e6cb06");
+ var userId2 = new Guid("4456fb0d-74cc-4807-9eee-23e551e6cb06");
+ var ipAddress = "153.1.7.61";
+ var firstComment = "first Comment";
+
+ var log1 = new AuditLogInfo
+ {
+ UserId = userId,
+ ImpersonatorUserId = Guid.NewGuid(),
+ ImpersonatorTenantId = Guid.NewGuid(),
+ ExecutionTime = DateTime.Parse("2020-01-01 01:00:00"),
+ ExecutionDuration = 45,
+ ClientIpAddress = ipAddress,
+ ClientName = "MyDesktop",
+ BrowserInfo = "Chrome",
+ Comments = new List { firstComment, "Second Comment" },
+ UserName = "Douglas",
+ EntityChanges = {
+ new EntityChangeInfo
+ {
+ EntityId = Guid.NewGuid().ToString(),
+ EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity",
+ ChangeType = EntityChangeType.Created,
+ ChangeTime = DateTime.Now,
+ PropertyChanges = new List
+ {
+ new EntityPropertyChangeInfo
+ {
+ PropertyTypeFullName = typeof(string).FullName,
+ PropertyName = "Name",
+ NewValue = "New value",
+ OriginalValue = null
+ }
+ }
+ },
+ new EntityChangeInfo
+ {
+ EntityId = Guid.NewGuid().ToString(),
+ EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity",
+ ChangeType = EntityChangeType.Created,
+ ChangeTime = DateTime.Now,
+ PropertyChanges = new List
+ {
+ new EntityPropertyChangeInfo
+ {
+ PropertyTypeFullName = typeof(string).FullName,
+ PropertyName = "Name",
+ NewValue = "New value",
+ OriginalValue = null
+ }
+ }
+ }
+
+ }
+ };
+
+ var log2 = new AuditLogInfo
+ {
+ UserId = userId2,
+ ImpersonatorUserId = Guid.NewGuid(),
+ ImpersonatorTenantId = Guid.NewGuid(),
+ ExecutionTime = DateTime.Parse("2020-01-01 03:00:00"),
+ ExecutionDuration = 55,
+ ClientIpAddress = ipAddress,
+ ClientName = "MyDesktop",
+ BrowserInfo = "Chrome",
+ Comments = new List { firstComment, "Second Comment" },
+ HttpStatusCode = (int?)HttpStatusCode.BadGateway,
+ EntityChanges = {
+ new EntityChangeInfo
+ {
+ EntityId = Guid.NewGuid().ToString(),
+ EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity",
+ ChangeType = EntityChangeType.Created,
+ ChangeTime = DateTime.Now,
+ PropertyChanges = new List
+ {
+ new EntityPropertyChangeInfo
+ {
+ PropertyTypeFullName = typeof(string).FullName,
+ PropertyName = "Name",
+ NewValue = "New value",
+ OriginalValue = null
+ }
+ }
+ }
+
+ }
+ };
+
+ await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1));
+ await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2));
+
+ //Assert
+ var date = DateTime.Parse("2020-01-01");
+ var results = await AuditLogRepository.GetAverageExecutionDurationPerDayAsync(date, date);
+ 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/AuditStore_Basic_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs
index c54d98608c..05dc829440 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
@@ -68,7 +68,7 @@ namespace Volo.Abp.AuditLogging
//Assert
- var insertedLog = _auditLogRepository.GetList(true)
+ var insertedLog = (await _auditLogRepository.GetListAsync(true))
.FirstOrDefault(al => al.UserId == userId);
insertedLog.ShouldNotBeNull();
diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo.Abp.AuditLogging.Tests.csproj b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo.Abp.AuditLogging.Tests.csproj
index 7dadd76798..31a70aa5b1 100644
--- a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo.Abp.AuditLogging.Tests.csproj
+++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo.Abp.AuditLogging.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -12,7 +12,7 @@
-
+
diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj
index 0eba9eeec3..3490b31f67 100644
--- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj
+++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj
@@ -2,11 +2,11 @@
Exe
- netcoreapp3.0
+ netcoreapp3.1
-
+
diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj
index 00d239bef2..adcf9be1aa 100644
--- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj
+++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj
@@ -2,7 +2,7 @@
Exe
- netcoreapp3.0
+ netcoreapp3.1
diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj
index a2a5f008d9..3bd6feee59 100644
--- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj
+++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj
index 05be04b0e7..b3bc53a2ed 100644
--- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj
+++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj
@@ -2,11 +2,11 @@
Exe
- netcoreapp3.0
+ netcoreapp3.1
-
+ allruntime; build; native; contentfiles; analyzers
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 833ce54a6b..b8d30b6940 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
@@ -20,13 +20,6 @@ namespace Volo.Abp.BackgroundJobs
BackgroundJobRepository = backgroundJobRepository;
}
- public BackgroundJobInfo Find(Guid jobId)
- {
- return ObjectMapper.Map(
- BackgroundJobRepository.Find(jobId)
- );
- }
-
public virtual async Task FindAsync(Guid jobId)
{
return ObjectMapper.Map(
@@ -34,13 +27,6 @@ namespace Volo.Abp.BackgroundJobs
);
}
- public void Insert(BackgroundJobInfo jobInfo)
- {
- BackgroundJobRepository.Insert(
- ObjectMapper.Map(jobInfo)
- );
- }
-
public virtual async Task InsertAsync(BackgroundJobInfo jobInfo)
{
await BackgroundJobRepository.InsertAsync(
@@ -48,13 +34,6 @@ namespace Volo.Abp.BackgroundJobs
);
}
- public List GetWaitingJobs(int maxResultCount)
- {
- return ObjectMapper.Map, List>(
- BackgroundJobRepository.GetWaitingList(maxResultCount)
- );
- }
-
public virtual async Task> GetWaitingJobsAsync(int maxResultCount)
{
return ObjectMapper.Map, List>(
@@ -62,28 +41,11 @@ namespace Volo.Abp.BackgroundJobs
);
}
- public void Delete(Guid jobId)
- {
- BackgroundJobRepository.Delete(jobId);
- }
-
public virtual async Task DeleteAsync(Guid jobId)
{
await BackgroundJobRepository.DeleteAsync(jobId);
}
- public void Update(BackgroundJobInfo jobInfo)
- {
- var backgroundJobRecord = BackgroundJobRepository.Find(jobInfo.Id);
- if (backgroundJobRecord == null)
- {
- return;
- }
-
- ObjectMapper.Map(jobInfo, backgroundJobRecord);
- BackgroundJobRepository.Update(backgroundJobRecord);
- }
-
public virtual async Task UpdateAsync(BackgroundJobInfo jobInfo)
{
var backgroundJobRecord = await BackgroundJobRepository.FindAsync(jobInfo.Id);
diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/IBackgroundJobRepository.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/IBackgroundJobRepository.cs
index a34cbd6abb..e12aeff70a 100644
--- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/IBackgroundJobRepository.cs
+++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/IBackgroundJobRepository.cs
@@ -7,8 +7,6 @@ namespace Volo.Abp.BackgroundJobs
{
public interface IBackgroundJobRepository : IBasicRepository
{
- List GetWaitingList(int maxResultCount);
-
Task> GetWaitingListAsync(int maxResultCount);
}
}
\ No newline at end of file
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 8128d18bfb..8c786c9f37 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
@@ -21,12 +21,6 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore
Clock = clock;
}
- public List GetWaitingList(int maxResultCount)
- {
- return GetWaitingListQuery(maxResultCount)
- .ToList();
- }
-
public async Task> GetWaitingListAsync(int maxResultCount)
{
return await GetWaitingListQuery(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 fe3ffa7e07..33903c1e9f 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
@@ -21,12 +21,6 @@ namespace Volo.Abp.BackgroundJobs.MongoDB
Clock = clock;
}
- public List GetWaitingList(int maxResultCount)
- {
- return GetWaitingListQuery(maxResultCount)
- .ToList();
- }
-
public async Task> GetWaitingListAsync(int maxResultCount)
{
return await GetWaitingListQuery(maxResultCount)
diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj
index 7932f919e1..c7d43a8e71 100644
--- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj
+++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -12,7 +12,7 @@
-
+
diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj
index 433301a189..25434f3b06 100644
--- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj
+++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -13,10 +13,10 @@
-
-
-
-
+
+
+
+
diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj
index 468c1f0665..faece9ea33 100644
--- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj
+++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj
index d6dbe4bb8e..538f9376fb 100644
--- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj
+++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -14,8 +14,8 @@
-
-
+
+
diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/AbpBackgroundJobsTestBaseModule.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/AbpBackgroundJobsTestBaseModule.cs
index 0c1a681eeb..75e150dc25 100644
--- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/AbpBackgroundJobsTestBaseModule.cs
+++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/AbpBackgroundJobsTestBaseModule.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
+using Volo.Abp.Threading;
namespace Volo.Abp.BackgroundJobs
{
@@ -28,9 +29,9 @@ namespace Volo.Abp.BackgroundJobs
{
using (var scope = context.ServiceProvider.CreateScope())
{
- scope.ServiceProvider
+ AsyncHelper.RunSync(() => scope.ServiceProvider
.GetRequiredService()
- .Build();
+ .BuildAsync());
}
}
}
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 dd74854a9c..16bcc667f5 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
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Timing;
@@ -20,9 +21,9 @@ namespace Volo.Abp.BackgroundJobs
_clock = clock;
}
- public void Build()
+ public async Task BuildAsync()
{
- _backgroundJobRepository.Insert(
+ await _backgroundJobRepository.InsertAsync(
new BackgroundJobRecord(_testData.JobId1)
{
JobName = "TestJobName",
@@ -36,7 +37,7 @@ namespace Volo.Abp.BackgroundJobs
}
);
- _backgroundJobRepository.Insert(
+ await _backgroundJobRepository.InsertAsync(
new BackgroundJobRecord(_testData.JobId2)
{
JobName = "TestJobName",
@@ -50,7 +51,7 @@ namespace Volo.Abp.BackgroundJobs
}
);
- _backgroundJobRepository.Insert(
+ await _backgroundJobRepository.InsertAsync(
new BackgroundJobRecord(_testData.JobId3)
{
JobName = "TestJobName",
diff --git a/modules/blogging/app/Volo.BloggingTestApp/Controllers/HomeController.cs b/modules/blogging/app/Volo.BloggingTestApp/Controllers/HomeController.cs
index 0e4a7acc1d..f64a1da5ae 100644
--- a/modules/blogging/app/Volo.BloggingTestApp/Controllers/HomeController.cs
+++ b/modules/blogging/app/Volo.BloggingTestApp/Controllers/HomeController.cs
@@ -1,13 +1,22 @@
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc;
+using Volo.Blogging;
namespace Volo.BloggingTestApp.Controllers
{
public class HomeController : AbpController
{
+ private readonly BloggingUrlOptions _blogOptions;
+
+ public HomeController(IOptions blogOptions)
+ {
+ _blogOptions = blogOptions.Value;
+ }
public ActionResult Index()
{
- return Redirect("/blog/");
+ var urlPrefix = _blogOptions.RoutePrefix;
+ return Redirect(urlPrefix);
}
}
}
diff --git a/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj b/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj
index b4f2932021..c1bb7c8a85 100644
--- a/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj
+++ b/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj
@@ -1,7 +1,7 @@
- netcoreapp3.0
+ netcoreapp3.1
@@ -13,7 +13,7 @@
-
+
diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingApplicationContractsModule.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingApplicationContractsModule.cs
index 010f872b51..74b675187d 100644
--- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingApplicationContractsModule.cs
+++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingApplicationContractsModule.cs
@@ -1,6 +1,4 @@
-using Microsoft.Extensions.DependencyInjection;
-using Volo.Abp.Authorization.Permissions;
-using Volo.Abp.Localization;
+using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
using Volo.Blogging.Localization;
diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Blogs/Dtos/UpdateBlogDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Blogs/Dtos/UpdateBlogDto.cs
index f7ec593465..2e3b0b7b4e 100644
--- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Blogs/Dtos/UpdateBlogDto.cs
+++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Blogs/Dtos/UpdateBlogDto.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace Volo.Blogging.Blogs.Dtos
+namespace Volo.Blogging.Blogs.Dtos
{
public class UpdateBlogDto
{
diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs
index b150c82953..eb4f707e34 100644
--- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs
+++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using Volo.Abp.Application.Dtos;
namespace Volo.Blogging.Posts
diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/Dtos/GetPopularTagsInput.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/Dtos/GetPopularTagsInput.cs
index b4c0a07eb5..a6be46cff7 100644
--- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/Dtos/GetPopularTagsInput.cs
+++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/Dtos/GetPopularTagsInput.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace Volo.Blogging.Tagging.Dtos
+namespace Volo.Blogging.Tagging.Dtos
{
public class GetPopularTagsInput
{
diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj b/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj
index 95682a2a9e..a162d644df 100644
--- a/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj
+++ b/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj
@@ -10,7 +10,7 @@
-
+
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 a8232933a4..be51085f86 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
@@ -118,7 +118,7 @@ namespace Volo.Blogging.Posts
await AuthorizationService.CheckAsync(post, CommonOperations.Delete);
var tags = await GetTagsOfPost(id);
- _tagRepository.DecreaseUsageCountOfTags(tags.Select(t => t.Id).ToList());
+ await _tagRepository.DecreaseUsageCountOfTagsAsync(tags.Select(t => t.Id).ToList());
await _commentRepository.DeleteOfPost(id);
await _postRepository.DeleteAsync(id);
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 aaa4425ec7..14dc9bd5ca 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,5 +1,4 @@
-using Microsoft.Extensions.DependencyInjection;
-using Volo.Abp.Localization;
+using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Blogging.Localization;
diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs
index 6c73a7e71a..4690546a7e 100644
--- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs
+++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs
@@ -1,5 +1,4 @@
-using Microsoft.Extensions.DependencyInjection;
-using Volo.Abp.Domain;
+using Volo.Abp.Domain;
using Volo.Abp.Modularity;
namespace Volo.Blogging
diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs
index 33858b9baf..8c076c49d7 100644
--- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs
+++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
@@ -15,6 +16,6 @@ namespace Volo.Blogging.Tagging
Task> GetListAsync(IEnumerable ids);
- void DecreaseUsageCountOfTags(List id);
+ Task DecreaseUsageCountOfTagsAsync(List id, CancellationToken cancellationToken = default);
}
}
diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs
index 3605550ac4..fd4bec2de4 100644
--- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs
+++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs
@@ -7,7 +7,6 @@ using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Blogging.EntityFrameworkCore;
-using System.Linq.Dynamic.Core;
namespace Volo.Blogging.Posts
{
diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs
index cd77b3cfab..3e897fa7e3 100644
--- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs
+++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs
@@ -1,6 +1,7 @@
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;
@@ -36,9 +37,11 @@ namespace Volo.Blogging.Tagging
return await DbSet.Where(t => ids.Contains(t.Id)).ToListAsync();
}
- public void DecreaseUsageCountOfTags(List ids)
+ public async Task DecreaseUsageCountOfTagsAsync(List ids, CancellationToken cancellationToken = default)
{
- var tags = DbSet.Where(t => ids.Any(id => id == t.Id));
+ var tags = await DbSet
+ .Where(t => ids.Any(id => id == t.Id))
+ .ToListAsync(GetCancellationToken(cancellationToken));
foreach (var tag in tags)
{
diff --git a/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj b/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj
index 550d58bcec..0c688104db 100644
--- a/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj
+++ b/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Blogging.HttpApi.ClientVolo.Blogging.HttpApi.Client
diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo.Blogging.HttpApi.csproj b/modules/blogging/src/Volo.Blogging.HttpApi/Volo.Blogging.HttpApi.csproj
index db90344d09..8965b8782e 100644
--- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo.Blogging.HttpApi.csproj
+++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo.Blogging.HttpApi.csproj
@@ -3,7 +3,7 @@
- netcoreapp3.0
+ netcoreapp3.1Volo.Blogging.HttpApiVolo.Blogging.HttpApi
diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BloggingHttpApiModule.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BloggingHttpApiModule.cs
index 46e2603a77..3365063299 100644
--- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BloggingHttpApiModule.cs
+++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BloggingHttpApiModule.cs
@@ -3,6 +3,7 @@ using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Blogging.Localization;
+using Microsoft.Extensions.DependencyInjection;
namespace Volo.Blogging
{
@@ -11,6 +12,13 @@ namespace Volo.Blogging
typeof(AbpAspNetCoreMvcModule))]
public class BloggingHttpApiModule : AbpModule
{
+ public override void PreConfigureServices(ServiceConfigurationContext context)
+ {
+ PreConfigure(mvcBuilder =>
+ {
+ mvcBuilder.AddApplicationPartIfNotExists(typeof(BloggingHttpApiModule).Assembly);
+ });
+ }
public override void ConfigureServices(ServiceConfigurationContext context)
{
diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs
index 518a37b809..158a3416ba 100644
--- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs
+++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
-using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
-using Volo.Abp.Auditing;
using Volo.Blogging.Comments;
using Volo.Blogging.Comments.Dtos;
diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs
index a3cc6b0745..79e7d920f8 100644
--- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs
+++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs
@@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
-using Volo.Abp.Auditing;
using Volo.Blogging.Posts;
namespace Volo.Blogging
diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs
index bdb7d1d77c..ede42dd264 100644
--- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs
+++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs
@@ -4,7 +4,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
-using Volo.Abp.Auditing;
using Volo.Blogging.Tagging;
using Volo.Blogging.Tagging.Dtos;
diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs
index f09ddf7026..b17c7f906f 100644
--- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs
+++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs
index e2fcdca96c..2c0b3b97bf 100644
--- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs
+++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
@@ -19,7 +20,7 @@ namespace Volo.Blogging.Tagging
public async Task> GetListAsync(Guid blogId)
{
- return await GetMongoQueryable().Where(t=>t.BlogId == blogId).ToListAsync();
+ return await GetMongoQueryable().Where(t => t.BlogId == blogId).ToListAsync();
}
public async Task GetByNameAsync(Guid blogId, string name)
@@ -37,14 +38,16 @@ namespace Volo.Blogging.Tagging
return await GetMongoQueryable().Where(t => ids.Contains(t.Id)).ToListAsync();
}
- public void DecreaseUsageCountOfTags(List ids)
+ public async Task DecreaseUsageCountOfTagsAsync(List ids, CancellationToken cancellationToken = default)
{
- var tags = GetMongoQueryable().Where(t => ids.Contains(t.Id));
+ var tags = await GetMongoQueryable()
+ .Where(t => ids.Contains(t.Id))
+ .ToListAsync(GetCancellationToken(cancellationToken));
foreach (var tag in tags)
{
tag.DecreaseUsageCount();
- Update(tag);
+ await UpdateAsync(tag, cancellationToken: GetCancellationToken(cancellationToken));
}
}
}
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml
index 7ab0105c0c..b96a531550 100644
--- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml
+++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml
@@ -7,64 +7,70 @@
ViewBag.PageTitle = "Blog";
}
@section styles {
-
+
}
@section scripts {
-
+
}
-