diff --git a/README.md b/README.md
index dbf8bce537..ebba20da41 100644
--- a/README.md
+++ b/README.md
@@ -108,6 +108,10 @@ ABP is a community-driven open source project. See [the contribution guide](http
Love ABP Framework? **Please give a star** to this repository :star:
+## Discord Channel
+
+You can use this link to join the ABP Community Discord Server: https://discord.gg/abp
+
## ABP Commercial
See also [ABP Commercial](https://commercial.abp.io/) if you are looking for pre-built application modules, professional themes, code generation tooling and premium support for the ABP Framework.
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json
index d1890e1786..18c5524d1f 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json
@@ -337,18 +337,6 @@
"Expired": "Expired",
"TrialLicenseDeletionWarningMessage": "Are you sure you want to delete the trial license? Trial license, organization, support accounts will be deleted!",
"LicenseCategoryFilter": "License category",
- "Volo.AbpIo.Commercial:030000": "You already used your trial period.",
- "Volo.AbpIo.Commercial:030001": "This organization name already exists.",
- "Volo.AbpIo.Commercial:030002": "Once activated, trial license cannot be set to requested!",
- "Volo.AbpIo.Commercial:030003": "There is no such status!",
- "Volo.AbpIo.Commercial:030004": "Status could not be changed due to an unexpected error!",
- "Volo.AbpIo.Commercial:030005": "Start and end date can be updated when the trial license is in the -activated- status!",
- "Volo.AbpIo.Commercial:030006": "End date must always be greater than start date!",
- "Volo.AbpIo.Commercial:030007": "This trial license has already been activated once!",
- "Volo.AbpIo.Commercial:030008": "Purchase date can be set only when status is Purchased!",
- "Volo.AbpIo.Commercial:030009": "User not found!",
- "Volo.AbpIo.Commercial:030010": "To purchase the trial license, first you need to activate your trial license!",
- "Volo.AbpIo.Commercial:030011": "You cannot delete a trial license when it is purchased!",
"Permission:SendWelcomeEmail": "Send Welcome Email",
"SendWelcomeEmail": "Send Welcome Email",
"SendWelcomeEmailWarningMessage": "Are you sure you want to send welcome email to the organization members?",
@@ -385,12 +373,15 @@
"Menu:Speakers": "Speakers",
"ChooseSpeakerImage": "Choose a speaker image...",
"SpeakerImage": "Speaker image",
+ "AddSpeaker": "Add Speaker",
"ShowPurchaseItemsOfOrganizations": "Purchase Items",
"Enum:OrganizationPurchaseState:0": "Not delivered",
"Enum:OrganizationPurchaseState:1": "Delivered",
"PurchaseItems": "Purchase Items",
"SuccessfullyUpdated": "Successfully updated",
"SuccessfullyAdded": "Successfully added",
- "PurchaseState": "Purchase State"
+ "PurchaseState": "Purchase State",
+ "ShowBetweenDayCount": "Show Between Days",
+ "PurchaseOrder": "Purchase Order"
}
}
\ No newline at end of file
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json
index fe9085e427..5d6e081085 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json
@@ -14,6 +14,18 @@
"Volo.AbpIo.Domain:020002": "Could not delete this NPM Package because \"{Modules}\" Modules are using this package.",
"Volo.AbpIo.Domain:020003": "Could not delete this NPM Package because \"{Modules}\" Modules are using this package and \"{NugetPackages}\" Nuget Packages are dependent to this package.",
"Volo.AbpIo.Domain:020004": "Could not delete this Nuget Package because \"{Modules}\" Modules are using this package.",
+ "Volo.AbpIo.Domain:030000": "You have already completed your trial period.",
+ "Volo.AbpIo.Domain:030001": "This organization name already exists.",
+ "Volo.AbpIo.Domain:030002": "Once activated, you cannot switch the trial license to -requested- status!",
+ "Volo.AbpIo.Domain:030003": "There is no such status!",
+ "Volo.AbpIo.Domain:030004": "Status could not be changed due to an unexpected error!",
+ "Volo.AbpIo.Domain:030005": "Start and end date can be updated when the trial license is in the -activated- status!",
+ "Volo.AbpIo.Domain:030006": "The end date must be greater than the start date!",
+ "Volo.AbpIo.Domain:030007": "This trial license has already been activated!",
+ "Volo.AbpIo.Domain:030008": "The purchase date can be set only when the status is -purchased-!",
+ "Volo.AbpIo.Domain:030009": "User not found!",
+ "Volo.AbpIo.Domain:030010": "To purchase the trial license, you first need to activate your trial license!",
+ "Volo.AbpIo.Domain:030011": "You cannot delete a trial license when it is purchased!",
"WantToLearn?": "Want to learn?",
"ReadyToGetStarted?": "Ready to get started?",
"JoinOurCommunity": "Join our community",
@@ -72,7 +84,7 @@
"WouldLikeToReceiveMarketingMaterials": "I would like to receive marketing materials like product deals & special offers.",
"JoinOurMarketingNewsletter": "Join our marketing newsletter",
"CommunityPrivacyPolicyConfirmation": "I agree to the Terms & Conditions and Privacy Policy.",
- "ABPIO-Common": "ABPIO-Common",
+ "WouldLikeToReceiveNotification": "I would like to receive the latest news from abp.io websites.",
"CommercialNewsletterConfirmationMessage": "I agree to the Terms & Conditions and Privacy Policy.",
"FreeDDDEBook": "Free DDD E-Book",
"AdditionalServices": "Additional Services",
@@ -104,7 +116,11 @@
"WatchTheEvent": "Watch the Event",
"RegisterNow": "Register Now",
"ThereIsNoEvent": "There is no event.",
+ "Events": "Events",
"Volo.AbpIo.Domain:080000": "There is already a purchase item named \"{Name}\"",
- "MasteringAbpFrameworkBook": "Book: Mastering ABP Framework"
+ "MasteringAbpFrameworkBook": "Book: Mastering ABP Framework",
+ "ABPIO-CommonPreferenceDefinition": "Get the latest news about ABP Platform like new posts, events and more.",
+ "BuiltOn": "Built-on",
+ "AbpFramework": "ABP Framework"
}
}
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
index 8fa96b5ee2..0d7724df56 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
@@ -495,7 +495,9 @@
"LicenseTypeNotCorrect": "The license type is not correct!",
"Trainings": "Trainings",
"ChoseTrainingPlaceholder": "Chose the training...",
- "ContactUsToGetQuote": "Contact us to get a quote",
+ "DoYouNeedTrainings": "Do you need one of these trainings?",
+ "DoYouNeedTraining": "Do you need {0} training?",
+ "GetInTouchUs": "Get in touch with us",
"ForMoreInformationClickHere": "For more information, click here.",
"IsGetOnboardingTraining": "Would you like to get onboarding & web application development training?",
"OnboardingWebApplicationDevelopmentTrainingMessage": "To schedule your training calendar, please contact {0} after creating the organization",
@@ -503,6 +505,7 @@
"AdditionalNote": "Additional Note",
"OnboardingTrainingFaqTitle": "Do you have ABP onboarding training?",
"OnboardingTrainingFaqExplanation": "Yes, we have ABP Training Services to help you get your ABP project started fast. You will learn about ABP from an ABP core team member and you will get the skills to begin your ABP project. In the onboarding training, we will explain how to set up your development environment, install the required tools, create a fully functional CRUD page. The training will be live and the Zoom application will be used, and we are open to using other online meeting platforms. The language of the training will be English. You can also ask your questions about ABP during the sessions. A convenient time and date will be planned for both parties. To get more information, contact us at info@abp.io.",
- "AddBasket": "Add to Basket"
+ "AddBasket": "Add to Basket",
+ "SendTrainingRequest": "Send Training Request"
}
}
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json
index 60215b5fec..0b9d6d96b2 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json
@@ -183,7 +183,7 @@
"InstallABPCLIInfo": "ABP CLI is the fastest way to start a new solution with the ABP framework. Install the ABP CLI using a command line window:",
"DifferentLevelOfNamespaces": "You can use different levels of namespaces; e.g. BookStore, Acme.BookStore or Acme.Retail.BookStore.",
"ABPCLIExamplesInfo": "The new command creates a layered MVC application with Entity Framework Core as the database provider. However, it has additional options.",
- "SeeCliDocumentForMoreInformation": "Check out the ABP CLI document for more options or select the \"Direct Download\" tab above.",
+ "SeeCliDocumentForMoreInformation": "Check out the ABP CLI document for more options or select the \"Direct Download\" tab above.",
"Optional": "Optional",
"LocalFrameworkRef": "Keep the local project reference for the framework packages.",
"BlobStoring": "BLOB Storing",
@@ -318,6 +318,7 @@
"InstallingTheABPCLI": "Installing the ABP CLI",
"CreateYourProjectNow": "Create Your Project Now",
"OrderOn": "Order on {0}",
- "DownloadFreeDDDBook": "Download Free DDD Book"
+ "DownloadFreeDDDBook": "Download Free DDD Book",
+ "WhatIsABPFramework": "What is the ABP Framework?"
}
}
diff --git a/common.props b/common.props
index 176e761975..facc92f0bc 100644
--- a/common.props
+++ b/common.props
@@ -1,7 +1,7 @@
latest
- 5.2.1
+ 5.3.0
$(NoWarn);CS1591;CS0436
https://abp.io/assets/abp_nupkg.png
https://abp.io/
diff --git a/docs/en/Background-Workers-Hangfire.md b/docs/en/Background-Workers-Hangfire.md
index 7f832f2c71..4cbaf8cc24 100644
--- a/docs/en/Background-Workers-Hangfire.md
+++ b/docs/en/Background-Workers-Hangfire.md
@@ -126,4 +126,4 @@ context.ServiceProvider
So, it resolves the given background worker and adds to the `IBackgroundWorkerManager`.
-While we generally add workers in OnApplicationInitialization, there are no restrictions on that. You can inject IBackgroundWorkerManager anywhere and add workers at runtime. Background worker manager will stop and release all the registered workers when your application is being shut down.
\ No newline at end of file
+While we generally add workers in OnApplicationInitialization, there are no restrictions on that. You can inject IBackgroundWorkerManager anywhere and add workers at runtime. Background worker manager will stop and release all the registered workers when your application is being shut down.
diff --git a/docs/en/Blog-Posts/2022-04-05 v5_2_Release_Stable/POST.md b/docs/en/Blog-Posts/2022-04-05 v5_2_Release_Stable/POST.md
new file mode 100644
index 0000000000..ed83f36e19
--- /dev/null
+++ b/docs/en/Blog-Posts/2022-04-05 v5_2_Release_Stable/POST.md
@@ -0,0 +1,51 @@
+# ABP.IO Platform 5.2 Final Has Been Released!
+
+[ABP Framework](https://abp.io/) and [ABP Commercial](https://commercial.abp.io/) 5.2 versions have been released today.
+
+## What's New With 5.2?
+
+Since all the new features are already explained in details with the [5.2 RC Announcement Post](https://blog.abp.io/abp/ABP.IO-Platform-5-2-RC-Has-Been-Published), I will not repeat all the details again. See the [RC Blog Post](https://blog.abp.io/abp/ABP.IO-Platform-5-2-RC-Has-Been-Published) for all the features and enhancements.
+
+## Creating New Solutions
+
+You can create a new solution with the ABP Framework version 5.2 by either using the `abp new` command or using the **direct download** tab on the [get started page](https://abp.io/get-started).
+
+> See the [getting started document](https://docs.abp.io/en/abp/latest/Getting-Started) for more.
+
+## How to Upgrade an Existing Solution
+
+### Install/Update the ABP CLI
+
+First of all, install the ABP CLI or upgrade to the latest version.
+
+If you haven't installed yet:
+
+```bash
+dotnet tool install -g Volo.Abp.Cli
+```
+
+To update an existing installation:
+
+```bash
+dotnet tool update -g Volo.Abp.Cli
+```
+
+### ABP UPDATE Command
+
+[ABP CLI](https://docs.abp.io/en/abp/latest/CLI) provides a handy command to update all the ABP related NuGet and NPM packages in your solution with a single command:
+
+```bash
+abp update
+```
+
+Run this command in the root folder of your solution.
+
+## Migration Guide
+
+Check [the migration guide](https://docs.abp.io/en/abp/5.2/Migration-Guides/Abp-5_2) for the applications with the version 5.x upgrading to the version 5.2.
+
+## About the Next Version
+
+The next feature version will be 5.3. It is planned to release the 5.3 RC (Release Candidate) on May 03 and the final version on May 31, 2022. You can follow the [release planning here](https://github.com/abpframework/abp/milestones).
+
+Please [submit an issue](https://github.com/abpframework/abp/issues/new) if you have any problem with this version.
diff --git a/docs/en/CLI.md b/docs/en/CLI.md
index d381290508..72fe0cf221 100644
--- a/docs/en/CLI.md
+++ b/docs/en/CLI.md
@@ -18,13 +18,13 @@ dotnet tool update -g Volo.Abp.Cli
## Global Options
-While each command may have a set of options, there are some global options those can be used with any command;
+While each command may have a set of options, there are some global options that can be used with any command;
* `--skip-cli-version-check`: Skips to check the latest version of the ABP CLI. If you don't specify, it will check the latest version and shows a warning message if there is a newer version of the ABP CLI.
## Commands
-Here, the list of all available commands before explaining their details:
+Here, is the list of all available commands before explaining their details:
* **`help`**: Shows help on the usage of the ABP CLI.
* **`new`**: Generates a new solution based on the ABP [startup templates](Startup-Templates/Index.md).
@@ -115,6 +115,7 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample
* `--database-provider` or `-d`: Specifies the database provider. Default provider is `ef`. Available providers:
* `ef`: Entity Framework Core.
* `mongodb`: MongoDB.
+ * `--pwa`: Specifies to Configure Angular or Blazor WebAssembly project as Progressive Web Application.
* `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory.
* `--version` or `-v`: Specifies the ABP & template version. It can be a [release tag](https://github.com/abpframework/abp/releases) or a [branch name](https://github.com/abpframework/abp/branches). Uses the latest release if not specified. Most of the times, you will want to use the latest version.
* `--preview`: Use latest preview version.
diff --git a/docs/en/Caching.md b/docs/en/Caching.md
index 13129bbc95..074d6d951f 100644
--- a/docs/en/Caching.md
+++ b/docs/en/Caching.md
@@ -258,7 +258,7 @@ ABP's distributed cache interfaces provide methods to perform batch methods thos
Distributed cache service provides an interesting feature. Assume that you've updated the price of a book in the database, then set the new price to the cache, so you can use the cached value later. What if you have an exception after setting the cache and you **rollback the transaction** that updates the price of the book? In this case, cache value will be incorrect.
-`IDistributedCache<..>` methods gets an optional parameter, named `considerOuw`, which is `false` by default. If you set it to `true`, then the changes you made for the cache are not actually applied to the real cache store, but associated with the current [unit of work](Unit-Of-Work.md). You get the value you set in the same unit of work, but the changes are applied **only if the current unit of work succeed**.
+`IDistributedCache<..>` methods gets an optional parameter, named `considerUow`, which is `false` by default. If you set it to `true`, then the changes you made for the cache are not actually applied to the real cache store, but associated with the current [unit of work](Unit-Of-Work.md). You get the value you set in the same unit of work, but the changes are applied **only if the current unit of work succeed**.
### IDistributedCacheSerializer
diff --git a/docs/en/Community-Articles/2022-04-06-Concurrency-Check-in-ABP-Based-Applications/POST.md b/docs/en/Community-Articles/2022-04-06-Concurrency-Check-in-ABP-Based-Applications/POST.md
new file mode 100644
index 0000000000..b16d6bd9f1
--- /dev/null
+++ b/docs/en/Community-Articles/2022-04-06-Concurrency-Check-in-ABP-Based-Applications/POST.md
@@ -0,0 +1,548 @@
+# Handle Concurrency with EF Core in an ABP Framework Project with ASP.NET Core MVC
+
+In this article, we'll create a basic application to demonstrate how "Concurrency Check/Control" can be implemented in an ABP project.
+
+## Creating the Solution
+
+For this article, we will create a simple BookStore application and add CRUD functionality to the pages. Hence we deal with the concurrency situation.
+
+We can create a new startup template with EF Core as a database provider and MVC for the UI Framework.
+
+> If you already have a project, you don't need to create a new startup template, you can directly implement the following steps to your project. So you can skip this section.
+
+We can create a new startup template by using the [ABP CLI](https://docs.abp.io/en/abp/latest/CLI).
+
+```bash
+abp new Acme.BookStore
+```
+
+After running the above command, our project boilerplate will be downloaded. Then we can open the solution and start the development.
+
+## Starting the Development
+
+Let's start with defining our entities.
+
+### Creating Entities
+
+Create a `Book.cs` (/Books/Book.cs) class in the `.Domain` layer:
+
+```csharp
+public class Book : AuditedAggregateRoot
+{
+ public string Name { get; set; }
+
+ public BookType Type { get; set; }
+
+ public DateTime PublishDate { get; set; }
+
+ public float Price { get; set; }
+}
+```
+
+* To enable **Concurrency Check** for our entities, our entities should be implemented the `IHasConcurrencyStamp` interface, directly or indirectly.
+
+* [Aggregate Root](https://docs.abp.io/en/abp/5.2/Entities#aggregateroot-class) entity classes already implement the `IHasConcurrencyStamp` interface, so if we inherit our entities from one of these entity classes then we won't need to manually implement the `IHasConcurrencyStamp` interface.
+
+* And we've derived the `Book` entity from `AuditedAggregateRoot` here, so we don't need to implement the `IHasConcurrencyStamp` interface because `AuditedAggregateRoot` class already implemented the `IHasConcurrencyStamp` interface.
+
+> You can read more details from the [Concurrency Check](https://docs.abp.io/en/abp/5.2/Concurrency-Check) documentation.
+
+Then, create a `BookType` (/Books/BookType.cs) enum in the `.Domain.Shared` layer:
+
+```csharp
+public enum BookType
+{
+ Undefined,
+ Adventure,
+ Biography,
+ Dystopia,
+ Fantastic,
+ Horror,
+ Science,
+ ScienceFiction,
+ Poetry
+}
+```
+
+### Database Integration
+
+Open the `BookStoreDbContext` (/EntityFrameworkCore/BookStoreDbContext.cs) class in the `*.EntityFrameworkCore` project and add the following `DbSet` statement:
+
+```csharp
+namespace Acme.BookStore.EntityFrameworkCore;
+
+[ReplaceDbContext(typeof(IIdentityDbContext))]
+[ReplaceDbContext(typeof(ITenantManagementDbContext))]
+[ConnectionStringName("Default")]
+public class BookStoreDbContext :
+ AbpDbContext,
+ IIdentityDbContext,
+ ITenantManagementDbContext
+{
+ //Entities from the modules
+
+ public DbSet Books { get; set; } //add this line
+}
+```
+
+Then we can navigate to the `OnModelCreating` method in the same class and configure our tables/entities:
+
+```csharp
+protected override void OnModelCreating(ModelBuilder builder)
+{
+ base.OnModelCreating(builder);
+
+ /* Include modules to your migration db context */
+
+ builder.ConfigurePermissionManagement();
+ ...
+
+ //* Configure your own tables/entities inside here */
+
+ builder.Entity(b =>
+ {
+ b.ToTable(BookStoreConsts.DbTablePrefix + "Books",
+ BookStoreConsts.DbSchema);
+ b.ConfigureByConvention(); //auto configure for the base class props
+ b.Property(x => x.Name).IsRequired().HasMaxLength(128);
+ });
+}
+```
+
+After the mapping configurations, we can create a new migration and apply changes to the database.
+
+To do this, open your command line terminal in the directory of the `EntityFrameworkCore` project and run the below command:
+
+```bash
+dotnet ef migrations add Added_Books
+```
+
+After this command, a new migration will be generated and then we can run the `*.DbMigrator` project to apply the last changes to the database such as creating a new table named `Books` according to the last created migration.
+
+### Defining DTOs and Application Service Interfaces
+
+We can start to define the use cases of the application.
+
+Create the DTO classes (under the **Books** folder) in the `Application.Contracts` project:
+
+**BookDto.cs**
+
+```csharp
+public class BookDto : AuditedEntityDto, IHasConcurrencyStamp
+{
+ public string Name { get; set; }
+
+ public BookType Type { get; set; }
+
+ public DateTime PublishDate { get; set; }
+
+ public float Price { get; set; }
+
+ public string ConcurrencyStamp { get; set; }
+}
+```
+
+* The `AuditedEntityDto` class is not implemented from the `IHasConcurrencyStamp` interface, so for the **BookDto** class we need to implement the `IHasConcurrencyStamp`.
+
+* This is important, because we need to return books with their **ConcurrencyStamp** value.
+
+**CreateBookDto.cs**
+
+```csharp
+public class CreateBookDto
+{
+ [Required]
+ [StringLength(128)]
+ public string Name { get; set; }
+
+ [Required]
+ public BookType Type { get; set; } = BookType.Undefined;
+
+ [Required]
+ [DataType(DataType.Date)]
+ public DateTime PublishDate { get; set; } = DateTime.Now;
+
+ [Required]
+ public float Price { get; set; }
+}
+```
+
+**UpdateBookDto.cs**
+
+```csharp
+public class UpdateBookDto : IHasConcurrencyStamp
+{
+ [Required]
+ [StringLength(128)]
+ public string Name { get; set; }
+
+ [Required]
+ public BookType Type { get; set; } = BookType.Undefined;
+
+ [Required]
+ [DataType(DataType.Date)]
+ public DateTime PublishDate { get; set; } = DateTime.Now;
+
+ [Required]
+ public float Price { get; set; }
+
+ public string ConcurrencyStamp { get; set; }
+}
+```
+
+* Here, we've implemented the `IHasConcurrencyStamp` interface for the **UpdateBookDto** class.
+
+* We will use this value while updating an existing book. ABP Framework will compare the current book's **ConcurrencyStamp** value with the provided one, if values are matched, this means everything is as it is supposed to be and will update the record.
+
+* If values are mismatched, then it means the record that we're trying to update is already updated by another user and we need to get the latest changes to be able to make changes on it.
+
+* Also, in that case, `AbpDbConcurrencyException` will be thrown by the ABP Framework and we can either handle this exception manually or let the ABP Framework handle it on behalf of us and show a user-friendly error message as in the image below.
+
+
+
+Create a new `IBookAppService` (/Books/IBookAppService.cs) interface in the `Application.Contracts` project:
+
+```csharp
+public interface IBookAppService :
+ ICrudAppService
+{
+}
+```
+* We've implemented the `ICrudAppService` here, because we just need to perform CRUD operations and this interface helps us define common CRUD operation methods.
+
+### Application Service Implementations
+
+Create a `BookAppService` (/Books/BookAppService.cs) class inside the `*.Application` project and implement the application service methods, as shown below:
+
+```csharp
+public class BookAppService :
+ CrudAppService,
+ IBookAppService
+{
+ public BookAppService(IRepository repository)
+ : base(repository)
+ {
+ }
+
+ public override async Task UpdateAsync(Guid id, UpdateBookDto input)
+ {
+ var book = await Repository.GetAsync(id);
+
+ book.Name = input.Name;
+ book.Price = input.Price;
+ book.Type = input.Type;
+ book.PublishDate = input.PublishDate;
+
+ //set Concurrency Stamp value to the entity
+ book.ConcurrencyStamp = input.ConcurrencyStamp;
+
+ var updatedBook = await Repository.UpdateAsync(book);
+ return ObjectMapper.Map(updatedBook);
+ }
+}
+```
+
+* We've used the `CrudAppService` base class. This class implements all common CRUD operations and if we want to change a method, we can simply override the method and change it to our needs.
+
+> Normally, you don't need to override the `UpdateAsync` method to do **Concurrency Check**. Because the `UpdateAsync` method of the `CrudAppService` class by default map input values to the entity. But I wanted to override this method to show what we need to do for **Concurrency Check**.
+
+* We can look closer to the `UpdateAsync` method here, because as we've mentioned earlier we need to pass the provided **ConcurrencyStamp** value to be able to do **Concurrency Check/Control** to our entity while updating.
+
+* At that point, if the given record is already updated by any other user, a **ConcurrencyStamp** mismatch will occur and `AbpDbConcurrencyException` will be thrown thanks to the **Concurrency Check** system of ABP, data-consistency will be provided and the current record won't be overridden.
+
+* And if the values are matched, the record will be updated successfully.
+
+After implementing the application service methods, we can do the related mapping configurations, so open the `BookStoreApplicationAutoMapperProfile.cs` and update the content as below:
+
+```csharp
+public class BookStoreApplicationAutoMapperProfile : Profile
+{
+ public BookStoreApplicationAutoMapperProfile()
+ {
+ CreateMap();
+ CreateMap();
+ }
+}
+```
+
+### User Interface
+
+So far, we've applied the all necessary steps for the **Concurrency Check** system, let's see it in action.
+
+Create a razor page in the `.Web` layer named `Index` (**/Pages/Books/Index.cshtml**), open this file and replace the content with the following code block:
+
+```html
+@page
+@using Acme.BookStore.Localization
+@using Microsoft.Extensions.Localization
+@model Acme.BookStore.Web.Pages.Books.Index
+
+@section scripts
+{
+
+}
+
+
+
+
+
+ Books
+
+
+
+
+
+
+
+
+
+
+```
+
+* We've defined a table and "New Book" button inside a card element here, we'll fill the table with our book records in the next step by using the **Datatables** library.
+
+Create an `Index.js` (**/Pages/Books/Index.js**) file and add the following code block:
+
+```js
+$(function () {
+ var l = abp.localization.getResource('BookStore');
+ var createModal = new abp.ModalManager(abp.appPath + 'Books/CreateModal');
+ var editModal = new abp.ModalManager(abp.appPath + 'Books/EditModal');
+
+ var dataTable = $('#BooksTable').DataTable(
+ abp.libs.datatables.normalizeConfiguration({
+ serverSide: true,
+ paging: true,
+ order: [[1, "asc"]],
+ searching: false,
+ scrollX: true,
+ ajax: abp.libs.datatables.createAjax(acme.bookStore.books.book.getList),
+ columnDefs: [
+ {
+ title: l('Actions'),
+ rowAction: {
+ items:
+ [
+ {
+ text: l('Edit'),
+ action: function (data) {
+ editModal.open({ id: data.record.id });
+ }
+ }
+ ]
+ }
+ },
+ {
+ title: l('Name'),
+ data: "name"
+ },
+ {
+ title: l('Type'),
+ data: "type",
+ render: function (data) {
+ return l('Enum:BookType:' + data);
+ }
+ },
+ {
+ title: l('PublishDate'),
+ data: "publishDate",
+ render: function (data) {
+ return luxon
+ .DateTime
+ .fromISO(data, {
+ locale: abp.localization.currentCulture.name
+ }).toLocaleString();
+ }
+ },
+ {
+ title: l('Price'),
+ data: "price"
+ },
+ {
+ title: l('CreationTime'),
+ data: "creationTime",
+ render: function (data) {
+ return luxon
+ .DateTime
+ .fromISO(data, {
+ locale: abp.localization.currentCulture.name
+ }).toLocaleString(luxon.DateTime.DATETIME_SHORT);
+ }
+ }
+ ]
+ })
+ );
+
+ createModal.onResult(function () {
+ dataTable.ajax.reload();
+ });
+
+ editModal.onResult(function () {
+ dataTable.ajax.reload();
+ });
+
+ $('#NewBookButton').click(function (e) {
+ e.preventDefault();
+ createModal.open();
+ });
+});
+```
+
+* We've used the [Datatables](https://datatables.net/) to list our books.
+
+* Also defined **create** and **update** modals by using [ABP Modal Manager](https://docs.abp.io/en/abp/latest/UI/AspNetCore/Modals#modalmanager-reference), but we didn't create them yet, so let's create the modals.
+
+First, create a **CreateModal** razor page and update the **CreateModal.cshtml** and **CreateModal.cshtml.cs** files as below:
+
+**CreateModal.cshtml**
+
+```html
+@page
+@using Acme.BookStore.Web.Pages.Books
+@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
+@model CreateModalModel
+@{
+ Layout = null;
+}
+
+
+
+
+
+
+
+
+
+```
+
+* We've used `abp-dynamic-form` tag-helper and passed it a `Book` model, this tag helper will simply create form contents (inputs, select boxes etc.) on behalf of us.
+
+* **CreateModal.cshtml.cs**
+
+```csharp
+using System.Threading.Tasks;
+using Acme.BookStore.Books;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Acme.BookStore.Web.Pages.Books;
+
+public class CreateModalModel : BookStorePageModel
+{
+ [BindProperty]
+ public CreateBookDto Book { get; set; }
+
+ private readonly IBookAppService _bookAppService;
+
+ public CreateModalModel(IBookAppService bookAppService)
+ {
+ _bookAppService = bookAppService;
+ }
+
+ public void OnGet()
+ {
+ Book = new CreateBookDto();
+ }
+
+ public async Task OnPostAsync()
+ {
+ await _bookAppService.CreateAsync(Book);
+ return NoContent();
+ }
+}
+```
+
+* In this file, we simply define **CreateBookDto** as a bind property and we'll use this class's properties in the form. Thanks to the `abp-dynamic-form` tag-helper we don't need to define all of these form elements one by one, it will generate on behalf of us.
+
+We can create an **EditModal** razor page and update the **EditModal.cshtml** and **EditModal.cshtml.cs** files as below:
+
+**EditModal.cshtml**
+
+```html
+@page
+@using Acme.BookStore.Web.Pages.Books
+@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
+@model EditModalModel
+@{
+ Layout = null;
+}
+
+```
+
+* Here, we didn't use the `abp-dynamic-form` tag-helper and added all the necessary form elements to our form one by one.
+
+* As you may have noticed, we've set the input type as **hidden** for the **ConcurrencyStamp** input, because the end-user should not see this value.
+
+> Instead of doing it like that, we could create a view model class and use the `[HiddenInput]` data attribute for the **ConcurrencyStamp** property and use the `abp-dynamic-form` tag-helper. But to simplify the article I didn't want to do that, if you want you can create a view model and define the necessary data attributes for properties.
+
+**EditModal.cshtml.cs**
+
+```csharp
+public class EditModalModel : BookStorePageModel
+{
+ [HiddenInput]
+ [BindProperty(SupportsGet = true)]
+ public Guid Id { get; set; }
+
+ [BindProperty]
+ public UpdateBookDto Book { get; set; }
+
+ private readonly IBookAppService _bookAppService;
+
+ public EditModalModel(IBookAppService bookAppService)
+ {
+ _bookAppService = bookAppService;
+ }
+
+ public async Task OnGetAsync()
+ {
+ var bookDto = await _bookAppService.GetAsync(Id);
+ Book = ObjectMapper.Map(bookDto);
+ }
+
+ public async Task OnPostAsync()
+ {
+ await _bookAppService.UpdateAsync(Id, Book);
+ return NoContent();
+ }
+}
+```
+
+Lastly, we can define the necessary mapping configurations and run the application to see the result.
+
+Open the `BookStoreWebAutoMapperProfile.cs` class and update the content as below:
+
+```csharp
+public class BookStoreWebAutoMapperProfile : Profile
+{
+ public BookStoreWebAutoMapperProfile()
+ {
+ CreateMap();
+ }
+}
+```
+
+Then we can run the application, navigate to the **/Books** endpoint and see the result.
+
+
+
+* In the image above, we can see that multiple users open the edit model to change a record and try to update the relevant record independently of each other.
+
+* After the first user updated the record, the second user tries to update the same record without getting the last state of the record. And therefore `AbpDbConcurrencyException` is thrown because **ConcurrencyStamp** values are different from each other.
+
+* The second user should close and re-open the model to get the last state of the record and then they can make changes to the current record.
diff --git a/docs/en/Community-Articles/2022-04-06-Concurrency-Check-in-ABP-Based-Applications/concurrency-mismatch.gif b/docs/en/Community-Articles/2022-04-06-Concurrency-Check-in-ABP-Based-Applications/concurrency-mismatch.gif
new file mode 100644
index 0000000000..922bb5b7ca
Binary files /dev/null and b/docs/en/Community-Articles/2022-04-06-Concurrency-Check-in-ABP-Based-Applications/concurrency-mismatch.gif differ
diff --git a/docs/en/Community-Articles/2022-04-06-Concurrency-Check-in-ABP-Based-Applications/optimistic-concurrency.png b/docs/en/Community-Articles/2022-04-06-Concurrency-Check-in-ABP-Based-Applications/optimistic-concurrency.png
new file mode 100644
index 0000000000..85253594c8
Binary files /dev/null and b/docs/en/Community-Articles/2022-04-06-Concurrency-Check-in-ABP-Based-Applications/optimistic-concurrency.png differ
diff --git a/docs/en/Community-Articles/2022-04-14-Dependency-Injection/POST.md b/docs/en/Community-Articles/2022-04-14-Dependency-Injection/POST.md
index edd74c1591..092fb72dbc 100644
--- a/docs/en/Community-Articles/2022-04-14-Dependency-Injection/POST.md
+++ b/docs/en/Community-Articles/2022-04-14-Dependency-Injection/POST.md
@@ -18,15 +18,15 @@ public class ElasticsearchExternalLogger : IExternalLogger
{
public async Task LogAsync(string logText)
{
- //TODO...
+ // TODO...
}
}
public class AzureExternalLogger : IExternalLogger
{
- public Task LogAsync(string logText)
+ public async Task LogAsync(string logText)
{
- throw new System.NotImplementedException();
+ // TODO...
}
}
````
diff --git a/docs/en/Modules/Cms-Kit/Blogging.md b/docs/en/Modules/Cms-Kit/Blogging.md
index 43ab85e129..12039b1669 100644
--- a/docs/en/Modules/Cms-Kit/Blogging.md
+++ b/docs/en/Modules/Cms-Kit/Blogging.md
@@ -33,7 +33,12 @@ Blog feature uses some of the other CMS Kit features. You can enable or disable
You can select/deselect the desired features for blog posts.
-
+
+
+##### Quick Navigation Bar In Blog Post
+If you enable "Quick navigation bar in blog posts", it will enabled scroll index as seen below.
+
+
### Blog Post Management
diff --git a/docs/en/images/cmskit-module-features-dialog-2.png b/docs/en/images/cmskit-module-features-dialog-2.png
new file mode 100644
index 0000000000..b6dd409e0a
Binary files /dev/null and b/docs/en/images/cmskit-module-features-dialog-2.png differ
diff --git a/docs/en/images/cmskit-module-features-scroll-index.png b/docs/en/images/cmskit-module-features-scroll-index.png
new file mode 100644
index 0000000000..0bc3dedcc5
Binary files /dev/null and b/docs/en/images/cmskit-module-features-scroll-index.png differ
diff --git a/docs/zh-Hans/Caching.md b/docs/zh-Hans/Caching.md
index a75199ce47..d8f064a24e 100644
--- a/docs/zh-Hans/Caching.md
+++ b/docs/zh-Hans/Caching.md
@@ -1,164 +1,180 @@
# 缓存
-ABP框架扩展了ASP.NET Core的分布式缓存系统.
+ABP框架扩展了 [ASP.NET Core的分布式缓存系统](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed).
-## Volo.Abp.Caching Package
+## 安装
-> 默认情况下启动模板已经安装了这个包,所以大部分情况下你不需要手动安装.
+> 默认情况下 [启动模板](Startup-Templates/Application.md) 已经安装了这个包. 所以大部分情况下你不需要手动安装.
-Volo.Abp.Caching是缓存系统的核心包.使用包管理控制台(PMC)安装到项目:
+[Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching)是缓存系统的核心包. 可以使用 [ABP CLI](CLI.md) 的add-package命令将其安装到项目中:
```
-Install-Package Volo.Abp.Caching
+abp add-package Volo.Abp.Caching
```
+你需要在包含 `csproj` 文件的文件夹中的命令行终端上运行此命令(请参阅 [其他选项](https://abp.io/package-detail/Volo.Abp.Caching) 安装).
-然后将 **AbpCachingModule** 依赖添加到你的模块:
+## 使用方式
-```c#
-using Volo.Abp.Modularity;
-using Volo.Abp.Caching;
-
-namespace MyCompany.MyProject
-{
- [DependsOn(typeof(AbpCachingModule))]
- public class MyModule : AbpModule
- {
- //...
- }
-}
-```
-
-## `IDistributedCache` 接口
+### `IDistributedCache` 接口
-ASP.NET Core 定义了 `IDistributedCache` 接口用于 get/set 缓存值 . 但是会有以下问题:
+ASP.NET Core 定义了 `IDistributedCache` 接口用于 get/set 缓存值. 但是会有以下问题:
* 它适用于 **byte 数组** 而不是 .NET 对象. 因此你需要对缓存的对象进行**序列化/反序列化**.
-* 它为所有的缓存项提供了 **单个 key 池** , 因此 ;
+* 它为所有的缓存项提供了 **单个 key 池** , 因此;
* 你需要注意键区分 **不同类型的对象**.
* 你需要注意**不同租户**(参见[多租户](Multi-Tenancy.md))的缓存项.
> `IDistributedCache` 定义在 `Microsoft.Extensions.Caching.Abstractions` 包中. 这使它不仅适用于ASP.NET Core应用程序, 也可用于**任何类型的程序**.
-> `IDistributedCache` 接口的默认实现是 `MemoryDistributedCache` 它使用**内存**工作. 参见 [ASP.NET Core文档](https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed) 了解如何切换到 **Redis** 或其他缓存提供程序.
+> `IDistributedCache` 接口的默认实现是 `MemoryDistributedCache` 它使用**内存**工作. 参见 [ASP.NET Core文档](https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed) 了解如何切换到 **Redis** 或其他缓存提供程序. 此外, 如果要将Redis用作分布式缓存服务器, [Redis缓存](Redis-Cache.md) 文档.
有关更多信息, 参见 [ASP.NET Core 分布式缓存文档](https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed).
-## `IDistributedCache` 接口
+### `IDistributedCache` 接口
ABP框架在[Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching/)包定义了通用的泛型 `IDistributedCache` 接口. `TCacheItem` 是存储在缓存中的对象类型.
-`IDistributedCache` 接口了上述中的问题;
+`IDistributedCache` 接口解决了上述中的问题;
* 它在内部 **序列化/反序列化** 缓存对象. 默认使用 **JSON** 序列化, 但可以替换[依赖注入](Dependency-Injection.md)系统中 `IDistributedCacheSerializer` 服务的实现来覆盖默认的处理.
-* 它根据缓存中对象类型自动向缓存key添加 **缓存名称** 前缀. 默认缓存名是缓存对象类的全名(如果你的类名以`CacheItem` 结尾, 那么`CacheItem` 会被忽略,不应用到缓存名称上). 你也可以在缓存类上使用 `CacheName` 设置换缓存的名称.
-* 它自动将当前的**租户id**添加到缓存键中, 以区分不同租户的缓存项 (只有在你的应用程序是[多租户](Multi-Tenancy.md)的情况下生效). 在缓存类上应用 `IgnoreMultiTenancy` attribute, 可以在所有的租户间共享缓存.
-* 允许为每个应用程序定义 **全局缓存键前缀** ,不同的应用程序可以在共享的分布式缓存中拥有自己的隔离池.
+* 它根据缓存中对象类型自动向缓存key添加 **缓存名称** 前缀. 默认缓存名是缓存对象类的全名(如果你的类名以`CacheItem` 结尾, 那么`CacheItem` 会被忽略,不应用到缓存名称上). 你也可以在缓存类上使用 **`CacheName` 特性** 设置缓存的名称.
+* 它自动将**当前的租户id**添加到缓存键中, 以区分不同租户的缓存项 (只有在你的应用程序是[多租户](Multi-Tenancy.md)的情况下生效). 如果要在多租户应用程序中的所有租户之间共享缓存对象, 请在缓存项类上定义`IgnoreMultiTenancy`特性以禁用此选项.
+* 允许为每个应用程序定义 **全局缓存键前缀** , 不同的应用程序可以在共享的分布式缓存中拥有自己的隔离池.
+* 它可以在任何可能绕过缓存的情况下 **容忍错误** 的发生. 这在缓存服务器出现临时问题时非常有用.
+* 它有 `GetManyAsync` 和 `SetManyAsync` 等方法, 可以显著提高**批处理**的性能.
-### 使用方式
-
-缓存中存储项的示例类:
+**示例: 在缓存中存储图书名称和价格**
````csharp
-public class BookCacheItem
+namespace MyProject
{
- public string Name { get; set; }
+ public class BookCacheItem
+ {
+ public string Name { get; set; }
- public float Price { get; set; }
+ public float Price { get; set; }
+ }
}
````
你可以注入 `IDistributedCache` 服务用于 get/set `BookCacheItem` 对象.
-使用示例:
-
````csharp
-public class BookService : ITransientDependency
-{
- private readonly IDistributedCache _cache;
-
- public BookService(IDistributedCache cache)
- {
- _cache = cache;
- }
-
- public async Task GetAsync(Guid bookId)
- {
- return await _cache.GetOrAddAsync(
- bookId.ToString(), //Cache key
- async () => await GetBookFromDatabaseAsync(bookId),
- () => new DistributedCacheEntryOptions
- {
- AbsoluteExpiration = DateTimeOffset.Now.AddHours(1)
- }
- );
- }
+using System;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Caching.Distributed;
+using Volo.Abp.Caching;
+using Volo.Abp.DependencyInjection;
- private Task GetBookFromDatabaseAsync(Guid bookId)
+namespace MyProject
+{
+ public class BookService : ITransientDependency
{
- //TODO: get from database
+ private readonly IDistributedCache _cache;
+
+ public BookService(IDistributedCache cache)
+ {
+ _cache = cache;
+ }
+
+ public async Task GetAsync(Guid bookId)
+ {
+ return await _cache.GetOrAddAsync(
+ bookId.ToString(), //缓存键
+ async () => await GetBookFromDatabaseAsync(bookId),
+ () => new DistributedCacheEntryOptions
+ {
+ AbsoluteExpiration = DateTimeOffset.Now.AddHours(1)
+ }
+ );
+ }
+
+ private Task GetBookFromDatabaseAsync(Guid bookId)
+ {
+ //TODO: 从数据库获取数据
+ }
}
}
````
-* 示例服务代码中的 `GetOrAddAsync()` 方法从缓存中获取图书项.
+* 示例服务代码中的 `GetOrAddAsync()` 方法从缓存中获取图书项. `GetOrAddAsync`是ABP框架在 ASP.NET Core 分布式缓存方法中添增的附加方法.
* 如果没有在缓存中找到图书,它会调用工厂方法 (本示例中是 `GetBookFromDatabaseAsync`)从原始数据源中获取图书项.
* `GetOrAddAsync` 有一个可选参数 `DistributedCacheEntryOptions` , 可用于设置缓存的生命周期.
-`IDistributedCache` 的其他方法与ASP.NET Core的`IDistributedCache` 接口相同, 你可以参考 [ASP.NET Core文档](https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed).
+`IDistributedCache` 与ASP.NET Core的`IDistributedCache` 接口拥有相同的方法, 你可以参考 [ASP.NET Core文档](https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed).
-## `IDistributedCache` 接口
+### `IDistributedCache` 接口
-`IDistributedCache` 接口默认了键是 `string` 类型 (如果你的键不是string类型需要进行手动类型转换). `IDistributedCache` 将键的类型泛型化试图简化手动转换的操作.
+`IDistributedCache` 接口默认了**缓存键**是 `string` 类型 (如果你的键不是string类型需要进行手动类型转换). 但当缓存键的类型不是`string`时, 可以使用`IDistributedCache`.
-### 使用示例
+**示例: 在缓存中存储图书名称和价格**
示例缓存项
````csharp
-public class BookCacheItem
+using Volo.Abp.Caching;
+
+namespace MyProject
{
- public string Name { get; set; }
+ [CacheName("Books")]
+ public class BookCacheItem
+ {
+ public string Name { get; set; }
- public float Price { get; set; }
+ public float Price { get; set; }
+ }
}
````
-用法示例 (这里假设你的键类型是 `Guid`):
+* 在本例中使用`CacheName`特性给`BookCacheItem`类设置缓存名称.
-````csharp
-public class BookService : ITransientDependency
-{
- private readonly IDistributedCache _cache;
+你可以注入 `IDistributedCache` 服务用于 get/set `BookCacheItem` 对象.
- public BookService(IDistributedCache cache)
- {
- _cache = cache;
- }
+````csharp
+using System;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Caching.Distributed;
+using Volo.Abp.Caching;
+using Volo.Abp.DependencyInjection;
- public async Task GetAsync(Guid bookId)
- {
- return await _cache.GetOrAddAsync(
- bookId, //Guid type used as the cache key
- async () => await GetBookFromDatabaseAsync(bookId),
- () => new DistributedCacheEntryOptions
- {
- AbsoluteExpiration = DateTimeOffset.Now.AddHours(1)
- }
- );
- }
- private Task GetBookFromDatabaseAsync(Guid bookId)
+namespace MyProject
+{
+ public class BookService : ITransientDependency
{
- //TODO: get from database
+ private readonly IDistributedCache _cache;
+
+ public BookService(IDistributedCache cache)
+ {
+ _cache = cache;
+ }
+
+ public async Task GetAsync(Guid bookId)
+ {
+ return await _cache.GetOrAddAsync(
+ bookId, //Guid类型作为缓存键
+ async () => await GetBookFromDatabaseAsync(bookId),
+ () => new DistributedCacheEntryOptions
+ {
+ AbsoluteExpiration = DateTimeOffset.Now.AddHours(1)
+ }
+ );
+ }
+ private Task GetBookFromDatabaseAsync(Guid bookId)
+ {
+ //TODO: 从数据库获取数据
+ }
}
}
````
* 示例服务中 `GetOrAddAsync()` 方法获取缓存的图书项.
-* 我们采用了 `Guid` 做为键,在 `_cache_GetOrAddAsync()` 方法中传入 `Guid` 类型的bookid.
+* 我们采用了 `Guid` 做为键, 在 `_cache_GetOrAddAsync()` 方法中传入 `Guid` 类型的bookid.
+
+#### 复杂类型的缓存键
-`IDistributedCache` 在内部使用键对象的 `ToString()` 方法转换类型为string. 如果你的将复杂对象做为键,那么需要重写类的 `ToString` 方法.
+`IDistributedCache` 在内部使用键对象的 `ToString()` 方法转换类型为string. 如果你的将复杂对象做为缓存键,那么需要重写类的 `ToString` 方法.
-示例:
+举例一个作为缓存键的类:
````csharp
public class UserInOrganizationCacheKey
@@ -187,23 +203,72 @@ public class BookService : ITransientDependency
{
_cache = cache;
}
-
+
...
}
````
+## 配置
+
+### AbpDistributedCacheOptions
+`AbpDistributedCacheOptions` 是配置缓存的主要[Option类](Options.md).
+
+**示例:为应用程序设置缓存键前缀**
+
+```csharp
+Configure(options =>
+{
+ options.KeyPrefix = "MyApp1";
+});
+```
+> 在[模块类](Module-Development-Basics.md)的`ConfigureServices`方法中添加代码.
+
+#### 可用选项
+
+* `HideErrors` (`bool`, 默认: `true`): 启用/禁用隐藏从缓存服务器写入/读取值时的错误.
+* `KeyPrefix` (`string`, 默认: `null`): 如果你的缓存服务器由多个应用程序共同使用, 则可以为应用程序的缓存键设置一个前缀. 在这种情况下, 不同的应用程序不能覆盖彼此的缓存内容.
+* `GlobalCacheEntryOptions` (`DistributedCacheEntryOptions`): 用于设置保存缓内容却没有指定选项时, 默认的分布式缓存选项 (例如 `AbsoluteExpiration` 和 `SlidingExpiration`). `SlidingExpiration`的默认值设置为20分钟.
+
+## 错误处理
+
+当为你的对象设计缓存时, 通常会首先尝试从缓存中获取值. 如果在缓存中找不到该值, 则从**来源**查询对象. 它可能在**数据库**中, 或者可能需要通过HTTP调用远程服务器.
+
+在大多数情况下, 你希望**容忍缓存错误**; 如果缓存服务器出现错误, 也不希望取消该操作. 相反, 你可以默默地隐藏(并记录)错误并**从来源查询**. 这就是ABP框架默认的功能.
+
+ABP的分布式缓存 [异常处理](Exception-Handling.md), 默认记录并隐藏错误. 有一个全局修改该功能的选项(参见下面的选项内容).
+
+所有的`IDistributedCache` (和 `IDistributedCache`)方法都有一个可选的参数`hideErrors`, 默认值为`null`. 如果此参数设置为`null`, 则全局生效, 否则你可以选择单个方法调用时隐藏或者抛出异常.
+
## 批量操作
ABP的分布式缓存接口定义了以下批量操作方法,当你需要在一个方法中调用多次缓存操作时,这些方法可以提高性能
-* `SetManyAsync` 和 `SetMany` 方法可以用来设置多个值.
+* `SetManyAsync` 和 `SetMany` 方法可以用来向缓存中设置多个值.
* `GetManyAsync` 和 `GetMany` 方法可以用来从缓存中获取多个值.
* `GetOrAddManyAsync` 和 `GetOrAddMany` 方法可以用来从缓存中获取并添加缺少的值.
* `RefreshManyAsync` 和 `RefreshMany` 方法可以来用重置多个值的滚动过期时间.
-* `RemoveManyAsync` 和 `RemoveMany` 方法呆以用来删除多个值.
+* `RemoveManyAsync` 和 `RemoveMany` 方法可以用来从缓存中删除多个值.
> 这些不是标准的ASP.NET Core缓存方法, 所以某些提供程序可能不支持. [ABP Redis集成包](Redis-Cache.md)实现了它们. 如果提供程序不支持,会回退到 `SetAsync` 和 `GetAsync` ... 方法(循环调用).
-### DistributedCacheOptions
+## 高级主题
+
+### 工作单元级别的缓存
+
+分布式缓存服务提供了一个有趣的功能. 假设你已经更新了数据库中某本书的价格, 然后将新价格设置到缓存中, 以便以后使用缓存的值. 如果设置缓存后出现异常, 并且更新图书价格的**事务被回滚了**, 该怎么办?在这种情况下, 缓存值是错误的.
+
+`IDistributedCache<..>`方法提供一个可选参数, `considerUow`, 默认为`false`. 如果将其设置为`true`, 则你对缓存所做的更改不会应用于真正的缓存存储, 而是与当前的[工作单元](Unit-Of-Work.md)关联. 你将获得在同一工作单元中设置的缓存值, 但**仅当前工作单元成功时**更改才会生效.
+
+### IDistributedCacheSerializer
+
+`IDistributedCacheSerializer`服务用于序列化和反序列化缓存内容. 默认实现是`Utf8JsonDistributedCacheSerializer`类, 它使用`IJsonSerializer`服务将对象转换为[JSON](Json-Serialization.md), 反之亦然. 然后, 它使用UTC8编码将JSON字符串转换为分布式缓存接受的字节数组.
+
+如果你想实现自己的序列化逻辑, 可以自己实现并[替换](Dependency-Injection.md) 此服务.
+
+### IDistributedCacheKeyNormalizer
+
+默认情况下, `IDistributedCacheKeyNormalizer`是由`DistributedCacheKeyNormalizer`类实现的. 它将缓存名称、应用程序缓存前缀和当前租户id添加到缓存键中. 如果需要更高级的键规范化, 可以自己实现并[替换](Dependency-Injection.md)此服务.
+
+## 另请参阅
-TODO
\ No newline at end of file
+* [Redis 缓存](Redis-Cache.md)
diff --git a/docs/zh-Hans/Distributed-Event-Bus-Kafka-Integration.md b/docs/zh-Hans/Distributed-Event-Bus-Kafka-Integration.md
index f621a95fae..171fe3c23b 100644
--- a/docs/zh-Hans/Distributed-Event-Bus-Kafka-Integration.md
+++ b/docs/zh-Hans/Distributed-Event-Bus-Kafka-Integration.md
@@ -1,10 +1,10 @@
# 分布式事件总线Kafka集成
-> 本文解释了**如何配置[Kafka](https://kafka.apache.org/)**做为分布式总线提供程序. 参阅[分布式事件总线文档](Distributed-Event-Bus.md)了解如何使用分布式事件总线系统.
+> 本文解释了 **如何配置[Kafka](https://kafka.apache.org/)** 做为分布式总线提供程序. 参阅[分布式事件总线文档](Distributed-Event-Bus.md)了解如何使用分布式事件总线系统.
## 安装
-使用ABP CLI添加[Volo.Abp.EventBus.Kafka[Volo.Abp.EventBus.Kafka](https://www.nuget.org/packages/Volo.Abp.EventBus.Kafka)NuGet包到你的项目:
+使用ABP CLI添加[Volo.Abp.EventBus.Kafka](https://www.nuget.org/packages/Volo.Abp.EventBus.Kafka)NuGet包到你的项目:
* 安装[ABP CLI](https://docs.abp.io/en/abp/latest/CLI),如果你还没有安装.
* 在你想要安装 `Volo.Abp.EventBus.Kafka` 包的 `.csproj` 文件目录打开命令行(终端).
@@ -18,7 +18,7 @@
### `appsettings.json` 文件配置
-这是配置Kafka设置最简单的方法. 它也非常强大,因为你可以使用[由AspNet Core支持的](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/)的任何其他配置源(如环境变量).
+这是配置Kafka设置最简单的方法. 它也非常强大,因为你可以使用[由AspNet Core支持](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/)的任何其他配置源(如环境变量).
**示例:最小化配置与默认配置连接到本地的Kafka服务器**
@@ -160,4 +160,4 @@ Configure(options =>
});
````
-使用这些选项类可以与 `appsettings.json` 组合在一起. 在代码中配置选项属性会覆盖配置文件中的值.
\ No newline at end of file
+使用这些选项类可以与 `appsettings.json` 组合在一起. 在代码中配置选项属性会覆盖配置文件中的值.
diff --git a/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md b/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md
index ab7cb68bd7..1cd6b5b9dd 100644
--- a/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md
+++ b/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md
@@ -1,10 +1,10 @@
# 分布式事件总线RabbitMQ集成
-> 本文解释了**如何配置[RabbitMQ](https://www.rabbitmq.com/)**做为分布式总线提供程序. 参阅[分布式事件总线文档](Distributed-Event-Bus.md)了解如何使用分布式事件总线系统.
+> 本文解释了 **如何配置[RabbitMQ](https://www.rabbitmq.com/)** 做为分布式总线提供程序. 参阅[分布式事件总线文档](Distributed-Event-Bus.md)了解如何使用分布式事件总线系统.
## 安装
-使用ABP CLI添加[Volo.Abp.EventBus.RabbitMQ[Volo.Abp.EventBus.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.EventBus.RabbitMQ)NuGet包到你的项目:
+使用ABP CLI添加[Volo.Abp.EventBus.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.EventBus.RabbitMQ)NuGet包到你的项目:
* 安装[ABP CLI](https://docs.abp.io/en/abp/latest/CLI),如果你还没有安装.
* 在你想要安装 `Volo.Abp.EventBus.RabbitMQ` 包的 `.csproj` 文件目录打开命令行(终端).
@@ -18,7 +18,7 @@
### `appsettings.json` 文件配置
-这是配置RabbitMQ设置最简单的方法. 它也非常强大,因为你可以使用[由AspNet Core支持的](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/)的任何其他配置源(如环境变量).
+这是配置RabbitMQ设置最简单的方法. 它也非常强大,因为你可以使用[由AspNet Core支持](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/)的任何其他配置源(如环境变量).
**示例:最小化配置与默认配置连接到本地的RabbitMQ服务器**
@@ -151,4 +151,4 @@ Configure(options =>
});
````
-使用这些选项类可以与 `appsettings.json` 组合在一起. 在代码中配置选项属性会覆盖配置文件中的值.
\ No newline at end of file
+使用这些选项类可以与 `appsettings.json` 组合在一起. 在代码中配置选项属性会覆盖配置文件中的值.
diff --git a/docs/zh-Hans/Distributed-Event-Bus-Rebus-Integration.md b/docs/zh-Hans/Distributed-Event-Bus-Rebus-Integration.md
index 409b935ace..64fce06d1b 100644
--- a/docs/zh-Hans/Distributed-Event-Bus-Rebus-Integration.md
+++ b/docs/zh-Hans/Distributed-Event-Bus-Rebus-Integration.md
@@ -1,10 +1,10 @@
# 分布式事件总线Rebus集成
-> 本文解释了**如何配置[Rebus](http://mookid.dk/category/rebus/)**做为分布式总线提供程序. 参阅[分布式事件总线文档](Distributed-Event-Bus.md)了解如何使用分布式事件总线系统.
+> 本文解释了 **如何配置[Rebus](http://mookid.dk/category/rebus/)** 做为分布式总线提供程序. 参阅[分布式事件总线文档](Distributed-Event-Bus.md)了解如何使用分布式事件总线系统.
## 安装
-使用ABP CLI添加[Volo.Abp.EventBus.Rebus[Volo.Abp.EventBus.Rebus](https://www.nuget.org/packages/Volo.Abp.EventBus.Rebus)NuGet包到你的项目:
+使用ABP CLI添加[Volo.Abp.EventBus.Rebus](https://www.nuget.org/packages/Volo.Abp.EventBus.Rebus)NuGet包到你的项目:
* 安装[ABP CLI](https://docs.abp.io/en/abp/latest/CLI),如果你还没有安装.
* 在你想要安装 `Volo.Abp.EventBus.Rebus` 包的 `.csproj` 文件目录打开命令行(终端).
diff --git a/docs/zh-Hans/Distributed-Event-Bus.md b/docs/zh-Hans/Distributed-Event-Bus.md
index f16aa0610f..e59fa5e726 100644
--- a/docs/zh-Hans/Distributed-Event-Bus.md
+++ b/docs/zh-Hans/Distributed-Event-Bus.md
@@ -264,7 +264,7 @@ Configure(options =>
因此可以实现 `IDistributedEventHandler>` 订阅事件. 但是订阅这样的通用事件不是一个好方法,你可以为实体类型定义对应的ETO.
-**示例: 为 `Product` 声明使用 `ProductDto`**
+**示例: 为 `Product` 声明使用 `ProductEto`**
````csharp
Configure(options =>
diff --git a/docs/zh-Hans/Domain-Services.md b/docs/zh-Hans/Domain-Services.md
index 9c9bb7dfd2..a617aea645 100644
--- a/docs/zh-Hans/Domain-Services.md
+++ b/docs/zh-Hans/Domain-Services.md
@@ -1,3 +1,128 @@
-# ABP Documentation
+# 领域服务
-待添加
+## 介绍
+
+在 [领域驱动设计](Domain-Driven-Design.md) (DDD) 解决方案中,核心业务逻辑通常在聚合 ([实体](Entities.md)) 和领域服务中实现. 在以下情况下特别需要创建领域服务
+
+* 你实现了依赖于某些服务(如存储库或其他外部服务)的核心域逻辑.
+* 你需要实现的逻辑与多个聚合/实体相关,因此它不适合任何聚合.
+
+## ABP 领域服务基础设施
+
+领域服务是简单的无状态类. 虽然你不必从任何服务或接口派生,但 ABP 框架提供了一些有用的基类和约定.
+
+### DomainService 和 IDomainService
+
+从 `DomainService` 基类派生领域服务或直接实现 `IDomainService` 接口.
+
+**示例: 创建从 `DomainService` 基类派生的领域服务.**
+
+````csharp
+using Volo.Abp.Domain.Services;
+namespace MyProject.Issues
+{
+ public class IssueManager : DomainService
+ {
+
+ }
+}
+````
+
+当你这样做时:
+
+* ABP 框架自动将类注册为瞬态生命周期到依赖注入系统.
+* 你可以直接使用一些常用服务作为基础属性,而无需手动注入 (例如 [ILogger](Logging.md) and [IGuidGenerator](Guid-Generation.md)).
+
+> 建议使用 `Manager` 或 `Service` 后缀命名领域服务. 我们通常使用如上面示例中的 `Manager` 后缀.
+**示例: 实现将问题分配给用户的领域逻辑**
+
+````csharp
+public class IssueManager : DomainService
+{
+ private readonly IRepository _issueRepository;
+ public IssueManager(IRepository issueRepository)
+ {
+ _issueRepository = issueRepository;
+ }
+
+ public async Task AssignAsync(Issue issue, AppUser user)
+ {
+ var currentIssueCount = await _issueRepository
+ .CountAsync(i => i.AssignedUserId == user.Id);
+
+ //Implementing a core business validation
+ if (currentIssueCount >= 3)
+ {
+ throw new IssueAssignmentException(user.UserName);
+ }
+ issue.AssignedUserId = user.Id;
+ }
+}
+````
+
+问题是定义如下所示的 [聚合根](Entities.md):
+
+````csharp
+public class Issue : AggregateRoot
+{
+ public Guid? AssignedUserId { get; internal set; }
+
+ //...
+}
+````
+
+* 使用 `internal` 的 set 确保外层调用者不能直接在调用 set ,并强制始终使用 `IssueManager` 为 `User` 分配 `Issue`.
+
+### 使用领域服务
+
+领域服务通常用于 [应用程序服务](Application-Services.md).
+
+**示例: 使用 `IssueManager` 将问题分配给用户**
+
+````csharp
+using System;
+using System.Threading.Tasks;
+using MyProject.Users;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+namespace MyProject.Issues
+{
+ public class IssueAppService : ApplicationService, IIssueAppService
+ {
+ private readonly IssueManager _issueManager;
+ private readonly IRepository _userRepository;
+ private readonly IRepository _issueRepository;
+ public IssueAppService(
+ IssueManager issueManager,
+ IRepository userRepository,
+ IRepository issueRepository)
+ {
+ _issueManager = issueManager;
+ _userRepository = userRepository;
+ _issueRepository = issueRepository;
+ }
+ public async Task AssignAsync(Guid id, Guid userId)
+ {
+ var issue = await _issueRepository.GetAsync(id);
+ var user = await _userRepository.GetAsync(userId);
+ await _issueManager.AssignAsync(issue, user);
+ await _issueRepository.UpdateAsync(issue);
+ }
+ }
+}
+````
+
+由于 `IssueAppService` 在应用层, 它不能直接将问题分配给用户.因此,它使用 `IssueManager`.
+
+## 应用程序服务与领域服务
+
+虽然应用服务和领域服务都实现了业务规则,但存在根本的逻辑和形式差异;
+虽然 [应用服务](Application-Services.md) 和领域服务都实现了业务规则,但存在根本的逻辑和形式差异:
+
+* 应用程序服务实现应用程序的 **用例** (典型 Web 应用程序中的用户交互), 而领域服务实现 **核心的、用例独立的领域逻辑**.
+* 应用程序服务获取/返回 [数据传输对象](Data-Transfer-Objects.md), 领域服务方法通常获取和返回 **领域对象** ([实体](Entities.md), [值对象](Value-Objects.md)).
+* 领域服务通常由应用程序服务或其他领域服务使用,而应用程序服务由表示层或客户端应用程序使用.
+
+## 生命周期
+
+领域服务的生命周期是 [瞬态](https://docs.abp.io/en/abp/latest/Dependency-Injection) 的,它们会自动注册到依赖注入服务.
diff --git a/docs/zh-Hans/Modules/Background-Jobs.md b/docs/zh-Hans/Modules/Background-Jobs.md
index b183febd80..fe021f1a56 100644
--- a/docs/zh-Hans/Modules/Background-Jobs.md
+++ b/docs/zh-Hans/Modules/Background-Jobs.md
@@ -1,3 +1,55 @@
-# Background Jobs Module
+# 后台作业模块
-待添加
\ No newline at end of file
+后台作业模块实现了 `IBackgroundJobStore` 接口,并且可以使用ABP框架的默认后台作业管理.如果你不想使用这个模块,那么你需要自己实现 `IBackgroundJobStore` 接口.
+
+> 本文档仅介绍后台作业模块,该模块将后台作业持久化到数据库.有关后台作业系统的更多信息,请参阅[后台作业](../Background-Jobs.md)文档.
+
+## 如何使用
+
+当你使用ABP框架[创建一个新的解决方案](https://abp.io/get-started)时,这个模块是(作为NuGet/NPM包)预先安装的.你可以继续将其作为软件包使用并轻松获取更新,也可以将其源代码包含到解决方案中(请参阅 `get-source` [CLI](../CLI.md)命令)以开发自定义模块.
+
+### 源代码
+
+此模块的源代码可在[此处](https://github.com/abpframework/abp/tree/dev/modules/background-jobs)访问.源代码是由[MIT](https://choosealicense.com/licenses/mit/)授权的,所以你可以自由使用和定制它.
+
+## 内部结构
+
+### 领域层
+
+#### 聚合
+
+- `BackgroundJobRecord` (聚合根): 表示后台工作记录.
+
+#### 仓储
+
+为该模块定义了以下自定义仓储:
+
+- `IBackgroundJobRepository`
+
+### 数据库提供程序
+
+#### 通用
+
+##### 表/集合的前缀与架构
+
+默认情况下,所有表/集合都使用 `Abp` 前缀.如果需要更改表前缀或设置架构名称(如果数据库提供程序支持),请在 `BackgroundJobsDbProperties` 类上设置静态属性.
+
+##### 连接字符串
+
+此模块使用 `AbpBackgroundJobs` 作为连接字符串名称.如果不使用此名称定义连接字符串,它将返回 `Default` 连接字符串.有关详细信息,请参阅[连接字符串](https://docs.abp.io/en/abp/latest/Connection-Strings)文档.
+
+#### Entity Framework Core
+
+##### 表
+
+- **AbpBackgroundJobs**
+
+#### MongoDB
+
+##### 集合
+
+- **AbpBackgroundJobs**
+
+## 另请参阅
+
+* [后台作业系统](../Background-Jobs.md)
diff --git a/docs/zh-Hans/Specifications.md b/docs/zh-Hans/Specifications.md
index f927c80255..40a473dbc0 100644
--- a/docs/zh-Hans/Specifications.md
+++ b/docs/zh-Hans/Specifications.md
@@ -1,3 +1,257 @@
## 规约
-TODO..
\ No newline at end of file
+规约模式用于为实体和其他业务对象定义 **命名、可复用、可组合和可测试的过滤器** .
+
+> 规约是领域层的一部分.
+
+## 安装
+
+> 这个包 **已经安装** 在启动模板中.所以,大多数时候你不需要手动去安装.
+
+添加 [Volo.Abp.Specifications](https://abp.io/package-detail/Volo.Abp.Specifications) 包到你的项目. 如果当前文件夹是你的项目的根目录(`.csproj`)时,你可以在命令行终端中使用 [ABP CLI](CLI.md) *add package* 命令:
+
+````bash
+abp add-package Volo.Abp.Specifications
+````
+
+## 定义规约
+
+假设你定义了如下的顾客实体:
+
+````csharp
+using System;
+using Volo.Abp.Domain.Entities;
+
+namespace MyProject
+{
+ public class Customer : AggregateRoot
+ {
+ public string Name { get; set; }
+
+ public byte Age { get; set; }
+
+ public long Balance { get; set; }
+
+ public string Location { get; set; }
+ }
+}
+````
+
+你可以创建一个由 `Specification` 派生的新规约类.
+
+**例如:规定选择一个18岁以上的顾客**
+
+````csharp
+using System;
+using System.Linq.Expressions;
+using Volo.Abp.Specifications;
+
+namespace MyProject
+{
+ public class Age18PlusCustomerSpecification : Specification
+ {
+ public override Expression> ToExpression()
+ {
+ return c => c.Age >= 18;
+ }
+ }
+}
+````
+
+你只需通过定义一个lambda[表达式](https://docs.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/lambda-expressions)来定义规约.
+
+> 你也可以直接实现`ISpecification`接口,但是基类`Specification`做了大量简化.
+
+## 使用规约
+
+这里有两种常见的规约用例.
+
+### IsSatisfiedBy
+
+`IsSatisfiedBy` 方法可以用于检查单个对象是否满足规约.
+
+**例如:如果顾客不满足年龄规定,则抛出异常**
+
+````csharp
+using System;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+
+namespace MyProject
+{
+ public class CustomerService : ITransientDependency
+ {
+ public async Task BuyAlcohol(Customer customer)
+ {
+ if (!new Age18PlusCustomerSpecification().IsSatisfiedBy(customer))
+ {
+ throw new Exception(
+ "这位顾客不满足年龄规定!"
+ );
+ }
+
+ //TODO...
+ }
+ }
+}
+````
+
+### ToExpression & Repositories
+
+`ToExpression()` 方法可用于将规约转化为表达式.通过这种方式,你可以使用规约在**数据库查询时过滤实体**.
+
+````csharp
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Domain.Services;
+
+namespace MyProject
+{
+ public class CustomerManager : DomainService, ITransientDependency
+ {
+ private readonly IRepository _customerRepository;
+
+ public CustomerManager(IRepository customerRepository)
+ {
+ _customerRepository = customerRepository;
+ }
+
+ public async Task> GetCustomersCanBuyAlcohol()
+ {
+ var queryable = await _customerRepository.GetQueryableAsync();
+ var query = queryable.Where(
+ new Age18PlusCustomerSpecification().ToExpression()
+ );
+
+ return await AsyncExecuter.ToListAsync(query);
+ }
+ }
+}
+````
+
+> 规约被正确地转换为SQL/数据库查询语句,并且在DBMS端高效执行.虽然它与规约无关,但如果你想了解有关 `AsyncExecuter` 的更多信息,请参阅[仓储](Repositories.md)文档.
+
+实际上,没有必要使用 `ToExpression()` 方法,因为规约会自动转换为表达式.这也会起作用:
+
+````csharp
+var queryable = await _customerRepository.GetQueryableAsync();
+var query = queryable.Where(
+ new Age18PlusCustomerSpecification()
+);
+````
+
+## 编写规约
+
+规约有一个强大的功能是,它们可以与`And`、`Or`、`Not`以及`AndNot`扩展方法组合使用.
+
+假设你有另一个规约,定义如下:
+
+```csharp
+using System;
+using System.Linq.Expressions;
+using Volo.Abp.Specifications;
+
+namespace MyProject
+{
+ public class PremiumCustomerSpecification : Specification
+ {
+ public override Expression> ToExpression()
+ {
+ return (customer) => (customer.Balance >= 100000);
+ }
+ }
+}
+```
+
+你可以将 `PremiumCustomerSpecification` 和 `Age18PlusCustomerSpecification` 结合起来,查询优质成人顾客的数量,如下所示:
+
+````csharp
+using System;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Domain.Services;
+using Volo.Abp.Specifications;
+
+namespace MyProject
+{
+ public class CustomerManager : DomainService, ITransientDependency
+ {
+ private readonly IRepository _customerRepository;
+
+ public CustomerManager(IRepository customerRepository)
+ {
+ _customerRepository = customerRepository;
+ }
+
+ public async Task GetAdultPremiumCustomerCountAsync()
+ {
+ return await _customerRepository.CountAsync(
+ new Age18PlusCustomerSpecification()
+ .And(new PremiumCustomerSpecification()).ToExpression()
+ );
+ }
+ }
+}
+````
+
+如果你想让这个组合成为一个可复用的规约,你可以创建这样一个组合的规约类,它派生自`AndSpecification`:
+
+````csharp
+using Volo.Abp.Specifications;
+
+namespace MyProject
+{
+ public class AdultPremiumCustomerSpecification : AndSpecification
+ {
+ public AdultPremiumCustomerSpecification()
+ : base(new Age18PlusCustomerSpecification(),
+ new PremiumCustomerSpecification())
+ {
+ }
+ }
+}
+````
+
+现在,你就可以向下面一样重新编写 `GetAdultPremiumCustomerCountAsync` 方法:
+
+````csharp
+public async Task GetAdultPremiumCustomerCountAsync()
+{
+ return await _customerRepository.CountAsync(
+ new AdultPremiumCustomerSpecification()
+ );
+}
+````
+
+> 你可以从这些例子中看到规约的强大之处.如果你之后想要更改 `PremiumCustomerSpecification` ,比如将余额从 `100.000` 修改为 `200.000` ,所有查询语句和合并的规约都将受到本次更改的影响.这是减少代码重复的好方法!
+
+## 讨论
+
+虽然规约模式通常与C#的lambda表达式相比较,算是一种更老的方式.一些开发人员可能认为不再需要它,我们可以直接将表达式传入到仓储或领域服务中,如下所示:
+
+````csharp
+var count = await _customerRepository.CountAsync(c => c.Balance > 100000 && c.Age => 18);
+````
+
+自从ABP的[仓储](Repositories.md)支持表达式,这是一个完全有效的用法.你不必在应用程序中定义或使用任何规约,可以直接使用表达式.
+
+所以,规约的意义是什么?为什么或者应该在什么时候考虑去使用它?
+
+### 何时使用?
+
+使用规约的一些好处:
+
+- **可复用**:假设你在代码库的许多地方都需要用到优质顾客过滤器.如果使用表达式而不创建规约,那么如果以后更改“优质顾客”的定义会发生什么?假设你想将最低余额从100000美元更改为250000美元,并添加另一个条件,成为顾客超过3年.如果使用了规约,只需修改一个类.如果在任何其他地方重复(复制/粘贴)相同的表达式,则需要更改所有的表达式.
+- **可组合**:可以组合多个规约来创建新规约.这是另一种可复用性.
+- **命名**:`PremiumCustomerSpecification` 更好地解释了为什么使用规约,而不是复杂的表达式.因此,如果在你的业务中使用了一个有意义的表达式,请考虑使用规约.
+- **可测试**:规约是一个单独(且易于)测试的对象.
+
+### 什么时侯不要使用?
+
+- **没有业务含义的表达式**:不要对与业务无关的表达式和操作使用规约.
+- **报表**:如果只是创建报表,不要创建规约,而是直接使用 `IQueryable` 和LINQ表达式.你甚至可以使用普通SQL、视图或其他工具生成报表.DDD不关心报表,因此从性能角度来看,查询底层数据存储的方式可能很重要.
diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Microsoft/AspNetCore/Authentication/OAuth/Claims/AbpClaimActionCollectionExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Microsoft/AspNetCore/Authentication/OAuth/Claims/AbpClaimActionCollectionExtensions.cs
index 01dc489c54..2aedea2608 100644
--- a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Microsoft/AspNetCore/Authentication/OAuth/Claims/AbpClaimActionCollectionExtensions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Microsoft/AspNetCore/Authentication/OAuth/Claims/AbpClaimActionCollectionExtensions.cs
@@ -13,6 +13,20 @@ public static class AbpClaimActionCollectionExtensions
claimActions.DeleteClaim("name");
claimActions.RemoveDuplicate(AbpClaimTypes.UserName);
}
+
+ if (AbpClaimTypes.Name != "given_name")
+ {
+ claimActions.MapJsonKey(AbpClaimTypes.Name, "given_name");
+ claimActions.DeleteClaim("given_name");
+ claimActions.RemoveDuplicate(AbpClaimTypes.Name);
+ }
+
+ if (AbpClaimTypes.SurName != "family_name")
+ {
+ claimActions.MapJsonKey(AbpClaimTypes.SurName, "family_name");
+ claimActions.DeleteClaim("family_name");
+ claimActions.RemoveDuplicate(AbpClaimTypes.SurName);
+ }
if (AbpClaimTypes.Email != "email")
{
diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs
index 02b292a984..894ba470a8 100644
--- a/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs
@@ -57,8 +57,7 @@ public static class AbpOpenIdConnectExtensions
if (receivedContext.Request.Cookies.ContainsKey(tenantKey))
{
- receivedContext.TokenEndpointRequest.SetParameter(tenantKey,
- receivedContext.Request.Cookies[tenantKey]);
+ receivedContext.TokenEndpointRequest?.SetParameter(tenantKey, receivedContext.Request.Cookies[tenantKey]);
}
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Layout/PageHeader.razor b/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Layout/PageHeader.razor
index e6959f1d3a..c9c704b471 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Layout/PageHeader.razor
+++ b/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Layout/PageHeader.razor
@@ -7,7 +7,7 @@
@if(Options.Value.RenderPageTitle)
{
-
+
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationDto.cs
index 9b6a66992f..eb29c5c7cb 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationDto.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationDto.cs
@@ -17,6 +17,8 @@ public class ApplicationConfigurationDto
public ApplicationFeatureConfigurationDto Features { get; set; }
+ public ApplicationGlobalFeatureConfigurationDto GlobalFeatures { get; set; }
+
public MultiTenancyInfoDto MultiTenancy { get; set; }
public CurrentTenantDto CurrentTenant { get; set; }
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationGlobalFeatureConfigurationDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationGlobalFeatureConfigurationDto.cs
new file mode 100644
index 0000000000..e911cd911d
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationGlobalFeatureConfigurationDto.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+
+namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;
+
+[Serializable]
+public class ApplicationGlobalFeatureConfigurationDto
+{
+ public HashSet EnabledFeatures { get; set; }
+
+ public Dictionary> ModuleEnabledFeatures { get; set; }
+
+ public ApplicationGlobalFeatureConfigurationDto()
+ {
+ EnabledFeatures = new HashSet();
+ ModuleEnabledFeatures = new Dictionary>();
+ }
+}
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 c205e15321..22b919c91c 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
@@ -36,6 +36,7 @@ using Volo.Abp.Http;
using Volo.Abp.DynamicProxy;
using Volo.Abp.GlobalFeatures;
using Volo.Abp.Http.Modeling;
+using Volo.Abp.Http.ProxyScripting.Generators.JQuery;
using Volo.Abp.Json;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
@@ -185,6 +186,11 @@ public class AbpAspNetCoreMvcModule : AbpModule
endpointContext.Endpoints.MapRazorPages();
});
});
+
+ Configure(options =>
+ {
+ options.DisableModule("abp");
+ });
}
public override void PostConfigureServices(ServiceConfigurationContext context)
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 6ecd9fc195..bfa2e6a285 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
@@ -14,6 +14,7 @@ using Volo.Abp.AspNetCore.Mvc.MultiTenancy;
using Volo.Abp.Authorization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Features;
+using Volo.Abp.GlobalFeatures;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Settings;
@@ -87,6 +88,7 @@ public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApp
{
Auth = await GetAuthConfigAsync(),
Features = await GetFeaturesConfigAsync(),
+ GlobalFeatures = await GetGlobalFeaturesConfigAsync(),
Localization = await GetLocalizationConfigAsync(),
CurrentUser = GetCurrentUser(),
Setting = await GetSettingConfigAsync(),
@@ -284,6 +286,24 @@ public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApp
return result;
}
+ protected virtual Task GetGlobalFeaturesConfigAsync()
+ {
+ var result = new ApplicationGlobalFeatureConfigurationDto();
+
+ foreach (var enabledFeatureName in GlobalFeatureManager.Instance.GetEnabledFeatureNames())
+ {
+ result.EnabledFeatures.AddIfNotContains(enabledFeatureName);
+ }
+
+ foreach (var module in GlobalFeatureManager.Instance.Modules)
+ {
+ result.ModuleEnabledFeatures.AddIfNotContains(new KeyValuePair>(module.Key, module.Value.GetFeatures().Select(x => x.FeatureName).ToList()));
+ }
+
+ return Task.FromResult(result);
+ }
+
+
protected virtual async Task GetTimingConfigAsync()
{
var windowsTimeZoneId = await _settingProvider.GetOrNullAsync(TimingSettingNames.TimeZone);
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs
index f62b16b19b..5c5e7ed6c0 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs
@@ -18,13 +18,14 @@ public class RemoteStreamContentOutputFormatter : OutputFormatter
return typeof(IRemoteStreamContent).IsAssignableFrom(type);
}
- public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
+ public async override Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
{
var remoteStream = (IRemoteStreamContent)context.Object;
if (remoteStream != null)
{
context.HttpContext.Response.ContentType = remoteStream.ContentType;
+ context.HttpContext.Response.ContentLength = remoteStream.ContentLength;
if (!remoteStream.FileName.IsNullOrWhiteSpace())
{
diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditPropertySetter.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditPropertySetter.cs
index 91b5019199..d85bad82eb 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditPropertySetter.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditPropertySetter.cs
@@ -21,25 +21,25 @@ public class AuditPropertySetter : IAuditPropertySetter, ITransientDependency
Clock = clock;
}
- public void SetCreationProperties(object targetObject)
+ public virtual void SetCreationProperties(object targetObject)
{
SetCreationTime(targetObject);
SetCreatorId(targetObject);
}
- public void SetModificationProperties(object targetObject)
+ public virtual void SetModificationProperties(object targetObject)
{
SetLastModificationTime(targetObject);
SetLastModifierId(targetObject);
}
- public void SetDeletionProperties(object targetObject)
+ public virtual void SetDeletionProperties(object targetObject)
{
SetDeletionTime(targetObject);
SetDeleterId(targetObject);
}
- private void SetCreationTime(object targetObject)
+ protected virtual void SetCreationTime(object targetObject)
{
if (!(targetObject is IHasCreationTime objectWithCreationTime))
{
@@ -52,7 +52,7 @@ public class AuditPropertySetter : IAuditPropertySetter, ITransientDependency
}
}
- private void SetCreatorId(object targetObject)
+ protected virtual void SetCreatorId(object targetObject)
{
if (!CurrentUser.Id.HasValue)
{
@@ -95,7 +95,7 @@ public class AuditPropertySetter : IAuditPropertySetter, ITransientDependency
}
}
- private void SetLastModificationTime(object targetObject)
+ protected virtual void SetLastModificationTime(object targetObject)
{
if (targetObject is IHasModificationTime objectWithModificationTime)
{
@@ -103,7 +103,7 @@ public class AuditPropertySetter : IAuditPropertySetter, ITransientDependency
}
}
- private void SetLastModifierId(object targetObject)
+ protected virtual void SetLastModifierId(object targetObject)
{
if (!(targetObject is IModificationAuditedObject modificationAuditedObject))
{
@@ -137,7 +137,7 @@ public class AuditPropertySetter : IAuditPropertySetter, ITransientDependency
modificationAuditedObject.LastModifierId = CurrentUser.Id;
}
- private void SetDeletionTime(object targetObject)
+ protected virtual void SetDeletionTime(object targetObject)
{
if (targetObject is IHasDeletionTime objectWithDeletionTime)
{
@@ -148,7 +148,7 @@ public class AuditPropertySetter : IAuditPropertySetter, ITransientDependency
}
}
- private void SetDeleterId(object targetObject)
+ protected virtual void SetDeleterId(object targetObject)
{
if (!(targetObject is IDeletionAuditedObject deletionAuditedObject))
{
diff --git a/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj b/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj
index 9f028d31ee..32f9da017c 100644
--- a/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj
+++ b/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj
@@ -4,7 +4,7 @@
- netstandard2.0
+ netstandard2.1
Volo.Abp.AutoMapper
Volo.Abp.AutoMapper
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -21,7 +21,7 @@
-
+
diff --git a/framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs b/framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs
index 6ed44a6300..18fef842da 100644
--- a/framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs
+++ b/framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs
@@ -1,5 +1,6 @@
using System;
using AutoMapper;
+using AutoMapper.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.Auditing;
@@ -49,7 +50,7 @@ public class AbpAutoMapperModule : AbpModule
{
foreach (var profileType in options.ValidatingProfiles)
{
- config.AssertConfigurationIsValid(((Profile)Activator.CreateInstance(profileType)).ProfileName);
+ config.Internal().AssertConfigurationIsValid(((Profile)Activator.CreateInstance(profileType)).ProfileName);
}
}
diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs
index 5f9d9eacfd..d616e1264f 100644
--- a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs
+++ b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs
@@ -47,7 +47,7 @@ public class ConnectionPool : IConnectionPool, ISingletonDependency
connectionName, new Lazy(() =>
{
var config = _options.Connections.GetOrDefault(connectionName);
- return new ServiceBusAdministrationClient(config.ConnectionString);
+ return new ServiceBusAdministrationClient(config.ConnectionString, config.Admin);
})
).Value;
}
diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerBase.cs
index 466fbe457f..dfeda11df8 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerBase.cs
+++ b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerBase.cs
@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System;
+using System.Threading.Tasks;
namespace Volo.Abp.BackgroundWorkers.Hangfire;
@@ -7,6 +8,16 @@ public abstract class HangfireBackgroundWorkerBase : BackgroundWorkerBase, IHang
public string RecurringJobId { get; set; }
public string CronExpression { get; set; }
+
+ public TimeZoneInfo TimeZone { get; set; }
+
+ public string Queue { get; set; }
public abstract Task DoWorkAsync();
+
+ protected HangfireBackgroundWorkerBase()
+ {
+ TimeZone = null;
+ Queue = "default";
+ }
}
diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerManager.cs b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerManager.cs
index 89d6105967..b2cb275dab 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerManager.cs
+++ b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerManager.cs
@@ -40,12 +40,13 @@ public class HangfireBackgroundWorkerManager : IBackgroundWorkerManager, ISingle
var unProxyWorker = ProxyHelper.UnProxy(hangfireBackgroundWorker);
if (hangfireBackgroundWorker.RecurringJobId.IsNullOrWhiteSpace())
{
- RecurringJob.AddOrUpdate(() => ((IHangfireBackgroundWorker)unProxyWorker).DoWorkAsync(), hangfireBackgroundWorker.CronExpression);
+ RecurringJob.AddOrUpdate(() => ((IHangfireBackgroundWorker)unProxyWorker).DoWorkAsync(),
+ hangfireBackgroundWorker.CronExpression, hangfireBackgroundWorker.TimeZone, hangfireBackgroundWorker.Queue);
}
else
{
RecurringJob.AddOrUpdate(hangfireBackgroundWorker.RecurringJobId, () => ((IHangfireBackgroundWorker)unProxyWorker).DoWorkAsync(),
- hangfireBackgroundWorker.CronExpression);
+ hangfireBackgroundWorker.CronExpression, hangfireBackgroundWorker.TimeZone, hangfireBackgroundWorker.Queue);
}
}
else
@@ -79,7 +80,7 @@ public class HangfireBackgroundWorkerManager : IBackgroundWorkerManager, ISingle
var adapterType = typeof(HangfirePeriodicBackgroundWorkerAdapter<>).MakeGenericType(ProxyHelper.GetUnProxiedType(worker));
var workerAdapter = Activator.CreateInstance(adapterType) as IHangfireBackgroundWorker;
- RecurringJob.AddOrUpdate(() => workerAdapter.DoWorkAsync(), GetCron(period.Value));
+ RecurringJob.AddOrUpdate(() => workerAdapter.DoWorkAsync(), GetCron(period.Value), workerAdapter.TimeZone, workerAdapter.Queue);
}
return Task.CompletedTask;
diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfirePeriodicBackgroundWorkerAdapter.cs b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfirePeriodicBackgroundWorkerAdapter.cs
index 483210ace6..8fe24f10ed 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfirePeriodicBackgroundWorkerAdapter.cs
+++ b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfirePeriodicBackgroundWorkerAdapter.cs
@@ -17,7 +17,7 @@ public class HangfirePeriodicBackgroundWorkerAdapter : HangfireBackgrou
_doWorkMethod = typeof(TWorker).GetMethod("DoWork", BindingFlags.Instance | BindingFlags.NonPublic);
}
- public override async Task DoWorkAsync()
+ public async override Task DoWorkAsync()
{
var workerContext = new PeriodicBackgroundWorkerContext(ServiceProvider);
var worker = ServiceProvider.GetRequiredService();
diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/IHangfireBackgroundWorker.cs b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/IHangfireBackgroundWorker.cs
index 0b8c89e95b..7402d8427a 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/IHangfireBackgroundWorker.cs
+++ b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/IHangfireBackgroundWorker.cs
@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System;
+using System.Threading.Tasks;
namespace Volo.Abp.BackgroundWorkers.Hangfire;
@@ -7,6 +8,10 @@ public interface IHangfireBackgroundWorker : IBackgroundWorker
string RecurringJobId { get; set; }
string CronExpression { get; set; }
+
+ TimeZoneInfo TimeZone { get; set; }
+
+ string Queue { get; set; }
Task DoWorkAsync();
}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor
index e7ea795eee..c674ec3612 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor
@@ -11,6 +11,7 @@
CurrentPage="@CurrentPage"
PageSize="@PageSize"
Responsive="@Responsive"
+ Striped
Class="@Class">
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
index f0c8fa8aff..c7fe013b3c 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
@@ -94,6 +94,11 @@ public partial class UiMessageAlert : ComponentBase, IDisposable
Options = e.Options;
Callback = e.Callback;
+ await ShowMessageAlert();
+ }
+
+ protected virtual async Task ShowMessageAlert()
+ {
await InvokeAsync(ModalRef.Show);
}
diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj b/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj
index 822189c677..a78b131962 100644
--- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj
+++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj
@@ -3,7 +3,7 @@
- netstandard2.0
+ net6.0
Volo.Abp.BlobStoring.Minio
Volo.Abp.BlobStoring.Minio
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -15,7 +15,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/CommandLineArgumentParser.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/CommandLineArgumentParser.cs
index ea8541cbb9..1b060a8dbc 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/CommandLineArgumentParser.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/CommandLineArgumentParser.cs
@@ -98,7 +98,7 @@ public class CommandLineArgumentParser : ICommandLineArgumentParser, ITransientD
{
if (argument.Length <= 1)
{
- throw new ArgumentException("Should specify an option name after '--' prefix!");
+ throw new ArgumentException("Should specify an option name after '-' prefix!");
}
return argument.RemovePreFix("-");
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 c244abd719..526ae77363 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
@@ -10,7 +10,9 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Commands.Services;
+using Volo.Abp.Cli.LIbs;
using Volo.Abp.Cli.ProjectBuilding;
+using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectModification;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
@@ -21,8 +23,6 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien
{
public const string Name = "new";
- public ILogger Logger { get; set; }
-
protected TemplateProjectBuilder TemplateProjectBuilder { get; }
public ITemplateInfoProvider TemplateInfoProvider { get; }
@@ -30,13 +30,13 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien
, ITemplateInfoProvider templateInfoProvider,
ConnectionStringProvider connectionStringProvider,
SolutionPackageVersionFinder solutionPackageVersionFinder,
- ICmdHelper cmdHelper)
- : base(connectionStringProvider, solutionPackageVersionFinder, cmdHelper)
+ ICmdHelper cmdHelper,
+ IInstallLibsService installLibsService,
+ AngularPwaSupportAdder angularPwaSupportAdder)
+ : base(connectionStringProvider, solutionPackageVersionFinder, cmdHelper, installLibsService, angularPwaSupportAdder)
{
TemplateProjectBuilder = templateProjectBuilder;
TemplateInfoProvider = templateInfoProvider;
-
- Logger = NullLogger.Instance;
}
public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
@@ -79,7 +79,9 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien
Logger.LogInformation($"'{projectName}' has been successfully created to '{projectArgs.OutputFolder}'");
RunGraphBuildForMicroserviceServiceTemplate(projectArgs);
- RunInstallLibsForWebTemplate(projectArgs);
+ await RunInstallLibsForWebTemplateAsync(projectArgs);
+ ConfigurePwaSupportForAngular(projectArgs);
+
OpenRelatedWebPage(projectArgs, template, isTiered, commandLineArgs);
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
index d638a21f87..6e280d7dc3 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Linq;
+using System.Threading.Tasks;
using ICSharpCode.SharpZipLib.Core;
using ICSharpCode.SharpZipLib.Zip;
using Microsoft.Extensions.Logging;
@@ -8,6 +9,7 @@ using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Cli.ProjectModification;
using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Commands.Services;
+using Volo.Abp.Cli.LIbs;
using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Templates.App;
@@ -22,13 +24,22 @@ public abstract class ProjectCreationCommandBase
public ConnectionStringProvider ConnectionStringProvider { get; }
public SolutionPackageVersionFinder SolutionPackageVersionFinder { get; }
public ICmdHelper CmdHelper { get; }
+ public IInstallLibsService InstallLibsService { get; }
+ public AngularPwaSupportAdder AngularPwaSupportAdder { get; }
public ILogger Logger { get; set; }
- public ProjectCreationCommandBase(ConnectionStringProvider connectionStringProvider, SolutionPackageVersionFinder solutionPackageVersionFinder, ICmdHelper cmdHelper)
+ public ProjectCreationCommandBase(
+ ConnectionStringProvider connectionStringProvider,
+ SolutionPackageVersionFinder solutionPackageVersionFinder,
+ ICmdHelper cmdHelper,
+ IInstallLibsService installLibsService,
+ AngularPwaSupportAdder angularPwaSupportAdder)
{
ConnectionStringProvider = connectionStringProvider;
SolutionPackageVersionFinder = solutionPackageVersionFinder;
CmdHelper = cmdHelper;
+ InstallLibsService = installLibsService;
+ AngularPwaSupportAdder = angularPwaSupportAdder;
Logger = NullLogger.Instance;
}
@@ -48,6 +59,12 @@ public abstract class ProjectCreationCommandBase
Logger.LogInformation("Preview: yes");
}
+ var pwa = commandLineArgs.Options.ContainsKey(Options.ProgressiveWebApp.Short);
+ if (pwa)
+ {
+ Logger.LogInformation("Progressive Web App: yes");
+ }
+
var databaseProvider = GetDatabaseProvider(commandLineArgs);
if (databaseProvider != DatabaseProvider.NotSpecified)
{
@@ -162,7 +179,8 @@ public abstract class ProjectCreationCommandBase
gitHubVoloLocalRepositoryPath,
templateSource,
commandLineArgs.Options,
- connectionString
+ connectionString,
+ pwa
);
}
@@ -307,14 +325,27 @@ public abstract class ProjectCreationCommandBase
}
}
- protected virtual void RunInstallLibsForWebTemplate(ProjectBuildArgs projectArgs)
+ protected async Task RunInstallLibsForWebTemplateAsync(ProjectBuildArgs projectArgs)
{
if (AppTemplateBase.IsAppTemplate(projectArgs.TemplateName) ||
ModuleTemplateBase.IsModuleTemplate(projectArgs.TemplateName) ||
AppNoLayersTemplateBase.IsAppNoLayersTemplate(projectArgs.TemplateName) ||
MicroserviceServiceTemplateBase.IsMicroserviceTemplate(projectArgs.TemplateName))
{
- CmdHelper.RunCmd("abp install-libs", projectArgs.OutputFolder);
+ Logger.LogInformation("Installing client-side packages...");
+ await InstallLibsService.InstallLibsAsync(projectArgs.OutputFolder);
+ }
+ }
+
+ protected void ConfigurePwaSupportForAngular(ProjectBuildArgs projectArgs)
+ {
+ var isAngular = projectArgs.UiFramework == UiFramework.Angular;
+ var isPwa = projectArgs.Pwa;
+
+ if (isAngular && isPwa)
+ {
+ Logger.LogInformation("Adding PWA Support to Angular app.");
+ AngularPwaSupportAdder.AddPwaSupport(projectArgs.OutputFolder);
}
}
@@ -476,5 +507,10 @@ public abstract class ProjectCreationCommandBase
{
public const string Long = "preview";
}
+
+ public static class ProgressiveWebApp
+ {
+ public const string Short = "pwa";
+ }
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs
index 2ce5ba8209..22311bb986 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs
@@ -83,15 +83,18 @@ public abstract class ProxyCommandBase : IConsoleCommand, ITransientDependenc
sb.AppendLine("Options:");
sb.AppendLine("");
sb.AppendLine("-m|--module (default: 'app') The name of the backend module you wish to generate proxies for.");
- sb.AppendLine("-t|--type The name of generate type (csharp, js, ng).");
sb.AppendLine("-wd|--working-directory Execution directory.");
sb.AppendLine("-u|--url API definition URL from.");
- sb.AppendLine("-a|--api-name (default: 'default') The name of the API endpoint defined in the /src/environments/environment.ts.");
- sb.AppendLine("-s|--source (default: 'defaultProject') Angular project name to resolve the root namespace & API definition URL from.");
- sb.AppendLine("-o|--output JavaScript file path or folder to place generated code in.");
- sb.AppendLine("-p|--prompt Asks the options from the command line prompt (for the missing options)");
- sb.AppendLine("--target (default: 'defaultProject') Angular project name to place generated code in.");
- sb.AppendLine("--folder (default: 'ClientProxies') Folder name to place generated CSharp code in.");
+ sb.AppendLine("-t|--type The name of generate type (csharp, js, ng).");
+ sb.AppendLine(" csharp");
+ sb.AppendLine(" --folder (default: 'ClientProxies') Folder name to place generated CSharp code in.");
+ sb.AppendLine(" js");
+ sb.AppendLine(" -o|--output JavaScript file path or folder to place generated code in.");
+ sb.AppendLine(" ng");
+ sb.AppendLine(" -a|--api-name (default: 'default') The name of the API endpoint defined in the /src/environments/environment.ts.");
+ sb.AppendLine(" -s|--source (default: 'defaultProject') Angular project name to resolve the root namespace & API definition URL from.");
+ sb.AppendLine(" -p|--prompt Asks the options from the command line prompt (for the missing options)");
+ sb.AppendLine(" --target (default: 'defaultProject') Angular project name to place generated code in.");
sb.AppendLine("");
sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI");
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs
index 0e797e682f..aabd5c6dfd 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs
@@ -1,33 +1,53 @@
using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.NetworkInformation;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
+using Newtonsoft.Json.Linq;
using NuGet.Versioning;
using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Commands.Services;
+using Volo.Abp.Cli.Http;
using Volo.Abp.Cli.NuGet;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
+using Volo.Abp.Http;
+using Volo.Abp.Json;
+using Volo.Abp.Threading;
namespace Volo.Abp.Cli.Commands;
public class SuiteCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "suite";
-
+
public ICmdHelper CmdHelper { get; }
private readonly AbpNuGetIndexUrlService _nuGetIndexUrlService;
private readonly NuGetService _nuGetService;
+ private readonly CliHttpClientFactory _cliHttpClientFactory;
private const string SuitePackageName = "Volo.Abp.Suite";
public ILogger Logger { get; set; }
- public SuiteCommand(AbpNuGetIndexUrlService nuGetIndexUrlService, NuGetService nuGetService, ICmdHelper cmdHelper)
+ private const string AbpSuiteHost = "http://localhost:3000";
+
+ public SuiteCommand(
+ AbpNuGetIndexUrlService nuGetIndexUrlService,
+ NuGetService nuGetService,
+ ICmdHelper cmdHelper,
+ CliHttpClientFactory cliHttpClientFactory)
{
CmdHelper = cmdHelper;
_nuGetIndexUrlService = nuGetIndexUrlService;
_nuGetService = nuGetService;
+ _cliHttpClientFactory = cliHttpClientFactory;
Logger = NullLogger.Instance;
}
@@ -48,6 +68,18 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency
RunSuite();
break;
+ case "generate":
+ await InstallSuiteIfNotInstalledAsync();
+ var suiteProcess = StartSuite();
+ System.Threading.Thread.Sleep(500); //wait for initialization of the app
+ await GenerateCrudPageAsync(commandLineArgs);
+ if (suiteProcess != null)
+ {
+ KillSuite();
+ }
+
+ break;
+
case "install":
await InstallSuiteAsync(version, preview);
break;
@@ -63,6 +95,115 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency
}
}
+ private async Task GenerateCrudPageAsync(CommandLineArgs args)
+ {
+ var entityFile = args.Options.GetOrNull(Options.Crud.Entity.Short, Options.Crud.Entity.Long);
+ var solutionFile = args.Options.GetOrNull(Options.Crud.Solution.Short, Options.Crud.Solution.Long);
+
+ if (entityFile.IsNullOrEmpty() || !entityFile.EndsWith(".json") || !File.Exists(entityFile) ||
+ solutionFile.IsNullOrEmpty() || !solutionFile.EndsWith(".sln"))
+ {
+ throw new UserFriendlyException("Invalid Arguments!");
+ }
+
+ Logger.LogInformation("Generating CRUD Page...");
+
+ var client = _cliHttpClientFactory.CreateClient(false);
+ var solutionId = await GetSolutionIdAsync(client, solutionFile);
+
+ if (!solutionId.HasValue)
+ {
+ return;
+ }
+
+ var entityContent = new StringContent(
+ File.ReadAllText(entityFile),
+ Encoding.UTF8,
+ MimeTypes.Application.Json
+ );
+
+ var responseMessage = await client.PostAsync(
+ $"{AbpSuiteHost}/api/abpSuite/crudPageGenerator/{solutionId.ToString()}/save-and-generate-entity",
+ entityContent
+ );
+
+ var response = await responseMessage.Content.ReadAsStringAsync();
+
+ if (!response.IsNullOrWhiteSpace())
+ {
+ Logger.LogError(response);
+ }
+ else
+ {
+ Logger.LogInformation("CRUD page generation successfully completed.");
+ }
+ }
+
+ private async Task GetSolutionIdAsync(HttpClient client, string solutionPath)
+ {
+ var timeIntervals = new List();
+ for (var i = 0; i < 10; i++)
+ {
+ timeIntervals.Add(TimeSpan.FromSeconds(5));
+ }
+
+ var responseMessage = await client.GetHttpResponseMessageWithRetryAsync(
+ "http://localhost:3000/api/abpSuite/solutions",
+ _cliHttpClientFactory.GetCancellationToken(TimeSpan.FromMinutes(10)),
+ Logger,
+ timeIntervals.ToArray());
+
+ var response = await responseMessage.Content.ReadAsStringAsync();
+ JArray solutions;
+
+ try
+ {
+ solutions = (JArray)(JObject.Parse(response)["solutions"]);
+ }
+ catch (Exception)
+ {
+ Logger.LogError(response);
+ return await AddSolutionToSuiteAsync(client, solutionPath);
+ }
+
+ foreach (JObject solution in solutions)
+ {
+ if (solution["path"].ToString() == solutionPath)
+ {
+ return Guid.Parse(solution["id"].ToString());
+ }
+ }
+
+ return await AddSolutionToSuiteAsync(client, solutionPath);
+ }
+
+ private async Task AddSolutionToSuiteAsync(HttpClient client, string solutionPath)
+ {
+ var entityContent = new StringContent(
+ "{\"Path\": \"" + solutionPath.Replace("\\", "\\\\") + "\"}",
+ Encoding.UTF8,
+ MimeTypes.Application.Json
+ );
+
+ var responseMessage = await client.PostAsync(
+ "http://localhost:3000/api/abpSuite/addSolution",
+ entityContent,
+ _cliHttpClientFactory.GetCancellationToken(TimeSpan.FromMinutes(10))
+ );
+
+ var response = await responseMessage.Content.ReadAsStringAsync();
+
+ try
+ {
+ return Guid.Parse(JObject.Parse(response)["id"].ToString());
+ }
+ catch (Exception)
+ {
+ Logger.LogError(response);
+ return null;
+ }
+ }
+
private async Task InstallSuiteIfNotInstalledAsync()
{
var currentSuiteVersionAsString = GetCurrentSuiteVersion();
@@ -132,7 +273,8 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency
}
CmdHelper.RunCmd(
- $"dotnet tool install {SuitePackageName}{versionOption} --add-source {nugetIndexUrl} -g", out int exitCode
+ $"dotnet tool install {SuitePackageName}{versionOption} --add-source {nugetIndexUrl} -g",
+ out int exitCode
);
if (exitCode == 0)
@@ -155,7 +297,8 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency
private void ShowSuiteManualInstallCommand()
{
Logger.LogInformation("You can also run the following command to install ABP Suite.");
- Logger.LogInformation("dotnet tool install -g Volo.Abp.Suite --add-source https://nuget.abp.io//v3/index.json");
+ Logger.LogInformation(
+ "dotnet tool install -g Volo.Abp.Suite --add-source https://nuget.abp.io//v3/index.json");
}
private async Task UpdateSuiteAsync(string version = null, bool preview = false)
@@ -202,7 +345,8 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency
}
CmdHelper.RunCmd(
- $"dotnet tool update {SuitePackageName}{versionOption} --add-source {nugetIndexUrl} -g", out int exitCode
+ $"dotnet tool update {SuitePackageName}{versionOption} --add-source {nugetIndexUrl} -g",
+ out int exitCode
);
if (exitCode != 0)
@@ -231,7 +375,8 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency
private void ShowSuiteManualUpdateCommand()
{
Logger.LogError("You can also run the following command to update ABP Suite.");
- Logger.LogError("dotnet tool update -g Volo.Abp.Suite --add-source https://nuget.abp.io//v3/index.json");
+ Logger.LogError(
+ "dotnet tool update -g Volo.Abp.Suite --add-source https://nuget.abp.io//v3/index.json");
}
private void RemoveSuite()
@@ -258,6 +403,56 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency
CmdHelper.RunCmd("abp-suite");
}
+ private Process StartSuite()
+ {
+ 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 null;
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.LogWarning("Couldn't check ABP Suite installed status: " + ex.Message);
+ }
+
+ if (IsSuiteAlreadyRunning())
+ {
+ return null;
+ }
+
+ return CmdHelper.RunCmdAndGetProcess("abp-suite --no-browser");
+ }
+
+ private bool IsSuiteAlreadyRunning()
+ {
+ var ipGP = IPGlobalProperties.GetIPGlobalProperties();
+ var endpoints = ipGP.GetActiveTcpListeners();
+ return endpoints.Any(e => e.Port == 3000);
+ }
+
+ private void KillSuite()
+ {
+ try
+ {
+ var suiteProcesses = (from p in Process.GetProcesses()
+ where p.ProcessName.ToLower().Contains("abp-suite")
+ select p);
+
+ foreach (var suiteProcess in suiteProcesses)
+ {
+ suiteProcess.Kill();
+ Logger.LogInformation("Suite closed.");
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.LogInformation("Cannot close Suite." + ex.Message);
+ }
+ }
+
public string GetUsageInfo()
{
var sb = new StringBuilder();
@@ -306,5 +501,20 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency
public const string Long = "version";
public const string Short = "v";
}
+
+ public static class Crud
+ {
+ public static class Solution
+ {
+ public const string Long = "solution";
+ public const string Short = "s";
+ }
+
+ public static class Entity
+ {
+ public const string Long = "entity";
+ public const string Short = "e";
+ }
+ }
}
-}
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveFileStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveFileStep.cs
new file mode 100644
index 0000000000..203a927536
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveFileStep.cs
@@ -0,0 +1,21 @@
+using System;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps;
+
+public class RemoveFileStep : ProjectBuildPipelineStep
+{
+ private readonly string _filePath;
+ public RemoveFileStep(string filePath)
+ {
+ _filePath = filePath;
+ }
+
+ public override void Execute(ProjectBuildContext context)
+ {
+ var fileToRemove = context.Files.Find(x => x.Name.EndsWith(_filePath));
+ if (fileToRemove != null)
+ {
+ context.Files.Remove(fileToRemove);
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs
index 437721f30c..8115182b04 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs
@@ -8,7 +8,12 @@ public class TemplateCodeDeleteStep : ProjectBuildPipelineStep
{
foreach (var file in context.Files)
{
- if (file.Name.EndsWith(".cs") || file.Name.EndsWith(".csproj") || file.Name.EndsWith(".cshtml") || file.Name.EndsWith(".json") || file.Name.EndsWith(".gitignore"))
+ if (file.Name.EndsWith(".cs") ||
+ file.Name.EndsWith(".csproj") ||
+ file.Name.EndsWith(".cshtml") ||
+ file.Name.EndsWith(".json") ||
+ file.Name.EndsWith(".gitignore") ||
+ file.Name.EndsWith(".html"))
{
file.RemoveTemplateCode(context.Symbols);
file.RemoveTemplateCodeMarkers();
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
index 6d9b754cba..3c057454f6 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
@@ -40,6 +40,8 @@ public class ProjectBuildArgs
[NotNull]
public string OutputFolder { get; set; }
+ public bool Pwa { get; set; }
+
[NotNull]
public Dictionary ExtraProperties { get; set; }
@@ -57,7 +59,8 @@ public class ProjectBuildArgs
[CanBeNull] string voloGitHubLocalRepositoryPath = null,
[CanBeNull] string templateSource = null,
Dictionary extraProperties = null,
- [CanBeNull] string connectionString = null)
+ [CanBeNull] string connectionString = null,
+ bool pwa = false)
{
SolutionName = Check.NotNull(solutionName, nameof(solutionName));
TemplateName = templateName;
@@ -73,5 +76,6 @@ public class ProjectBuildArgs
TemplateSource = templateSource;
ExtraProperties = extraProperties ?? new Dictionary();
ConnectionString = connectionString;
+ Pwa = pwa;
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
index 20b72cdc50..3dd6ece476 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
@@ -289,6 +289,19 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
}
+
+ if (context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.ProgressiveWebApp.Short))
+ {
+ context.Symbols.Add("PWA");
+ }
+ else
+ {
+ steps.Add(new RemoveFileStep("/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/service-worker.js"));
+ steps.Add(new RemoveFileStep("/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/service-worker.published.js"));
+ steps.Add(new RemoveFileStep("/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/manifest.json"));
+ steps.Add(new RemoveFileStep("/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/icon-192.png"));
+ steps.Add(new RemoveFileStep("/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/icon-512.png"));
+ }
}
protected void ConfigureWithBlazorServerUi(ProjectBuildContext context, List steps)
@@ -365,6 +378,11 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
}
+
+ if (context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.ProgressiveWebApp.Short))
+ {
+ context.Symbols.Add("PWA");
+ }
}
protected void RemoveUnnecessaryPorts(ProjectBuildContext context, List steps)
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularPwaSupportAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularPwaSupportAdder.cs
new file mode 100644
index 0000000000..891ac28ecb
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularPwaSupportAdder.cs
@@ -0,0 +1,35 @@
+using System;
+using System.IO;
+using System.Linq;
+using Volo.Abp.Cli.Utils;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.Cli.ProjectModification;
+
+public class AngularPwaSupportAdder : ITransientDependency
+{
+ protected ICmdHelper CmdHelper { get; }
+ protected PackageJsonFileFinder PackageJsonFileFinder { get; }
+
+ public AngularPwaSupportAdder(
+ ICmdHelper cmdHelper,
+ PackageJsonFileFinder packageJsonFileFinder)
+ {
+ CmdHelper = cmdHelper;
+ PackageJsonFileFinder = packageJsonFileFinder;
+ }
+
+ public virtual void AddPwaSupport(string rootDirectory)
+ {
+ var fileList = PackageJsonFileFinder.Find(rootDirectory).Where(x => File.Exists(x.RemovePostFix("package.json") + "angular.json")).ToList();
+
+ fileList.ForEach(AddPwaSupportToProject);
+ }
+
+ protected virtual void AddPwaSupportToProject(string filePath)
+ {
+ var directory = Path.GetDirectoryName(filePath).EnsureEndsWith(Path.DirectorySeparatorChar);
+
+ CmdHelper.RunCmd("ng add @angular/pwa --skip-confirmation", workingDirectory: directory);
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs
index 2ade6dbd77..64517b1900 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs
@@ -14,6 +14,7 @@ using NuGet.Versioning;
using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Commands;
using Volo.Abp.Cli.Http;
+using Volo.Abp.Cli.LIbs;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
using Volo.Abp.IO;
@@ -25,7 +26,7 @@ public class NpmPackagesUpdater : ITransientDependency
{
public ILogger Logger { get; set; }
protected ICancellationTokenProvider CancellationTokenProvider { get; }
- public InstallLibsCommand InstallLibsCommand { get; }
+ public IInstallLibsService InstallLibsService { get; }
public ICmdHelper CmdHelper { get; }
private readonly PackageJsonFileFinder _packageJsonFileFinder;
@@ -38,13 +39,13 @@ public class NpmPackagesUpdater : ITransientDependency
NpmGlobalPackagesChecker npmGlobalPackagesChecker,
ICancellationTokenProvider cancellationTokenProvider,
CliHttpClientFactory cliHttpClientFactory,
- InstallLibsCommand ınstallLibsCommand,
+ IInstallLibsService installLibsService,
ICmdHelper cmdHelper)
{
_packageJsonFileFinder = packageJsonFileFinder;
_npmGlobalPackagesChecker = npmGlobalPackagesChecker;
CancellationTokenProvider = cancellationTokenProvider;
- InstallLibsCommand = ınstallLibsCommand;
+ InstallLibsService = installLibsService;
CmdHelper = cmdHelper;
_cliHttpClientFactory = cliHttpClientFactory;
Logger = NullLogger.Instance;
@@ -306,10 +307,8 @@ public class NpmPackagesUpdater : ITransientDependency
protected virtual async Task RunInstallLibsAsync(string fileDirectory)
{
- var args = new CommandLineArgs("install-libs");
- args.Options.Add(InstallLibsCommand.Options.WorkingDirectory.Short, fileDirectory);
-
- await InstallLibsCommand.ExecuteAsync(args);
+ Logger.LogInformation("Installing client-side packages...");
+ await InstallLibsService.InstallLibsAsync(fileDirectory);
}
protected virtual void RunYarn(string fileDirectory)
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs
index 828b143192..36f33e1f6e 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs
@@ -12,6 +12,7 @@ using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Commands;
using Volo.Abp.Cli.Commands.Services;
using Volo.Abp.Cli.Http;
+using Volo.Abp.Cli.LIbs;
using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
@@ -26,7 +27,7 @@ public class ProjectNpmPackageAdder : ITransientDependency
public SourceCodeDownloadService SourceCodeDownloadService { get; }
public AngularSourceCodeAdder AngularSourceCodeAdder { get; }
public IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; }
- public InstallLibsCommand InstallLibsCommand { get; }
+ public IInstallLibsService InstallLibsService { get; }
public ICmdHelper CmdHelper { get; }
private readonly CliHttpClientFactory _cliHttpClientFactory;
public ILogger Logger { get; set; }
@@ -36,14 +37,14 @@ public class ProjectNpmPackageAdder : ITransientDependency
SourceCodeDownloadService sourceCodeDownloadService,
AngularSourceCodeAdder angularSourceCodeAdder,
IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
- InstallLibsCommand ınstallLibsCommand,
+ IInstallLibsService installLibsService,
ICmdHelper cmdHelper)
{
JsonSerializer = jsonSerializer;
SourceCodeDownloadService = sourceCodeDownloadService;
AngularSourceCodeAdder = angularSourceCodeAdder;
RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
- InstallLibsCommand = ınstallLibsCommand;
+ InstallLibsService = installLibsService;
CmdHelper = cmdHelper;
_cliHttpClientFactory = cliHttpClientFactory;
Logger = NullLogger.Instance;
@@ -142,9 +143,8 @@ public class ProjectNpmPackageAdder : ITransientDependency
return;
}
- await InstallLibsCommand.ExecuteAsync(
- new CommandLineArgs("install-libs")
- );
+ Logger.LogInformation("Installing client-side packages...");
+ await InstallLibsService.InstallLibsAsync(directory);
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionFileModifier.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionFileModifier.cs
index 08d8fa182d..45e0684b4a 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionFileModifier.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionFileModifier.cs
@@ -10,13 +10,30 @@ namespace Volo.Abp.Cli.ProjectModification;
public class SolutionFileModifier : ITransientDependency
{
+ public static Encoding DefaultEncoding = Encoding.UTF8;
+
public async Task RemoveProjectFromSolutionFileAsync(string solutionFile, string projectName)
{
- var solutionFileContent = File.ReadAllText(solutionFile);
- solutionFileContent.NormalizeLineEndings();
- var lines = solutionFileContent.Split(new[] { Environment.NewLine, "\n" }, StringSplitOptions.None);
- File.WriteAllText(solutionFile,
- RemoveProject(lines.ToList(), projectName).JoinAsString(Environment.NewLine));
+ using (var fileStream = File.Open(solutionFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
+ {
+ using (var sr = new StreamReader(fileStream, Encoding.Default, true))
+ {
+ var solutionFileContent = await sr.ReadToEndAsync();
+ solutionFileContent.NormalizeLineEndings();
+
+ var lines = solutionFileContent.Split(new[] { Environment.NewLine, "\n" }, StringSplitOptions.None);
+ var updatedContent = RemoveProject(lines.ToList(), projectName).JoinAsString(Environment.NewLine);
+
+ fileStream.Seek(0, SeekOrigin.Begin);
+ fileStream.SetLength(0);
+
+ using (var sw = new StreamWriter(fileStream, DefaultEncoding))
+ {
+ await sw.WriteAsync(updatedContent);
+ await sw.FlushAsync();
+ }
+ }
+ }
}
public async Task AddModuleToSolutionFileAsync(ModuleWithMastersInfo module, string solutionFile)
@@ -33,8 +50,8 @@ public class SolutionFileModifier : ITransientDependency
{
var srcFolderId = await AddNewFolderAndGetIdOrGetExistingIdAsync(solutionFile, "src");
- var file = File.ReadAllText(solutionFile);
- var lines = file.Split(Environment.NewLine).ToList();
+ var solutionFileContent = File.ReadAllText(solutionFile);
+ var lines = solutionFileContent.Split(Environment.NewLine).ToList();
if (lines.Any(l => l.Contains($"\"{package.Name}\"")))
{
@@ -64,7 +81,7 @@ public class SolutionFileModifier : ITransientDependency
lines.InsertAfter(l => l.Contains("GlobalSection") && l.Contains("NestedProjects"), newPreSolutionLine);
- File.WriteAllText(solutionFile, string.Join(Environment.NewLine, lines));
+ File.WriteAllText(solutionFile, string.Join(Environment.NewLine, lines), DefaultEncoding);
}
private List RemoveProject(List solutionFileLines, string projectName)
@@ -137,7 +154,7 @@ public class SolutionFileModifier : ITransientDependency
Path.Combine(Path.GetDirectoryName(solutionFile), "modules", module.Name, "test"),
"*.csproj",
SearchOption.AllDirectories).ToList();
- }
+ }
foreach (var projectPath in projectsUnderModule)
{
@@ -174,7 +191,7 @@ public class SolutionFileModifier : ITransientDependency
lines.InsertAfter(l => l.Contains("GlobalSection") && l.Contains("NestedProjects"), newPreSolutionLine);
}
- File.WriteAllText(solutionFile, string.Join(Environment.NewLine, lines));
+ File.WriteAllText(solutionFile, string.Join(Environment.NewLine, lines), Encoding.UTF8);
if (module.MasterModuleInfos != null)
{
@@ -219,7 +236,7 @@ public class SolutionFileModifier : ITransientDependency
.Split(" ").Last();
}
- File.WriteAllText(solutionFile, string.Join(Environment.NewLine, lines));
+ File.WriteAllText(solutionFile, string.Join(Environment.NewLine, lines), Encoding.UTF8);
return folderId;
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
index dfed250f1a..2bfcad2d32 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
@@ -100,7 +100,7 @@ public class SolutionModuleAdder : ITransientDependency
Check.NotNull(solutionFile, nameof(solutionFile));
Check.NotNull(moduleName, nameof(moduleName));
- await PublishEventAsync(1, "Retriving module info...");
+ await PublishEventAsync(1, "Retrieving module info...");
var module = await GetModuleInfoAsync(moduleName, newTemplate, newProTemplate);
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs
index 900930d472..98ad57f4b4 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs
@@ -9,6 +9,7 @@ using Volo.Abp.Cli.NuGet;
using Volo.Abp.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
+using System.Text;
namespace Volo.Abp.Cli.ProjectModification;
@@ -17,6 +18,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency
private readonly NuGetService _nuGetService;
private readonly MyGetPackageListFinder _myGetPackageListFinder;
public ILogger Logger { get; set; }
+ public static Encoding DefaultEncoding = Encoding.UTF8;
public VoloNugetPackagesVersionUpdater(NuGetService nuGetService, MyGetPackageListFinder myGetPackageListFinder)
{
@@ -41,17 +43,30 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency
async Task UpdateAsync(string filePath)
{
- var fileContent = File.ReadAllText(filePath);
- var updatedContent = await UpdateVoloPackagesAsync(fileContent,
- includePreviews,
- includeReleaseCandidates,
- switchToStable,
- latestVersionFromNuget,
- latestReleaseCandidateVersionFromNuget,
- latestVersionFromMyGet,
- version);
-
- File.WriteAllText(filePath, updatedContent);
+ using (var fs = File.Open(filePath, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
+ {
+ using (var sr = new StreamReader(fs, Encoding.Default, true))
+ {
+ var fileContent = await sr.ReadToEndAsync();
+
+ var updatedContent = await UpdateVoloPackagesAsync(fileContent,
+ includePreviews,
+ includeReleaseCandidates,
+ switchToStable,
+ latestVersionFromNuget,
+ latestReleaseCandidateVersionFromNuget,
+ latestVersionFromMyGet,
+ version);
+
+ fs.Seek(0, SeekOrigin.Begin);
+ fs.SetLength(0);
+ using (var sw = new StreamWriter(fs, DefaultEncoding))
+ {
+ await sw.WriteAsync(updatedContent);
+ await sw.FlushAsync();
+ }
+ }
+ }
}
Task.WaitAll(projectPaths.Select(UpdateAsync).ToArray());
@@ -70,27 +85,54 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency
var latestReleaseCandidateVersionFromNuget = await _nuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Core", includeReleaseCandidates: true);
var latestVersionFromMyGet = await GetLatestVersionFromMyGet("Volo.Abp.Core");
- var fileContent = File.ReadAllText(projectPath);
+ using (var fs = File.Open(projectPath, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
+ {
+ using (var sr = new StreamReader(fs, Encoding.Default, true))
+ {
+ var fileContent = await sr.ReadToEndAsync();
+
+ var updatedContent = await UpdateVoloPackagesAsync(fileContent,
+ includeNightlyPreviews,
+ includeReleaseCandidates,
+ switchToStable,
+ latestVersionFromNuget,
+ latestReleaseCandidateVersionFromNuget,
+ latestVersionFromMyGet,
+ version);
- var updatedContent = await UpdateVoloPackagesAsync(fileContent,
- includeNightlyPreviews,
- includeReleaseCandidates,
- switchToStable,
- latestVersionFromNuget,
- latestReleaseCandidateVersionFromNuget,
- latestVersionFromMyGet,
- version);
+ fs.Seek(0, SeekOrigin.Begin);
+ fs.SetLength(0);
- File.WriteAllText(projectPath, updatedContent);
+ using (var sw = new StreamWriter(fs, sr.CurrentEncoding))
+ {
+ await sw.WriteAsync(updatedContent);
+ await sw.FlushAsync();
+ }
+ }
+ }
}
}
protected virtual async Task UpdateInternalAsync(string projectPath, bool includeNightlyPreviews = false, bool includeReleaseCandidates = false, bool switchToStable = false)
{
- var fileContent = File.ReadAllText(projectPath);
- var updatedContent = await UpdateVoloPackagesAsync(fileContent, includeNightlyPreviews, includeReleaseCandidates, switchToStable);
+ using (var fs = File.Open(projectPath, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
+ {
+ using (var sr = new StreamReader(fs, Encoding.Default, true))
+ {
+ var fileContent = await sr.ReadToEndAsync();
+
+ var updatedContent = await UpdateVoloPackagesAsync(fileContent, includeNightlyPreviews, includeReleaseCandidates, switchToStable);
- File.WriteAllText(projectPath, updatedContent);
+ fs.Seek(0, SeekOrigin.Begin);
+ fs.SetLength(0);
+
+ using (var sw = new StreamWriter(fs, sr.CurrentEncoding))
+ {
+ await sw.WriteAsync(updatedContent);
+ await sw.FlushAsync();
+ }
+ }
+ }
}
protected virtual async Task SpecifiedVersionExists(string version, string packageId)
@@ -210,7 +252,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency
}
catch (Exception ex)
{
- Logger.LogError("Cannot update Volo.* packages! An error occured while updating the package \"{0}\". Error: {1}", packageId, ex.Message);
+ Logger.LogError("Cannot update Volo.* packages! An error occurred while updating the package \"{0}\". Error: {1}", packageId, ex.Message);
Logger.LogException(ex);
}
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 483d047e86..741390dc73 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
@@ -58,6 +58,22 @@ public class CmdHelper : ICmdHelper, ITransientDependency
}
}
+ public Process RunCmdAndGetProcess(string command, string workingDirectory = null)
+ {
+ var procStartInfo = new ProcessStartInfo(
+ GetFileName(),
+ GetArguments(command)
+ );
+
+ if (!string.IsNullOrEmpty(workingDirectory))
+ {
+ procStartInfo.WorkingDirectory = workingDirectory;
+ procStartInfo.CreateNoWindow = false;
+ }
+
+ return Process.Start(procStartInfo);
+ }
+
public string RunCmdAndGetOutput(string command, string workingDirectory = null)
{
return RunCmdAndGetOutput(command, out int _, workingDirectory);
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/ICmdHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/ICmdHelper.cs
index 984b705d33..648215d24f 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/ICmdHelper.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/ICmdHelper.cs
@@ -1,4 +1,6 @@
-namespace Volo.Abp.Cli.Utils;
+using System.Diagnostics;
+
+namespace Volo.Abp.Cli.Utils;
public interface ICmdHelper
{
@@ -12,6 +14,8 @@ public interface ICmdHelper
void RunCmd(string command, string workingDirectory = null);
+ Process RunCmdAndGetProcess(string command, string workingDirectory = null);
+
void RunCmd(string command, out int exitCode, string workingDirectory = null);
string RunCmdAndGetOutput(string command, string workingDirectory = null);
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs
index 72e7870125..286b9a8c76 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs
@@ -15,7 +15,7 @@ public class ExposeServicesAttribute : Attribute, IExposedServiceTypesProvider
public ExposeServicesAttribute(params Type[] serviceTypes)
{
- ServiceTypes = serviceTypes ?? new Type[0];
+ ServiceTypes = serviceTypes ?? Type.EmptyTypes;
}
public Type[] GetExposedServiceTypes(Type targetType)
@@ -49,6 +49,10 @@ public class ExposeServicesAttribute : Attribute, IExposedServiceTypesProvider
foreach (var interfaceType in type.GetTypeInfo().GetInterfaces())
{
var interfaceName = interfaceType.Name;
+ if (interfaceType.IsGenericType)
+ {
+ interfaceName = interfaceType.Name.Left(interfaceType.Name.IndexOf('`'));
+ }
if (interfaceName.StartsWith("I"))
{
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs
index d4d4a5bed0..dded0d794e 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs
@@ -57,8 +57,6 @@ public static class CultureHelper
public static string GetBaseCultureName(string cultureName)
{
- return cultureName.Contains("-")
- ? cultureName.Left(cultureName.IndexOf("-", StringComparison.Ordinal))
- : cultureName;
+ return new CultureInfo(cultureName).Parent.Name;
}
}
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Design/AbpDesignTimeDbContextBase.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Design/AbpDesignTimeDbContextBase.cs
new file mode 100644
index 0000000000..c3746f620d
--- /dev/null
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Design/AbpDesignTimeDbContextBase.cs
@@ -0,0 +1,39 @@
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Design;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Modularity;
+using Volo.Abp.Threading;
+
+namespace Volo.Abp.EntityFrameworkCore.Design;
+
+public abstract class AbpDesignTimeDbContextBase : IDesignTimeDbContextFactory
+ where TModule : AbpModule
+ where TContext : DbContext
+{
+ public virtual TContext CreateDbContext(string[] args)
+ {
+ return AsyncHelper.RunSync(() => CreateDbContextAsync(args));
+ }
+
+ protected virtual async Task CreateDbContextAsync(string[] args)
+ {
+ var application = await AbpApplicationFactory.CreateAsync(options =>
+ {
+ options.Services.ReplaceConfiguration(BuildConfiguration());
+ ConfigureServices(options.Services);
+ });
+
+ await application.InitializeAsync();
+
+ return application.ServiceProvider.GetRequiredService();
+ }
+
+ protected virtual void ConfigureServices(IServiceCollection services)
+ {
+
+ }
+
+ protected abstract IConfigurationRoot BuildConfiguration();
+}
diff --git a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpAzureEventBusOptions.cs b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpAzureEventBusOptions.cs
index a6aa2f9857..57fa4b7f48 100644
--- a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpAzureEventBusOptions.cs
+++ b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpAzureEventBusOptions.cs
@@ -7,4 +7,6 @@ public class AbpAzureEventBusOptions
public string SubscriberName { get; set; }
public string TopicName { get; set; }
+
+ public bool IsServiceBusDisabled { get; set; }
}
diff --git a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpEventBusAzureModule.cs b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpEventBusAzureModule.cs
index 64c8b2fcd3..129004c871 100644
--- a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpEventBusAzureModule.cs
+++ b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpEventBusAzureModule.cs
@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
using Volo.Abp.AzureServiceBus;
using Volo.Abp.Modularity;
@@ -19,9 +20,15 @@ public class AbpEventBusAzureModule : AbpModule
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
- context
- .ServiceProvider
- .GetRequiredService()
- .Initialize();
+ var options = context.ServiceProvider.GetRequiredService>().Value;
+
+ if (!options.IsServiceBusDisabled)
+ {
+ context
+ .ServiceProvider
+ .GetRequiredService()
+ .Initialize();
+ }
+
}
}
diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs
index ad09223f05..addbc49171 100644
--- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs
+++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs
@@ -1,10 +1,23 @@
-namespace Volo.Abp.EventBus.RabbitMq;
+using Volo.Abp.RabbitMQ;
+
+namespace Volo.Abp.EventBus.RabbitMq;
public class AbpRabbitMqEventBusOptions
{
+ public const string DefaultExchangeType = RabbitMqConsts.ExchangeTypes.Direct;
+
public string ConnectionName { get; set; }
public string ClientName { get; set; }
public string ExchangeName { get; set; }
+
+ public string ExchangeType { get; set; }
+
+ public string GetExchangeTypeOrDefault()
+ {
+ return string.IsNullOrEmpty(ExchangeType)
+ ? DefaultExchangeType
+ : ExchangeType;
+ }
}
diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs
index c57d9e9417..a2932de52e 100644
--- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs
+++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs
@@ -69,7 +69,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe
Consumer = MessageConsumerFactory.Create(
new ExchangeDeclareConfiguration(
AbpRabbitMqEventBusOptions.ExchangeName,
- type: "direct",
+ type: AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(),
durable: true
),
new QueueDeclareConfiguration(
@@ -244,7 +244,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe
{
channel.ExchangeDeclare(
AbpRabbitMqEventBusOptions.ExchangeName,
- "direct",
+ AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(),
durable: true
);
diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs
index 19b8ddb573..996e88959b 100644
--- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs
+++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs
@@ -8,4 +8,15 @@ public static class RabbitMqConsts
public const int Persistent = 2;
}
+
+ public static class ExchangeTypes
+ {
+ public const string Direct = "direct";
+
+ public const string Topic = "topic";
+
+ public const string Fanout = "fanout";
+
+ public const string Headers = "headers";
+ }
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController_Tests.cs
index a56c8ef8ad..1a60ab9d6b 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController_Tests.cs
@@ -16,6 +16,7 @@ public class RemoteStreamContentTestController_Tests : AspNetCoreMvcTestBase
var result = await GetResponseAsync("/api/remote-stream-content-test/download");
result.Content.Headers.ContentType?.ToString().ShouldBe("application/rtf");
result.Content.Headers.ContentDisposition?.FileName.ShouldBe("download.rtf");
+ result.Content.Headers.ContentLength.ShouldBe("DownloadAsync".Length);
(await result.Content.ReadAsStringAsync()).ShouldBe("DownloadAsync");
}
diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/AutoRegistrationHelper_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/AutoRegistrationHelper_Tests.cs
index 3c7ccfbc6a..5d8716a70c 100644
--- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/AutoRegistrationHelper_Tests.cs
+++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/AutoRegistrationHelper_Tests.cs
@@ -33,6 +33,21 @@ public class AutoRegistrationHelper_Tests
exposedServices.ShouldContain(typeof(IDerivedService));
}
+ [Fact]
+ public void Should_Get_Conventional_Exposed_Generic_Types_By_Default()
+ {
+ //Act
+ var exposedServices = ExposedServiceExplorer.GetExposedServices(typeof(DefaultGenericService));
+
+ //Assert
+ exposedServices.Count.ShouldBe(4);
+ exposedServices.ShouldContain(typeof(IService));
+ exposedServices.ShouldContain(typeof(IGenericService));
+ exposedServices.ShouldContain(typeof(IGenericService));
+ exposedServices.ShouldContain(typeof(DefaultGenericService));
+ }
+
+
public class DefaultDerivedService : IDerivedService
{
}
@@ -50,4 +65,14 @@ public class AutoRegistrationHelper_Tests
{
}
+
+ public interface IGenericService
+ {
+
+ }
+
+ public class DefaultGenericService : IService, IGenericService, IGenericService
+ {
+
+ }
}
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 b8375485f7..6c4bdfff08 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
@@ -1,4 +1,4 @@
-using System.Globalization;
+using System.Globalization;
using System.Linq;
using Microsoft.Extensions.Localization;
using Shouldly;
@@ -183,6 +183,60 @@ public class AbpLocalization_Tests : AbpIntegratedTest
- netstandard2.0
+ net6.0
Volo.Abp.Account.Application
Volo.Abp.Account.Application
true
diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
index fe94f47415..5ec85d4078 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
+++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
@@ -277,6 +277,18 @@ public class LoginModel : AccountPageModel
CheckIdentityErrors(await UserManager.SetEmailAsync(user, emailAddress));
CheckIdentityErrors(await UserManager.AddLoginAsync(user, info));
CheckIdentityErrors(await UserManager.AddDefaultRolesAsync(user));
+
+ user.Name = info.Principal.FindFirstValue(AbpClaimTypes.Name);
+ user.Surname = info.Principal.FindFirstValue(AbpClaimTypes.SurName);
+
+ var phoneNumber = info.Principal.FindFirstValue(AbpClaimTypes.PhoneNumber);
+ if (!phoneNumber.IsNullOrWhiteSpace())
+ {
+ var phoneNumberConfirmed = string.Equals(info.Principal.FindFirstValue(AbpClaimTypes.PhoneNumberVerified), "true", StringComparison.InvariantCultureIgnoreCase);
+ user.SetPhoneNumber(phoneNumber, phoneNumberConfirmed);
+ }
+
+ await UserManager.UpdateAsync(user);
return user;
}
diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj
index 7eb9015b73..b46209de47 100644
--- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj
+++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj
@@ -4,7 +4,7 @@
- netstandard2.0
+ netstandard2.1
diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj
index 56c1391ab9..7d29486644 100644
--- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj
+++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj
@@ -4,7 +4,7 @@
- netstandard2.0
+ netstandard2.1
diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LanguageSwitch.razor b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LanguageSwitch.razor
index 75b64e05b7..afa3521d01 100644
--- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LanguageSwitch.razor
+++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LanguageSwitch.razor
@@ -7,11 +7,11 @@
@inject IAbpRequestLocalizationOptionsProvider RequestLocalizationOptionsProvider
@if (_otherLanguages != null && _otherLanguages.Any())
{
-
+
@_currentLanguage.DisplayName
-
+
@foreach (var language in _otherLanguages)
{
@language.DisplayName
diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor
index 6f89696075..4b41add531 100644
--- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor
+++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor
@@ -5,11 +5,11 @@
@inject IJSRuntime JsRuntime
@if (_otherLanguages != null && _otherLanguages.Any())
{
-
+
@_currentLanguage.DisplayName
-
+
@foreach (var language in _otherLanguages)
{
@language.DisplayName
diff --git a/modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj b/modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj
index a846bb0ca6..e707190be5 100644
--- a/modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj
+++ b/modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj
@@ -3,7 +3,7 @@
- netstandard2.0
+ netstandard2.1
diff --git a/modules/blogging/src/Volo.Blogging.Admin.Application/Volo.Blogging.Admin.Application.csproj b/modules/blogging/src/Volo.Blogging.Admin.Application/Volo.Blogging.Admin.Application.csproj
index 456777e60a..6df6b27bb7 100644
--- a/modules/blogging/src/Volo.Blogging.Admin.Application/Volo.Blogging.Admin.Application.csproj
+++ b/modules/blogging/src/Volo.Blogging.Admin.Application/Volo.Blogging.Admin.Application.csproj
@@ -4,7 +4,7 @@
- netstandard2.0
+ net6.0
Volo.Blogging.Admin.Application
Volo.Blogging.Admin.Application
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 504d32836d..99c491231b 100644
--- a/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj
+++ b/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj
@@ -4,7 +4,7 @@
- netstandard2.0
+ net6.0
Volo.Blogging.Application
Volo.Blogging.Application
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 457656291f..15506ecf70 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
@@ -231,11 +231,16 @@ namespace Volo.Blogging.Posts
return url;
}
- private async Task SaveTags(ICollection newTags, Post post)
+ private async Task SaveTags(ICollection tags, Post post)
{
- await RemoveOldTags(newTags, post);
-
- await AddNewTags(newTags, post);
+ tags = tags
+ .Select(t => t.ToLowerInvariant())
+ .Distinct()
+ .ToList();
+
+ await RemoveOldTags(tags, post);
+
+ await AddNewTags(tags, post);
}
private async Task RemoveOldTags(ICollection newTags, Post post)
diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj b/modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj
index c6c096105b..905494aa41 100644
--- a/modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj
+++ b/modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj
@@ -4,7 +4,7 @@
- netstandard2.0
+ netstandard2.1
Volo.Blogging.Domain
Volo.Blogging.Domain
diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo.Blogging.MongoDB.csproj b/modules/blogging/src/Volo.Blogging.MongoDB/Volo.Blogging.MongoDB.csproj
index 5019b843f2..83d8759d14 100644
--- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo.Blogging.MongoDB.csproj
+++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo.Blogging.MongoDB.csproj
@@ -4,7 +4,7 @@
- netstandard2.0
+ netstandard2.1
Volo.Blogging.MongoDB
Volo.Blogging.MongoDB
diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220324203918_Added_BlogPostStatus.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220324203918_Added_BlogPostStatus.Designer.cs
new file mode 100644
index 0000000000..d04ca4c0ed
--- /dev/null
+++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220324203918_Added_BlogPostStatus.Designer.cs
@@ -0,0 +1,2118 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Volo.Abp.EntityFrameworkCore;
+using Volo.CmsKit.EntityFrameworkCore;
+
+#nullable disable
+
+namespace Volo.CmsKit.Migrations
+{
+ [DbContext(typeof(UnifiedDbContext))]
+ [Migration("20220324203918_Added_BlogPostStatus")]
+ partial class Added_BlogPostStatus
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
+ .HasAnnotation("ProductVersion", "6.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ApplicationName")
+ .HasMaxLength(96)
+ .HasColumnType("nvarchar(96)")
+ .HasColumnName("ApplicationName");
+
+ b.Property("BrowserInfo")
+ .HasMaxLength(512)
+ .HasColumnType("nvarchar(512)")
+ .HasColumnName("BrowserInfo");
+
+ b.Property("ClientId")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("ClientId");
+
+ b.Property("ClientIpAddress")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("ClientIpAddress");
+
+ b.Property("ClientName")
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("ClientName");
+
+ b.Property("Comments")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("Comments");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CorrelationId")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("CorrelationId");
+
+ b.Property("Exceptions")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("int")
+ .HasColumnName("ExecutionDuration");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("HttpMethod")
+ .HasMaxLength(16)
+ .HasColumnType("nvarchar(16)")
+ .HasColumnName("HttpMethod");
+
+ b.Property("HttpStatusCode")
+ .HasColumnType("int")
+ .HasColumnName("HttpStatusCode");
+
+ b.Property("ImpersonatorTenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("ImpersonatorTenantId");
+
+ b.Property("ImpersonatorTenantName")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("ImpersonatorTenantName");
+
+ b.Property("ImpersonatorUserId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("ImpersonatorUserId");
+
+ b.Property("ImpersonatorUserName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("ImpersonatorUserName");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.Property("TenantName")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("TenantName");
+
+ b.Property("Url")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("Url");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("UserId");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("UserName");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "ExecutionTime");
+
+ b.HasIndex("TenantId", "UserId", "ExecutionTime");
+
+ b.ToTable("AbpAuditLogs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AuditLogId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("AuditLogId");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("int")
+ .HasColumnName("ExecutionDuration");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("ExecutionTime");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("MethodName")
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("MethodName");
+
+ b.Property("Parameters")
+ .HasMaxLength(2000)
+ .HasColumnType("nvarchar(2000)")
+ .HasColumnName("Parameters");
+
+ b.Property("ServiceName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("ServiceName");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuditLogId");
+
+ b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime");
+
+ b.ToTable("AbpAuditLogActions", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AuditLogId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("AuditLogId");
+
+ b.Property("ChangeTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("ChangeTime");
+
+ b.Property("ChangeType")
+ .HasColumnType("tinyint")
+ .HasColumnName("ChangeType");
+
+ b.Property("EntityId")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("EntityId");
+
+ b.Property("EntityTenantId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("EntityTypeFullName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("EntityTypeFullName");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuditLogId");
+
+ b.HasIndex("TenantId", "EntityTypeFullName", "EntityId");
+
+ b.ToTable("AbpEntityChanges", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("EntityChangeId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("NewValue")
+ .HasMaxLength(512)
+ .HasColumnType("nvarchar(512)")
+ .HasColumnName("NewValue");
+
+ b.Property("OriginalValue")
+ .HasMaxLength(512)
+ .HasColumnType("nvarchar(512)")
+ .HasColumnName("OriginalValue");
+
+ b.Property("PropertyName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("PropertyName");
+
+ b.Property("PropertyTypeFullName")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("PropertyTypeFullName");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EntityChangeId");
+
+ b.ToTable("AbpEntityPropertyChanges", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ContainerId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Content")
+ .HasMaxLength(2147483647)
+ .HasColumnType("varbinary(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ContainerId");
+
+ b.HasIndex("TenantId", "ContainerId", "Name");
+
+ b.ToTable("AbpBlobs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "Name");
+
+ b.ToTable("AbpBlobContainers", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("ProviderKey")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("ProviderName")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name", "ProviderName", "ProviderKey")
+ .IsUnique()
+ .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL");
+
+ b.ToTable("AbpFeatureValues", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("Description")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsStatic")
+ .HasColumnType("bit");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("Regex")
+ .HasMaxLength(512)
+ .HasColumnType("nvarchar(512)");
+
+ b.Property("RegexDescription")
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("Required")
+ .HasColumnType("bit");
+
+ b.Property("ValueType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("AbpClaimTypes", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SourceTenantId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SourceUserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TargetTenantId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TargetUserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId")
+ .IsUnique()
+ .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL");
+
+ b.ToTable("AbpLinkUsers", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDefault")
+ .HasColumnType("bit")
+ .HasColumnName("IsDefault");
+
+ b.Property("IsPublic")
+ .HasColumnType("bit")
+ .HasColumnName("IsPublic");
+
+ b.Property("IsStatic")
+ .HasColumnType("bit")
+ .HasColumnName("IsStatic");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("NormalizedName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName");
+
+ b.ToTable("AbpRoles", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ClaimType")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("ClaimValue")
+ .HasMaxLength(1024)
+ .HasColumnType("nvarchar(1024)");
+
+ b.Property("RoleId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AbpRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Action")
+ .HasMaxLength(96)
+ .HasColumnType("nvarchar(96)");
+
+ b.Property("ApplicationName")
+ .HasMaxLength(96)
+ .HasColumnType("nvarchar(96)");
+
+ b.Property("BrowserInfo")
+ .HasMaxLength(512)
+ .HasColumnType("nvarchar(512)");
+
+ b.Property("ClientId")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("ClientIpAddress")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CorrelationId")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("Identity")
+ .HasMaxLength(96)
+ .HasColumnType("nvarchar(96)");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.Property("TenantName")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "Action");
+
+ b.HasIndex("TenantId", "ApplicationName");
+
+ b.HasIndex("TenantId", "Identity");
+
+ b.HasIndex("TenantId", "UserId");
+
+ b.ToTable("AbpSecurityLogs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AccessFailedCount")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasDefaultValue(0)
+ .HasColumnName("AccessFailedCount");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("DeletionTime");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("Email");
+
+ b.Property("EmailConfirmed")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("EmailConfirmed");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsActive")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("IsExternal")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("IsExternal");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("LockoutEnabled")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("LockoutEnabled");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("Name")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("Name");
+
+ b.Property("NormalizedEmail")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("NormalizedEmail");
+
+ b.Property("NormalizedUserName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("NormalizedUserName");
+
+ b.Property("PasswordHash")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("PasswordHash");
+
+ b.Property("PhoneNumber")
+ .HasMaxLength(16)
+ .HasColumnType("nvarchar(16)")
+ .HasColumnName("PhoneNumber");
+
+ b.Property("PhoneNumberConfirmed")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("PhoneNumberConfirmed");
+
+ b.Property("SecurityStamp")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("SecurityStamp");
+
+ b.Property("Surname")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("Surname");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.Property("TwoFactorEnabled")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("TwoFactorEnabled");
+
+ b.Property("UserName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("UserName");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Email");
+
+ b.HasIndex("NormalizedEmail");
+
+ b.HasIndex("NormalizedUserName");
+
+ b.HasIndex("UserName");
+
+ b.ToTable("AbpUsers", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ClaimType")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("ClaimValue")
+ .HasMaxLength(1024)
+ .HasColumnType("nvarchar(1024)");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AbpUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("LoginProvider")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("ProviderDisplayName")
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("ProviderKey")
+ .IsRequired()
+ .HasMaxLength(196)
+ .HasColumnType("nvarchar(196)");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("UserId", "LoginProvider");
+
+ b.HasIndex("LoginProvider", "ProviderKey");
+
+ b.ToTable("AbpUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b =>
+ {
+ b.Property("OrganizationUnitId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("OrganizationUnitId", "UserId");
+
+ b.HasIndex("UserId", "OrganizationUnitId");
+
+ b.ToTable("AbpUserOrganizationUnits", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("RoleId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId", "UserId");
+
+ b.ToTable("AbpUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("LoginProvider")
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("Name")
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AbpUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasMaxLength(95)
+ .HasColumnType("nvarchar(95)")
+ .HasColumnName("Code");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("DeletionTime");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("DisplayName");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("ParentId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Code");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("AbpOrganizationUnits", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b =>
+ {
+ b.Property("OrganizationUnitId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("RoleId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property