diff --git a/.github/ISSUE_TEMPLATE/02_feature_request.yml b/.github/ISSUE_TEMPLATE/02_feature_request.yml
index 21189e3a30..029830c7c5 100644
--- a/.github/ISSUE_TEMPLATE/02_feature_request.yml
+++ b/.github/ISSUE_TEMPLATE/02_feature_request.yml
@@ -1,6 +1,6 @@
name: 💡 Feature request
description: Suggest an idea for this project
-labels: [feature]
+labels: [feature-request]
body:
- type: checkboxes
attributes:
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000000..43e9cba5de
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,14 @@
+# Security Policy
+
+## Supported Versions
+
+| Version | Supported |
+| ------- | ------------------ |
+| 7.x.x | :white_check_mark: |
+| < 7.0.0 | :x: |
+
+## Reporting a Vulnerability
+
+Please don not share vulnerabilities publicly in GitHub or other platforms.
+You can report security issues by sending a email to `security@abp.io`
+Your report is immediately evaluated. We publish patch versions for critical vulnerabilities in a week at most.
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/ar.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/ar.json
index 4a7e64125f..d3537d3742 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/ar.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/ar.json
@@ -167,7 +167,7 @@
"ABPDiscordServer": "ABP سيرفر الدسكورد",
"ABPCommunityTalks": "برامج منتدى ABP الحوارية",
"ABPCommunityPosts": "منشورات منتدى ABP",
- "BuyAndGetMonths": "شراء 12 شهر، احصل على 14 شهرا!",
+ "BuyAndGetMonths": "شراء 12 شهر، احصل على 14 شهرا!",
"GetYourDeal": "احصل على صفقتك",
"BuyOrRenewLicense": "اشترِ أو جدد الرخصة الآن واحصل على شهرين إضافيين!",
"BuyOrRenewLicenseToGetExtra2Months": "اشترِ أو جدد الرخصة الآن واحصل على شهرين إضافيين! اسرع! ⏰ آخر يوم: {0}",
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json
index 9ef432a8bd..63f78103d9 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json
@@ -171,7 +171,7 @@
"ABPDiscordServer": "ABP Discord Server",
"ABPCommunityTalks": "ABP Community Talks",
"ABPCommunityPosts": "ABP Community Posts",
- "BuyAndGetMonths": "BUY 12 MONTHS, GET 14 MONTHS!",
+ "BuyAndGetMonths": "BUY 12 MONTHS, GET 14 MONTHS!",
"GetYourDeal": "Get Your Deal",
"BuyOrRenewLicense": "Buy or Renew License Now and Get 2 Extra Months!",
"BuyOrRenewLicenseToGetExtra2Months": "Buy or Renew License Now and Get 2 Extra Months! HURRY UP! ⏰ Last Day: {0}",
@@ -187,7 +187,7 @@
"GiveAwayForNewPurchases": "Application Development Classroom Training will be given away for the new purchases!",
"BlackFriday": "BLACKFRIDAY",
"ValidForExistingCustomers": "Also valid for the existing customers!",
- "CampaignBetweenDates": "From {0} to {1}",
+ "CampaignBetweenDates": "From {0} To {1}",
"SaveUpTo": "SAVE UP TO${0}K",
"ImplementingDDD": "Implementing Domain Driven Design",
"ExploreTheEBook": "Explore the E-Book",
@@ -220,6 +220,7 @@
"NoContent": "No content",
"More": "More",
"WhyABPIOPlatform": "Why ABP.IO Platform?",
- "AbpStudio": "ABP Studio"
+ "AbpStudio": "ABP Studio",
+ "ExtraMonths": "{0}EXTRA MONTHS"
}
}
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/fi.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/fi.json
index 16437480ef..80f351043f 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/fi.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/fi.json
@@ -170,7 +170,7 @@
"ABPDiscordServer": "ABP Discord-palvelin",
"ABPCommunityTalks": "ABP Community Talks",
"ABPCommunityPosts": "ABP-yhteisön viestit",
- "BuyAndGetMonths": "OSTA 12 KUUKAUTA, SAAT 14 KUUKAUTA!",
+ "BuyAndGetMonths": "OSTA 12 KUUKAUTA, SAAT 14 KUUKAUTA!",
"GetYourDeal": "Hanki tarjouksesi",
"BuyOrRenewLicense": "Osta tai uusi lisenssi nyt ja saat 2 lisäkuukautta!",
"BuyOrRenewLicenseToGetExtra2Months": "Osta tai uusi lisenssi nyt ja saat 2 lisäkuukautta! KIIREHDI! ⏰ Viimeinen päivä: {0}",
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/hu.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/hu.json
index b9ccddecf4..d785f418aa 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/hu.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/hu.json
@@ -168,7 +168,7 @@
"ABPDiscordServer": "ABP Discord szerver",
"ABPCommunityTalks": "ABP közösségi beszélgetések",
"ABPCommunityPosts": "ABP közösségi bejegyzések",
- "BuyAndGetMonths": "VÁSÁROLJON 12 HÓNAPOT, 14 HÓNAPOT KAP!",
+ "BuyAndGetMonths": "VÁSÁROLJON 12 HÓNAPOT, 14 HÓNAPOT KAP!",
"GetYourDeal": "Szerezze meg az ajánlatát",
"BuyOrRenewLicense": "Vásároljon vagy újítson meg licencet most, és 2 további hónapot kap!",
"BuyOrRenewLicenseToGetExtra2Months": "Vásároljon vagy újítson meg licencet most, és 2 további hónapot kap! SIESS! ⏰ Utolsó nap: {0}",
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json
index d1a0db7176..545a909abf 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json
@@ -170,7 +170,7 @@
"ABPDiscordServer": "ABP Discord 服务器",
"ABPCommunityTalks": "ABP社区讲话",
"ABPCommunityPosts": "ABP社区文章",
- "BuyAndGetMonths": "购买 12 个月,获得 14 个月!",
+ "BuyAndGetMonths": "购买 12 个月,获得 14 个月!",
"GetYourDeal": "得到你的交易",
"BuyOrRenewLicense": "立即购买或续订许可证并额外获得 2 个月!",
"BuyOrRenewLicenseToGetExtra2Months": "立即购买或续订 ABP 商业许可证(适用于所有版本)并额外获得 2 个月!",
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
index 1b8c972d5c..d9794a06e4 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
@@ -567,7 +567,7 @@
"TotalPrice": "Total Price",
"ThereIsNoInvoice": "There is no invoice",
"MyOrganizations_Detail_PaymentProviderInfo": "If you have purchased your license through {0} gateway, it sends the PDF invoice to your email address, see {0} invoicing.",
- "MyOrganizations_Detail_PayUInfo": "If you have purchased through the PayU gateway, click the \"Request Invoice\" button and fill in the billing information.",
+ "MyOrganizations_Detail_PayUInfo": "If you have purchased through the Iyzico gateway, click the \"Request Invoice\" button and fill in the billing information.",
"MyOrganizations_Detail_ConclusionInfo": "Your invoice request will be concluded within {0} business days.",
"ExtendYourLicense": "Extend your {0} license",
"Continue": "Continue",
@@ -1001,19 +1001,19 @@
"ABPSOLUTION": "ABP SOLUTION",
"CreatingAnEmptySolution_ABPSOLUTION_Description": "ABP provides a well-architected, layered and production-ready startup solution based on the Domain Driven Design principles. The solution also includes a pre-configured unit and integration test projects for each layer.",
"CommonLibraries": "Common Libraries",
- "CommonLibraries_THEPROBLEM_Description": "Which libraries should you use to implement common requirements? The software development ecosystem is highly dynamic and it is hard to follow the latest tools, libraries, trends and approaches.",
- "CommonLibraries_ABPSOLUTION_Description": "ABP pre-integrates the popular, mature and up-to-date libraries into the solution. You don't spend time integrating them and talking to each other. They properly work out of the box.",
+ "CommonLibraries_THEPROBLEM_Description": "Which libraries should you use to implement common requirements? The software development ecosystem is highly dynamic, making it challenging to keep up with the latest tools, libraries, trends, and approaches.",
+ "CommonLibraries_ABPSOLUTION_Description": "ABP pre-integrates popular, mature, and up-to-date libraries into the solution. You don't need to spend time integrating them or making them communicate with each other. They work properly out of the box.",
"UITheme&Layout": "UI Theme & Layout",
- "UITheme&Layout_THEPROBLEM_Description": "When it comes to the UI, there are a lot of challenges, including preparing a foundation to create a responsive, modern and flexible UI kit with a consistent look & feel and tons of features (like left/top navigation menu, header, toolbar, footer, widgets and so.).",
- "UITheme&Layout_THEPROBLEM_Description2": "Even if you buy a pre-built theme, integrating it into your solution may take days of development. Upgrading such a theme is another problem. Most of the time, the theme's HTML/CSS structure is mixed with your UI code, and it is not easy to upgrade or change the theme later.",
- "UITheme&Layout_ABPSOLUTION_Description": "ABP Framework provides a theming system that makes your UI code independent from the theme. Themes are isolated, and they are NuGet/NPM packages. Installing or upgrading a theme is just a minute. While you can build your theme (or integrate an existing theme), ABP Commercial offers professional and modern themes.",
- "UITheme&Layout_ABPSOLUTION_Description2": "There are also UI component providers (like Telerik and DevExpress). But they only provide individual components. You are responsible for creating your own layout system. You can use such libraries in your ABP-based solutions just like in any other project.",
+ "UITheme&Layout_THEPROBLEM_Description": "When addressing UI concerns, a range of challenges surfaces. These include establishing the groundwork for a responsive, contemporary, and adaptable UI kit with a consistent appearance and a host of features like navigation menus, headers, toolbars, footers, widgets, and more.",
+ "UITheme&Layout_THEPROBLEM_Description2": "Even if you opt for a pre-designed theme, seamlessly integrating it into your project could demand days of development. An additional hurdle lies in upgrading such themes. Frequently, the theme's HTML/CSS structure becomes intertwined with your UI code, rendering future theme changes or upgrades intricate tasks. This interweaving of code and design complicates the flexibility of making adjustments down the line.",
+ "UITheme&Layout_ABPSOLUTION_Description": "ABP Framework offers a distinctive theming system that liberates your UI code from theme constraints. Themes exist in isolation, packaged as NuGet or NPM packages, making theme installation or upgrades a matter of minutes. While you retain the option to develop your custom theme or integrate an existing one, ABP Commercial presents a collection of polished and contemporary themes.",
+ "UITheme&Layout_ABPSOLUTION_Description2": "Additionally, there are UI component providers like Telerik and DevExpress. However, these providers primarily furnish individual components, placing the onus on you to establish your layout system. When working within ABP-based projects, you can seamlessly incorporate these libraries, similar to how you would in any other project.",
"TestInfrastructure": "Test Infrastructure",
- "TestInfrastructure_THEPROBLEM_Description": "Preparing a robust test environment takes time. You need to setup test projects in your solution, select the tools, mock the services and database, create the required base classes and utility services to reduce repeating code in the tests and so on.",
- "TestInfrastructure_ABPSOLUTION_Description": "ABP Startup Templates comes with the test projects already configured for you, and you can immediately write your first unit or integration test code on day 1.",
+ "TestInfrastructure_THEPROBLEM_Description": "Establishing a robust testing environment is a time-consuming endeavor. It involves setting up dedicated test projects within your solution, carefully selecting the necessary tools, creating service and database mocks, crafting essential base classes and utility services to minimize redundant code across tests, and addressing various related tasks.",
+ "TestInfrastructure_ABPSOLUTION_Description": "ABP Startup Templates arrive pre-equipped with configured test projects, streamlining the process for you. This means that from day one, you can readily commence writing your initial unit or integration test code without delay.",
"CodingStandards&Training": "Coding Standards & Training",
- "CodingStandards&Training_THEPROBLEM_Description": "Once you create the development-ready solution, you typically need to train the developers to explain the system and develop it with the same conventions in a standard and consistent way. Even if you train the developers, it is hard to prepare and maintain your documentation. Over time, every developer will write the code differently, and coding standards will begin to diverge.",
- "CodingStandards&Training_ABPSOLUTION_Description": "ABP solution is already well-defined and well-documented. Tutorials and best practice guides clearly explain how to make development on an ABP project.",
+ "CodingStandards&Training_THEPROBLEM_Description": "After you've set up the solution for development, you usually have to teach the developers how the system works and how to build it using the same agreed-upon methods. Even if you give them training, keeping the documentation up-to-date can be difficult. As time goes on, each developer might write code in their own way, causing the rules for writing code to become different from each other.",
+ "CodingStandards&Training_ABPSOLUTION_Description": "The ABP solution is already neatly organized and has clear explanations. Step-by-step tutorials and guides show you exactly how to work on an ABP project.",
"KeepingYourSolutionUpToDate": "Keeping Your Solution Up to Date",
"KeepingYourSolutionUpToDate_THEPROBLEM_Description": "After you start your development, you must keep track of the new versions of the libraries you use for upgrades & patches.",
"KeepingYourSolutionUpToDate_ABPSOLUTION_Description": "We regularly update all packages to the latest versions and test them before the stable release. When you update the ABP Framework, all its dependencies are upgraded to edge technology.",
@@ -1073,6 +1073,8 @@
"ABPCommunity_Description2": "It is easy to share code or even re-usable libraries between ABP developers. A code snippet that works for you will also work for others. There are a lot of samples and tutorials that you can directly implement for your application.",
"ABPCommunity_Description3": "When you hire a developer who worked before with the ABP architecture will immediately understand your solution and start development in a very short time.",
"WhyAbpIo_Page_Title": "Why ABP.IO Platform?",
- "AbpStudio_Page_Title": "ABP Studio"
+ "AbpStudio_Page_Title": "ABP Studio",
+ "CampaignInfo": "Buy a new license or renew your existing license and get an additional 2 months at no additional cost! This offer is valid for all license plans. Ensure you take advantage of this limited-time promotion to expand your access to premium features and upgrades.",
+ "HurryUpLastDay": "Hurry Up! Last Day: {0}"
}
}
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json
index e6b3cf46f7..0377689bfc 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json
@@ -189,6 +189,7 @@
"SeeMoreVideos": "See more videos",
"DiscordPageTitle": "ABP Discord Community",
"ViewVideo": "View Video",
- "AbpCommunityTitleContent": "ABP Community - Open Source ABP Framework"
+ "AbpCommunityTitleContent": "ABP Community - Open Source ABP Framework",
+ "CommunitySlogan": "A unique community platform for ABP Lovers"
}
}
diff --git a/common.props b/common.props
index 4d75a2c459..e956b17835 100644
--- a/common.props
+++ b/common.props
@@ -1,7 +1,7 @@
latest
- 7.4.0-rc.2
+ 8.0.0$(NoWarn);CS1591;CS0436https://abp.io/assets/abp_nupkg.pnghttps://abp.io/
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/POST.md b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/POST.md
new file mode 100644
index 0000000000..c7d8411886
--- /dev/null
+++ b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/POST.md
@@ -0,0 +1,287 @@
+# ABP.IO Platform 7.4 RC Has Been Released
+
+Today, we are happy to release the [ABP Framework](https://abp.io/) and [ABP Commercial](https://commercial.abp.io/) version **7.4 RC** (Release Candidate). This blog post introduces the new features and important changes in this new version.
+
+Try this version and provide feedback for a more stable version of ABP v7.4! Thanks to all of you.
+
+## Get Started with the 7.4 RC
+
+Follow the steps below to try version 7.4.0 RC today:
+
+1) **Upgrade** the ABP CLI to version `7.4.0-rc.1` using a command line terminal:
+
+````bash
+dotnet tool update Volo.Abp.Cli -g --version 7.4.0-rc.1
+````
+
+**or install** it if you haven't before:
+
+````bash
+dotnet tool install Volo.Abp.Cli -g --version 7.4.0-rc.1
+````
+
+2) Create a **new application** with the `--preview` option:
+
+````bash
+abp new BookStore --preview
+````
+
+See the [ABP CLI documentation](https://docs.abp.io/en/abp/latest/CLI) for all the available options.
+
+> You can also use the [Get Started](https://abp.io/get-started) page to generate a CLI command to create a new application.
+
+You can use any IDE that supports .NET 7.x, like [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/).
+
+## Migration Guides
+
+There are a few breaking changes in this version that may affect your application.
+Please see the following migration documents, if you are upgrading from v7.3 or earlier:
+
+* [ABP Framework 7.3 to 7.4 Migration Guide](https://docs.abp.io/en/abp/7.4/Migration-Guides/Abp-7_4)
+
+## What's New with ABP Framework 7.4?
+
+In this section, I will introduce some major features released in this version. Here is a brief list of the titles that will be explained in the next sections:
+
+* Dynamic Setting Store
+* Introducing the `AdditionalAssemblyAttribute`
+* `CorrelationId` Support on Distributed Events
+* Database Migration System for EF Core
+* Other News
+
+### Dynamic Setting Store
+
+Prior to this version, it was hard to define settings in different microservices and centrally manage all setting definitions in a single admin application. To make that possible, we used to add project references for all the microservices' service contract packages from a single microservice, so it can know all the setting definitions and manage them.
+
+In this version, ABP Framework introduces the Dynamic Setting Store, which is an important feature that allows you to collect and get all setting definitions from a single point and overcome the setting management problems on microservices.
+
+> *Note*: If you are upgrading from an earlier version and using the Setting Management module, you need to create a new migration and apply it to your database because a new database table has been added for this feature.
+
+### Introducing the `AdditionalAssemblyAttribute`
+
+In this version, we have introduced the `AdditionalAssemblyAttribute` to define additional assemblies to be part of a module. ABP Framework automatically registers all the services of your module to the [Dependency Injection System](https://docs.abp.io/en/abp/latest/Dependency-Injection). It finds the service types by scanning types in the assembly that define your module class. Typically, every assembly contains a separate module class definition and modules depend on each other using the `DependsOn` attribute.
+
+In some rare cases, your module may consist of multiple assemblies and only one of them defines a module class, and you want to make the other assemblies parts of your module. This is especially useful if you can't define a module class in the target assembly or you don't want to depend on that module's dependencies.
+
+In that case, you can use the `AdditionalAssembly` attribute as shown below:
+
+```csharp
+[DependsOn(...)] // Your module dependencies as you normally would do
+[AdditionalAssembly(typeof(IdentityServiceModule))] // A type in the target assembly (in another assembly)
+public class IdentityServiceTestModule : AbpModule
+{
+ ...
+}
+```
+
+With the `AdditionalAssembly` attribute definition, ABP loads the assembly containing the `IdentityServiceModule` class as a part of the identity service module. Notice that in this case, none of the module dependencies of the `IdentityServiceModule` are loaded. Because we are not depending on the `IdentityServiceModule`, instead we are just adding its assembly as a part of the `IdentityServiceTestModule`.
+
+> You can check the [Module Development Basics](https://docs.abp.io/en/abp/7.4/Module-Development-Basics) documentation to learn more.
+
+### `CorrelationId` Support on Distributed Events
+
+In this version, `CorrelationId` (a unique key that is used in distributed applications to trace requests across multiple services/operations) is attached to the distributed events, so you can relate events with HTTP requests and can trace all the related activities.
+
+ABP Framework generates a `correlationId` for the first time when an operation is started and then attaches the current `correlationId` to distributed events as an additional property. For example, if you are using the [transactional outbox or inbox pattern provided by ABP Framework](https://docs.abp.io/en/abp/latest/Distributed-Event-Bus#outbox-inbox-for-transactional-events), you can see the `correlationId` in the extra properties of the `IncomingEventInfo` or `OutgoingEventInfo` classes with the standard `X-Correlation-Id` key.
+
+> You can check [this issue](https://github.com/abpframework/abp/issues/16773) for more information.
+
+### Database Migration System for EF Core
+
+In this version, ABP Framework provides base classes and events to migrate the database schema and seed the database on application startup. This system works compatibly with multi-tenancy and whenever a new tenant is created or a tenant's database connection string has been updated, it checks and applies database migrations for the new tenant state.
+
+This system is especially useful to migrate databases for microservices. In this way, when you deploy a new version of a microservice, you don't need to manually migrate its database.
+
+You need to take the following actions to use the database migration system:
+
+* Create a class that derives from `EfCoreRuntimeDatabaseMigratorBase` class, override and implement its `SeedAsync` method. And lastly, execute the `CheckAndApplyDatabaseMigrationsAsync` method of your class in the `OnPostApplicationInitializationAsync` method of your module class.
+* Create a class that derives from `DatabaseMigrationEventHandlerBase` class, override and implement its `SeedAsync` method. Then, whenever a new tenant is created or a tenant's connection string is changed then the `SeedAsync` method will be executed.
+
+### Other News
+
+* [OpenIddict](https://github.com/openiddict/openiddict-core/tree/4.7.0) library has been upgraded to **v4.7.0**. See [#17334](https://github.com/abpframework/abp/pull/17334) for more info.
+* ABP v7.4 introduces the `Volo.Abp.Maui.Client` package, which is used by the MAUI mobile application in ABP Commercial. See [#17201](https://github.com/abpframework/abp/pull/17201) for more info.
+* In this version, the `AbpAspNetCoreIntegratedTestBase` class gets a generic type parameter, which expects either a startup class or an ABP module class. This allows us to use configurations from an ABP module or old-style ASP.NET Core Startup class in a test application class and this simplifies the test application project. See [#17039](https://github.com/abpframework/abp/pull/17039) for more info.
+
+## What's New with ABP Commercial 7.4?
+
+We've also worked on [ABP Commercial](https://commercial.abp.io/) to align the features and changes made in the ABP Framework. The following sections introduce new features coming with ABP Commercial 7.4.
+
+### Dynamic Text Template Store
+
+Prior to this version, it was hard to create text templates in different microservices and centrally manage them in a single admin application. For example, if you would define a text template in your ordering microservice, then those text templates could not be seen on the administration microservice because the administration microservice would not have any knowledge about that text template (because it's hard-coded in the ordering microservice).
+
+For this reason, in this version, the Dynamic Text Template Store has been introduced to make the [Text Template Management module](https://docs.abp.io/en/commercial/latest/modules/text-template-management) compatible with microservices and distributed systems. It allows you to store and get all text templates from a single point. Thanks to that, you can centrally manage the text templates in your admin application.
+
+> *Note*: If you are upgrading from an earlier version and are using the Text Template Management module, you need to create a new migration and apply it to your database.
+
+To enable the dynamic template store, you just need to configure the `TextTemplateManagementOptions` and set the `IsDynamicTemplateStoreEnabled` as true in your module class:
+
+```csharp
+Configure(options =>
+{
+ options.IsDynamicTemplateStoreEnabled = true;
+});
+```
+
+Notice this is only needed in the microservice where you centrally manage your text template contents. So, typically you would use the configuration above in your administration microservice. Other microservices automatically save their text template contents to the central database.
+
+### Suite: Custom Code Support
+
+In this version, we have implemented the custom code support in Suite. This allows you to customize the generated code-blocks and preserve your custom code changes in the next CRUD Page Generation in Suite. ABP Suite specifies hook-points to allow adding custom code blocks. Then, the code that you wrote to these hook points will be respected and will not be overridden in the next entity generation.
+
+
+
+To enable custom code support, you should check the *Customizable code* option in the crud page generation page. When you enable the custom code support, you will be seeing some hook-points in your application.
+
+For example, on the C# side, you'll be seeing some abstract classes and classes that derive from them (for entities, application services, interfaces, domain services, and so on...). You can write your custom code in those classes (`*.Extended.cs`) and the next time when you need to re-generate the entity, your custom code will not be overridden (only the base abstract classes will be re-generated and your changes on Suite will be respected):
+
+Folder structure | Book.Extended.cs
+:-------------------------:|:-------------------------:
+ | 
+
+> *Note*: If you want to override the entity and add custom code, please do not touch the code between `...` placeholders, because the constructor of the entity should be always re-generated in case of a new property added.
+
+On the UI side, you can see the *comment placeholders* on the pages for MVC & Blazor applications. These are hook-points provided by ABP Suite and you can write your custom code between these comment sections:
+
+Folder structure | Books/Index.cshtml
+:-------------------------:|:-------------------------:
+ | 
+
+### MAUI & React Native UI Revisions
+
+In this version, we have revised MAUI & React Native mobile applications and added new pages, functionalities and made improvements on the UI side.
+
+
+
+For example, in the MAUI application, we have implemented the following functionalities and changed the UI completely:
+
+* **User Management Page**: Management page for your application users. You can search, add, update, or delete users of your application.
+* **Tenants**: Management page for your tenants.
+* **Settings**: Management page for your application settings. On this page, you can change **the current language**, **the profile picture**, **the current password**, or/and **the current theme**.
+
+Also, we have aligned the features on both of these mobile options (MAUI & React Native) and showed them in the ["ABP Community Talks 2023.5: Exploring the Options for Mobile Development with the ABP Framework"](https://community.abp.io/events/mobile-development-with-the-abp-framework-ogtwaz5l).
+
+> If you have missed the event, you can watch from 👉 [here](https://www.youtube.com/watch?v=-wrdngeKgZw).
+
+### New LeptonX Theme Features
+
+In the new version of LeptonX Theme, which is v2.4.0-rc.1, there are some new features that we want to mention.
+
+#### Mobile Toolbars
+
+The [Toolbar System](https://docs.abp.io/en/abp/latest/UI/AspNetCore/Toolbars) is used to define *toolbars* on the user interface. Modules (or your application) can add items to a toolbar, then the UI themes can render the toolbar on the layout.
+
+LeptonX Theme extends this system even further and introduces mobile toolbars with this version. You can create a component and add it as a mobile toolbar as below:
+
+```csharp
+public class MyToolbarContributor : IToolbarContributor
+{
+ public Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
+ {
+ if (context.Toolbar.Name == LeptonXToolbars.MainMobile)
+ {
+ context.Toolbar.Items.Add(new ToolbarItem(typeof(ShoppingCardToolbarComponent)));
+
+ //other mobile toolbars...
+ }
+
+ return Task.CompletedTask;
+ }
+}
+```
+
+Then, the LeptonX Theme will render these mobile toolbars like in the figure below:
+
+
+
+> **Note**: The Angular UI hasn't been completed yet. We aim to complete it as soon as possible and include it in the next release.
+
+#### New Error Page Designs
+
+In this version, we have implemented new error pages. Encounter a fresh look during error situations with the 'New Error Page Designs,' providing informative and visually appealing error displays that enhance user experience:
+
+
+
+#### Fluid Layout
+
+In this version, LeptonX Theme introduces the fresh-looking **Fluid Layout**, which is a layout that lets you align elements so that they automatically adjust their alignment and proportions for different page sizes and orientations.
+
+
+
+> You can visit [the live demo of LeptonX Theme](https://x.leptontheme.com/side-menu) and try the Fluid Layout now!
+
+### Check & Move Related Entities on Deletion/Demand
+
+In application modules, there are some entities that have complete relationships with each other such as role-user relations. In such cases, it's a typical requirement to check & move related entities that have a relation with the other entity that is about to be deleted.
+
+For example, if you need to delete an edition from your system, you would typically want to move the tenant that is associated with that edition. For this purpose, in this version, ABP Commercial allows you to move related entities on deletion/demand.
+
+
+
+Currently, this feature is implemented for SaaS and Identity Pro modules and for the following relations:
+
+* Edition - Tenant
+* Role - User
+* Organization Unit - User
+
+Also, it's possible to move the related associated-records before deleting the record. For example, you can move all tenants from an edition as shown in the figure below:
+
+"Move all tenants" action | "Move all tenants" modal
+:-------------------------:|:-------------------------:
+ | 
+
+### CMS Kit Pro: Page Feedback
+
+In this version, the **Page Feedback** feature has been added to the [CMS Kit Pro](https://docs.abp.io/en/commercial/latest/modules/cms-kit/index) module. This feature allows you to get feedback from a page in your application.
+
+This is especially useful if you have content that needs feedback from users. For example, if you have documentation or a blog website, it's a common requirement to assess the quality of the articles and get feedback from users. In that case, you can use this feature:
+
+
+
+### Chat Module: Deleting Messages & Conversations
+
+In this version, the [Chat Module](https://docs.abp.io/en/commercial/latest/modules/chat) allows you to delete individual messages or a complete conversation.
+
+You can enable or disable the message/conversation deletion globally on your application:
+
+
+
+> **Note**: The Angular UI hasn't been completed yet. We aim to complete it as soon as possible and include it in the next release.
+
+### Password Complexity Indicators
+
+In this version, ABP Framework introduces an innovative ["Password Complexity Indicator"](https://docs.abp.io/en/commercial/7.4/ui/angular/password-complexity-indicator-component) feature, designed to enhance security and user experience. This feature dynamically evaluates and rates the strength of user-generated passwords, providing real-time feedback to users as they create or update their passwords. By visually indicating the complexity level, users are guided toward crafting stronger passwords that meet modern security standards.
+
+
+
+You can check the [Password Complexity Indicator Angular documentation](https://docs.abp.io/en/commercial/7.4/ui/angular/password-complexity-indicator-component) to learn more.
+
+> **Note**: Currently, this feature is only available for the Angular UI, but we will be implemented for other UIs in the next version.
+
+## Community News
+
+### DevNot Developer Summit 2023
+
+
+
+We are thrilled to announce that the co-founder of [Volosoft](https://volosoft.com/) and Lead Developer of the ABP Framework, Halil Ibrahim Kalkan will give a speech about "Building a Kubernetes Integrated Local Development Environment" in the [Developer Summit 2023 event](https://summit.devnot.com/) on the 7th of October.
+
+### New ABP Community Posts
+
+There are exciting articles contributed by the ABP community as always. I will highlight some of them here:
+
+* [ABP Commercial - GDPR Module Overview](https://community.abp.io/posts/abp-commercial-gdpr-module-overview-kvmsm3ku) by [Engincan Veske](https://twitter.com/EngincanVeske)
+* [Video: ABP Framework Data Transfer Objects](https://community.abp.io/videos/abp-framework-data-transfer-objects-qwebfqz5) by [Hamza Albreem](https://github.com/braim23)
+* [Video: ABP Framework Essentials: MongoDB](https://community.abp.io/videos/abp-framework-essentials-mongodb-gwlblh5x) by [Hamza Albreem](https://github.com/braim23)
+* [ABP Modules and Entity Dependencies](https://community.abp.io/posts/abp-modules-and-entity-dependencies-hn7wr093) by [Jack Fistelmann](https://github.com/nebula2)
+* [How to add dark mode support to the Basic Theme in 3 steps?](https://community.abp.io/posts/how-to-add-dark-mode-support-to-the-basic-theme-in-3-steps-ge9c0f85) by [Enis Necipoğlu](https://twitter.com/EnisNecipoglu)
+* [Deploying docker image to Azure with yml and bicep through Github Actions](https://community.abp.io/posts/deploying-docker-image-to-azure-with-yml-and-bicep-through-github-actions-cjiuh55m) by [Sturla](https://community.abp.io/members/Sturla)
+
+Thanks to the ABP Community for all the content they have published. You can also [post your ABP-related (text or video) content](https://community.abp.io/articles/submit) to the ABP Community.
+
+## Conclusion
+
+This version comes with some new features and a lot of enhancements to the existing features. You can see the [Road Map](https://docs.abp.io/en/abp/7.4/Road-Map) documentation to learn about the release schedule and planned features for the next releases. Please try ABP v7.4 RC and provide feedback to help us release a more stable version.
+
+Thanks for being a part of this community!
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/book-extended-cs.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/book-extended-cs.png
new file mode 100644
index 0000000000..1179118621
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/book-extended-cs.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/book-extended-cshtml.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/book-extended-cshtml.png
new file mode 100644
index 0000000000..0ed90a33de
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/book-extended-cshtml.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/cover-image.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/cover-image.png
new file mode 100644
index 0000000000..06ced79397
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/cover-image.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/developersummit.jpg b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/developersummit.jpg
new file mode 100644
index 0000000000..65bae90315
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/developersummit.jpg differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/editions.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/editions.png
new file mode 100644
index 0000000000..331706daa7
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/editions.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/error-page.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/error-page.png
new file mode 100644
index 0000000000..8ece260ec3
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/error-page.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/fluid-layout.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/fluid-layout.png
new file mode 100644
index 0000000000..6150f3e2bd
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/fluid-layout.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/maui.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/maui.png
new file mode 100644
index 0000000000..4205001d80
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/maui.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/mobile-toolbars.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/mobile-toolbars.png
new file mode 100644
index 0000000000..6dcde5da60
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/mobile-toolbars.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/move-all-tenants.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/move-all-tenants.png
new file mode 100644
index 0000000000..b893360447
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/move-all-tenants.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/move-tenants.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/move-tenants.png
new file mode 100644
index 0000000000..fb6b8364fb
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/move-tenants.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/page-feedback.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/page-feedback.png
new file mode 100644
index 0000000000..dbdd9fe199
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/page-feedback.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/password-complexity.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/password-complexity.png
new file mode 100644
index 0000000000..55bc8a8f43
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/password-complexity.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/settings.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/settings.png
new file mode 100644
index 0000000000..1e835661a0
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/settings.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/suite-custom-code-backend.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/suite-custom-code-backend.png
new file mode 100644
index 0000000000..cb14dfc0f1
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/suite-custom-code-backend.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/suite-custom-code-ui.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/suite-custom-code-ui.png
new file mode 100644
index 0000000000..132988a873
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/suite-custom-code-ui.png differ
diff --git a/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/suite-custom-code.png b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/suite-custom-code.png
new file mode 100644
index 0000000000..2e510d0768
Binary files /dev/null and b/docs/en/Blog-Posts/2023-08-15 v7_4_Preview/suite-custom-code.png differ
diff --git a/docs/en/Emailing.md b/docs/en/Emailing.md
index bfb3058862..fd9e696b3e 100644
--- a/docs/en/Emailing.md
+++ b/docs/en/Emailing.md
@@ -58,7 +58,12 @@ namespace MyProject
`SendAsync` method has overloads to supply more parameters like;
* **from**: You can set this as the first argument to set a sender email address. If not provided, the default sender address is used (see the email settings below).
+* **to**: You can set the target email address.
+* **subject**: You can set the email subject.
+* **body**: You can set the email body.
* **isBodyHtml**: Indicates whether the email body may contain HTML tags. **Default: true**.
+* **attachments**: You can pass a list of `EmailAttachment` to add attachments to the email.
+* **extraProperties**: You can pass extra properties and use these properties in your own `IEmailSender` implementation to implement more mail sending features.
> `IEmailSender` is the suggested way to send emails, since it makes your code provider independent.
diff --git a/docs/en/Entity-Framework-Core.md b/docs/en/Entity-Framework-Core.md
index e2cfd21a05..1f8b9e22f0 100644
--- a/docs/en/Entity-Framework-Core.md
+++ b/docs/en/Entity-Framework-Core.md
@@ -594,6 +594,14 @@ Whenever you access to a property/collection, EF Core automatically performs an
See also [lazy loading document](https://docs.microsoft.com/en-us/ef/core/querying/related-data/lazy) of the EF Core.
+## Read-Only Repositories
+
+ABP Framework provides read-only [repository](Repositories.md) interfaces (`IReadOnlyRepository<...>` or `IReadOnlyBasicRepository<...>`) to explicitly indicate that your purpose is to query data, but not change it. If so, you can inject these interfaces into your services.
+
+Entity Framework Core read-only repository implementation uses [EF Core's No-Tracking feature](https://learn.microsoft.com/en-us/ef/core/querying/tracking#no-tracking-queries). That means the entities returned from the repository will not be tracked by the EF Core [change tracker](https://learn.microsoft.com/en-us/ef/core/change-tracking/), because it is expected that you won't update entities queried from a read-only repository.
+
+> This behavior works only if the repository object is injected with one of the read-only repository interfaces (`IReadOnlyRepository<...>` or `IReadOnlyBasicRepository<...>`). It won't work if you have injected a standard repository (e.g. `IRepository<...>`) then casted it to a read-only repository interface.
+
## Access to the EF Core API
In most cases, you want to hide EF Core APIs behind a repository (this is the main purpose of the repository pattern). However, if you want to access the `DbContext` instance over the repository, you can use `GetDbContext()` or `GetDbSet()` extension methods. Example:
diff --git a/docs/en/Object-To-Object-Mapping.md b/docs/en/Object-To-Object-Mapping.md
index c12b260921..40efdd7ee6 100644
--- a/docs/en/Object-To-Object-Mapping.md
+++ b/docs/en/Object-To-Object-Mapping.md
@@ -320,9 +320,22 @@ public class MyCustomUserMapper : IObjectMapper, ITransientDepend
}
````
-ABP automatically discovers and registers the `MyCustomUserMapper` and it is automatically used whenever you use the `IObjectMapper` to map `User` to `UserDto`.
-
-A single class may implement more than one `IObjectMapper` each for a different object pairs.
+ABP automatically discovers and registers the `MyCustomUserMapper` and it is automatically used whenever you use the `IObjectMapper` to map `User` to `UserDto`. A single class may implement more than one `IObjectMapper` each for a different object pairs.
> This approach is powerful since `MyCustomUserMapper` can inject any other service and use in the `Map` methods.
+Once you implement `IObjectMapper`, ABP can automatically convert a collection of `User` objects to a collection of `UserDto` objects. The following generic collection types are supported:
+
+* `IEnumerable`
+* `ICollection`
+* `Collection`
+* `IList`
+* `List`
+* `T[]` (array)
+
+**Example:**
+
+````csharp
+var users = await _userRepository.GetListAsync(); // returns List
+var dtos = ObjectMapper.Map, List>(users); // creates List
+````
diff --git a/docs/en/Repositories.md b/docs/en/Repositories.md
index 95f908d004..a93460bbdd 100644
--- a/docs/en/Repositories.md
+++ b/docs/en/Repositories.md
@@ -205,8 +205,6 @@ Methods:
- `WithDetails()` 1 overload
- `WithDetailsAsync()` 1 overload
-
-
Where as the `IReadOnlyBasicRepository` provides the following methods:
- `GetCountAsync()`
@@ -217,6 +215,12 @@ They can all be seen as below:

+#### Read Only Repositories behavior in Entity Framework Core
+
+Entity Framework Core read-only repository implementation uses [EF Core's No-Tracking feature](https://learn.microsoft.com/en-us/ef/core/querying/tracking#no-tracking-queries). That means the entities returned from the repository will not be tracked by the EF Core [change tracker](https://learn.microsoft.com/en-us/ef/core/change-tracking/), because it is expected that you won't update entities queried from a read-only repository. If you need to track the entities, you can still uses [AsTracking()](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.entityframeworkqueryableextensions.astracking) extension method.
+
+> This behavior works only if the repository object is injected with one of the read-only repository interfaces (`IReadOnlyRepository<...>` or `IReadOnlyBasicRepository<...>`). It won't work if you have injected a standard repository (e.g. `IRepository<...>`) then casted it to a read-only repository interface.
+
### Generic Repository without a Primary Key
If your entity does not have an Id primary key (it may have a composite primary key for instance) then you cannot use the `IRepository` (or basic/readonly versions) defined above. In that case, you can inject and use `IRepository` for your entity.
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/Metadata/AbpModelMetadataProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/Metadata/AbpModelMetadataProvider.cs
index 8d5f2d4c4a..1301a5e823 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/Metadata/AbpModelMetadataProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/Metadata/AbpModelMetadataProvider.cs
@@ -40,11 +40,11 @@ public class AbpModelMetadataProvider : DefaultModelMetadataProvider
{
foreach (var validationAttribute in detail.ModelAttributes.Attributes.OfType())
{
- NormalizeValidationAttrbute(validationAttribute);
+ NormalizeValidationAttribute(validationAttribute);
}
}
- protected virtual void NormalizeValidationAttrbute(ValidationAttribute validationAttribute)
+ protected virtual void NormalizeValidationAttribute(ValidationAttribute validationAttribute)
{
if (validationAttribute.ErrorMessage == null)
{
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs
index 505c07a3e1..cd87c55ea4 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs
@@ -1,14 +1,15 @@
-using System.ComponentModel.DataAnnotations;
+using System;
+using System.ComponentModel.DataAnnotations;
using System.Reflection;
namespace Volo.Abp.AspNetCore.Mvc.Validation;
public static class ValidationAttributeHelper
{
- private static readonly PropertyInfo ValidationAttributeErrorMessageStringProperty = typeof(ValidationAttribute)
+ private readonly static PropertyInfo ValidationAttributeErrorMessageStringProperty = typeof(ValidationAttribute)
.GetProperty("ErrorMessageString", BindingFlags.Instance | BindingFlags.NonPublic)!;
- private static readonly PropertyInfo ValidationAttributeCustomErrorMessageSetProperty = typeof(ValidationAttribute)
+ private readonly static PropertyInfo ValidationAttributeCustomErrorMessageSetProperty = typeof(ValidationAttribute)
.GetProperty("CustomErrorMessageSet", BindingFlags.Instance | BindingFlags.NonPublic)!;
public static void SetDefaultErrorMessage(ValidationAttribute validationAttribute)
@@ -24,7 +25,14 @@ public static class ValidationAttributeHelper
}
}
- validationAttribute.ErrorMessage =
- ValidationAttributeErrorMessageStringProperty.GetValue(validationAttribute) as string;
+ try
+ {
+ var errorMessageString = ValidationAttributeErrorMessageStringProperty.GetValue(validationAttribute) as string;
+ validationAttribute.ErrorMessage = errorMessageString;
+ }
+ catch (Exception e)
+ {
+ // ignored
+ }
}
}
diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpRepositoryIsReadOnlyException.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpRepositoryIsReadOnlyException.cs
new file mode 100644
index 0000000000..6c648fd022
--- /dev/null
+++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpRepositoryIsReadOnlyException.cs
@@ -0,0 +1,22 @@
+namespace Volo.Abp.Data;
+
+public class AbpRepositoryIsReadOnlyException : AbpException
+{
+ ///
+ /// Creates a new object.
+ ///
+ public AbpRepositoryIsReadOnlyException()
+ {
+
+ }
+
+ ///
+ /// Creates a new object.
+ ///
+ /// Exception message
+ public AbpRepositoryIsReadOnlyException(string message)
+ : base(message)
+ {
+
+ }
+}
diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs
index 8602792701..3791c4202f 100644
--- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs
+++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs
@@ -132,7 +132,7 @@ public abstract class AbstractKeyReadOnlyAppService ((IHasCreationTime)e).CreationTime);
}
- throw new AbpException("No sorting specified but this query requires sorting. Override the ApplyDefaultSorting method for your application service derived from AbstractKeyReadOnlyAppService!");
+ throw new AbpException("No sorting specified but this query requires sorting. Override the ApplySorting or the ApplyDefaultSorting method for your application service derived from AbstractKeyReadOnlyAppService!");
}
///
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs
index c63a5442c7..0a2fa66b77 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs
@@ -1,5 +1,6 @@
using System;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
@@ -17,13 +18,13 @@ public static class ServiceCollectionRepositoryExtensions
var readOnlyBasicRepositoryInterface = typeof(IReadOnlyBasicRepository<>).MakeGenericType(entityType);
if (readOnlyBasicRepositoryInterface.IsAssignableFrom(repositoryImplementationType))
{
- RegisterService(services, readOnlyBasicRepositoryInterface, repositoryImplementationType, replaceExisting);
+ RegisterService(services, readOnlyBasicRepositoryInterface, repositoryImplementationType, replaceExisting, true);
//IReadOnlyRepository
var readOnlyRepositoryInterface = typeof(IReadOnlyRepository<>).MakeGenericType(entityType);
if (readOnlyRepositoryInterface.IsAssignableFrom(repositoryImplementationType))
{
- RegisterService(services, readOnlyRepositoryInterface, repositoryImplementationType, replaceExisting);
+ RegisterService(services, readOnlyRepositoryInterface, repositoryImplementationType, replaceExisting, true);
}
//IBasicRepository
@@ -48,13 +49,13 @@ public static class ServiceCollectionRepositoryExtensions
var readOnlyBasicRepositoryInterfaceWithPk = typeof(IReadOnlyBasicRepository<,>).MakeGenericType(entityType, primaryKeyType);
if (readOnlyBasicRepositoryInterfaceWithPk.IsAssignableFrom(repositoryImplementationType))
{
- RegisterService(services, readOnlyBasicRepositoryInterfaceWithPk, repositoryImplementationType, replaceExisting);
+ RegisterService(services, readOnlyBasicRepositoryInterfaceWithPk, repositoryImplementationType, replaceExisting, true);
//IReadOnlyRepository
var readOnlyRepositoryInterfaceWithPk = typeof(IReadOnlyRepository<,>).MakeGenericType(entityType, primaryKeyType);
if (readOnlyRepositoryInterfaceWithPk.IsAssignableFrom(repositoryImplementationType))
{
- RegisterService(services, readOnlyRepositoryInterfaceWithPk, repositoryImplementationType, replaceExisting);
+ RegisterService(services, readOnlyRepositoryInterfaceWithPk, repositoryImplementationType, replaceExisting, true);
}
//IBasicRepository
@@ -80,15 +81,33 @@ public static class ServiceCollectionRepositoryExtensions
IServiceCollection services,
Type serviceType,
Type implementationType,
- bool replaceExisting)
+ bool replaceExisting,
+ bool isReadOnlyRepository = false)
{
+ ServiceDescriptor descriptor;
+
+ if (isReadOnlyRepository)
+ {
+ services.TryAddTransient(implementationType);
+ descriptor = ServiceDescriptor.Transient(serviceType, provider =>
+ {
+ var repository = provider.GetRequiredService(implementationType);
+ ObjectHelper.TrySetProperty(repository.As(), x => x.IsReadOnly, _ => true);
+ return repository;
+ });
+ }
+ else
+ {
+ descriptor = ServiceDescriptor.Transient(serviceType, implementationType);
+ }
+
if (replaceExisting)
{
- services.Replace(ServiceDescriptor.Transient(serviceType, implementationType));
+ services.Replace(descriptor);
}
else
{
- services.TryAddTransient(serviceType, implementationType);
+ services.TryAdd(descriptor);
}
}
}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs
index 0d86045eea..6de2aa3208 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs
@@ -34,6 +34,8 @@ public abstract class BasicRepositoryBase :
public ICancellationTokenProvider CancellationTokenProvider => LazyServiceProvider.LazyGetService(NullCancellationTokenProvider.Instance);
+ public bool IsReadOnly { get; protected set; }
+
protected BasicRepositoryBase()
{
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
index 3c7ae81875..d50a881c28 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
@@ -12,7 +12,7 @@ namespace Volo.Abp.Domain.Repositories;
///
public interface IRepository
{
-
+ bool IsReadOnly { get; }
}
public interface IRepository : IReadOnlyRepository, IBasicRepository
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs
index 07b4ca9bcd..f1d2812ae9 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs
@@ -15,15 +15,15 @@ public class BackgroundEmailSendingJob : AsyncBackgroundJob
public bool IsBodyHtml { get; set; } = true;
- //TODO: Add other properties and attachments
+ public List? Attachments { get; set; }
+
+ public ExtraPropertyDictionary? ExtraProperties { get; set; }
}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailAttachment.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailAttachment.cs
new file mode 100644
index 0000000000..e2fe3a3a6b
--- /dev/null
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailAttachment.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Volo.Abp.Emailing;
+
+[Serializable]
+public class EmailAttachment
+{
+ public string? Name { get; set; }
+
+ public byte[]? File { get; set; }
+}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs
index d8a46ca4b9..8de9f4c5a1 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs
@@ -1,8 +1,12 @@
using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.BackgroundJobs;
+using Volo.Abp.Data;
namespace Volo.Abp.Emailing;
@@ -24,20 +28,33 @@ public abstract class EmailSenderBase : IEmailSender
BackgroundJobManager = backgroundJobManager;
}
- public virtual async Task SendAsync(string to, string? subject, string? body, bool isBodyHtml = true)
+ public virtual async Task SendAsync(string to, string? subject, string? body, bool isBodyHtml = true, List? attachments = null, ExtraPropertyDictionary? extraProperties = null)
{
- await SendAsync(new MailMessage
- {
- To = { to },
- Subject = subject,
- Body = body,
- IsBodyHtml = isBodyHtml
- });
+ await SendAsync(BuildMailMessage(null, to, subject, body, isBodyHtml, attachments, extraProperties));
}
- public virtual async Task SendAsync(string from, string to, string? subject, string? body, bool isBodyHtml = true)
+ public virtual async Task SendAsync(string from, string to, string? subject, string? body, bool isBodyHtml = true, List? attachments = null, ExtraPropertyDictionary? extraProperties = null)
{
- await SendAsync(new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml });
+ await SendAsync(BuildMailMessage(from, to, subject, body, isBodyHtml, attachments, extraProperties));
+ }
+
+ protected virtual MailMessage BuildMailMessage(string? from, string to, string? subject, string? body, bool isBodyHtml = true, List? attachments = null, ExtraPropertyDictionary? extraProperties = null)
+ {
+ var message = from == null
+ ? new MailMessage { To = { to }, Subject = subject, Body = body, IsBodyHtml = isBodyHtml }
+ : new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml };
+
+ if (attachments != null)
+ {
+ foreach (var attachment in attachments.Where(x => x.File != null))
+ {
+ var fileStream = new MemoryStream(attachment.File!);
+ fileStream.Seek(0, SeekOrigin.Begin);
+ message.Attachments.Add(new Attachment(fileStream, attachment.Name));
+ }
+ }
+
+ return message;
}
public virtual async Task SendAsync(MailMessage mail, bool normalize = true)
@@ -50,11 +67,11 @@ public abstract class EmailSenderBase : IEmailSender
await SendEmailAsync(mail);
}
- public virtual async Task QueueAsync(string to, string subject, string body, bool isBodyHtml = true)
+ public virtual async Task QueueAsync(string to, string subject, string body, bool isBodyHtml = true, List? attachments = null, ExtraPropertyDictionary? extraProperties = null)
{
if (!BackgroundJobManager.IsAvailable())
{
- await SendAsync(to, subject, body, isBodyHtml);
+ await SendAsync(to, subject, body, isBodyHtml, attachments, extraProperties);
return;
}
@@ -64,16 +81,18 @@ public abstract class EmailSenderBase : IEmailSender
To = to,
Subject = subject,
Body = body,
- IsBodyHtml = isBodyHtml
+ IsBodyHtml = isBodyHtml,
+ Attachments = attachments,
+ ExtraProperties = extraProperties
}
);
}
- public virtual async Task QueueAsync(string from, string to, string subject, string body, bool isBodyHtml = true)
+ public virtual async Task QueueAsync(string from, string to, string subject, string body, bool isBodyHtml = true, List? attachments = null, ExtraPropertyDictionary? extraProperties = null)
{
if (!BackgroundJobManager.IsAvailable())
{
- await SendAsync(from, to, subject, body, isBodyHtml);
+ await SendAsync(from, to, subject, body, isBodyHtml, attachments, extraProperties);
return;
}
@@ -84,7 +103,9 @@ public abstract class EmailSenderBase : IEmailSender
To = to,
Subject = subject,
Body = body,
- IsBodyHtml = isBodyHtml
+ IsBodyHtml = isBodyHtml,
+ Attachments = attachments,
+ ExtraProperties = extraProperties
}
);
}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs
index 55456783c4..d2952c2d47 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs
@@ -1,5 +1,7 @@
-using System.Net.Mail;
+using System.Collections.Generic;
+using System.Net.Mail;
using System.Threading.Tasks;
+using Volo.Abp.Data;
namespace Volo.Abp.Emailing;
@@ -15,7 +17,9 @@ public interface IEmailSender
string to,
string? subject,
string? body,
- bool isBodyHtml = true
+ bool isBodyHtml = true,
+ List? attachments = null,
+ ExtraPropertyDictionary? extraProperties = null
);
///
@@ -26,7 +30,9 @@ public interface IEmailSender
string to,
string? subject,
string? body,
- bool isBodyHtml = true
+ bool isBodyHtml = true,
+ List? attachments = null,
+ ExtraPropertyDictionary? extraProperties = null
);
///
@@ -49,7 +55,9 @@ public interface IEmailSender
string to,
string subject,
string body,
- bool isBodyHtml = true
+ bool isBodyHtml = true,
+ List? attachments = null,
+ ExtraPropertyDictionary? extraProperties = null
);
///
@@ -60,8 +68,8 @@ public interface IEmailSender
string to,
string subject,
string body,
- bool isBodyHtml = true
+ bool isBodyHtml = true,
+ List? attachments = null,
+ ExtraPropertyDictionary? extraProperties = null
);
-
- //TODO: Add other Queue methods too. Problem: MailMessage is not serializable so can not be used in background jobs.
}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs
index 99a8f2e1e7..4bf7e18158 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs
@@ -67,7 +67,7 @@ public class SmtpEmailSender : EmailSenderBase, ISmtpEmailSender, ITransientDepe
}
}
- protected override async Task SendEmailAsync(MailMessage mail)
+ protected async override Task SendEmailAsync(MailMessage mail)
{
using (var smtpClient = await BuildClientAsync())
{
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EfCoreRepositoryExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EfCoreRepositoryExtensions.cs
index 94dba628d7..614ba135ff 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EfCoreRepositoryExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EfCoreRepositoryExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Entities;
@@ -44,4 +45,10 @@ public static class EfCoreRepositoryExtensions
throw new ArgumentException("Given repository does not implement " + typeof(IEfCoreRepository).AssemblyQualifiedName, nameof(repository));
}
+
+ public static IQueryable AsNoTrackingIf(this IQueryable queryable, bool condition)
+ where TEntity : class, IEntity
+ {
+ return condition ? queryable.AsNoTracking() : queryable;
+ }
}
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
index 96d7b4111e..b881c07245 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
@@ -1,4 +1,3 @@
-using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@@ -6,16 +5,15 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
-using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Storage;
+using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.DependencyInjection;
using Volo.Abp.Guids;
-using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore;
@@ -75,7 +73,7 @@ public class EfCoreRepository : RepositoryBase, IE
{
return (await GetDbContextAsync()).Set();
}
-
+
protected async Task GetDbConnectionAsync()
{
return (await GetDbContextAsync()).Database.GetDbConnection();
@@ -107,8 +105,9 @@ public class EfCoreRepository : RepositoryBase, IE
);
}
- public override async Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
+ public async override Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
CheckAndSetId(entity);
var dbContext = await GetDbContextAsync();
@@ -123,8 +122,9 @@ public class EfCoreRepository : RepositoryBase, IE
return savedEntity;
}
- public override async Task InsertManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default)
+ public async override Task InsertManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
var entityArray = entities.ToArray();
var dbContext = await GetDbContextAsync();
cancellationToken = GetCancellationToken(cancellationToken);
@@ -153,8 +153,9 @@ public class EfCoreRepository : RepositoryBase, IE
}
}
- public override async Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
+ public async override Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
var dbContext = await GetDbContextAsync();
dbContext.Attach(entity);
@@ -169,8 +170,9 @@ public class EfCoreRepository : RepositoryBase, IE
return updatedEntity;
}
- public override async Task UpdateManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default)
+ public async override Task UpdateManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
cancellationToken = GetCancellationToken(cancellationToken);
if (BulkOperationProvider != null)
@@ -195,8 +197,9 @@ public class EfCoreRepository : RepositoryBase, IE
}
}
- public override async Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
+ public async override Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
var dbContext = await GetDbContextAsync();
dbContext.Set().Remove(entity);
@@ -207,8 +210,9 @@ public class EfCoreRepository : RepositoryBase, IE
}
}
- public override async Task DeleteManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default)
+ public async override Task DeleteManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
cancellationToken = GetCancellationToken(cancellationToken);
if (BulkOperationProvider != null)
@@ -233,26 +237,26 @@ public class EfCoreRepository : RepositoryBase, IE
}
}
- public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
+ public async override Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
return includeDetails
? await (await WithDetailsAsync()).ToListAsync(GetCancellationToken(cancellationToken))
- : await (await GetDbSetAsync()).ToListAsync(GetCancellationToken(cancellationToken));
+ : await (await GetQueryableAsync()).ToListAsync(GetCancellationToken(cancellationToken));
}
- public override async Task> GetListAsync(Expression> predicate, bool includeDetails = false, CancellationToken cancellationToken = default)
+ public async override Task> GetListAsync(Expression> predicate, bool includeDetails = false, CancellationToken cancellationToken = default)
{
return includeDetails
? await (await WithDetailsAsync()).Where(predicate).ToListAsync(GetCancellationToken(cancellationToken))
- : await (await GetDbSetAsync()).Where(predicate).ToListAsync(GetCancellationToken(cancellationToken));
+ : await (await GetQueryableAsync()).Where(predicate).ToListAsync(GetCancellationToken(cancellationToken));
}
- public override async Task GetCountAsync(CancellationToken cancellationToken = default)
+ public async override Task GetCountAsync(CancellationToken cancellationToken = default)
{
- return await (await GetDbSetAsync()).LongCountAsync(GetCancellationToken(cancellationToken));
+ return await (await GetQueryableAsync()).LongCountAsync(GetCancellationToken(cancellationToken));
}
- public override async Task> GetPagedListAsync(
+ public async override Task> GetPagedListAsync(
int skipCount,
int maxResultCount,
string sorting,
@@ -261,7 +265,7 @@ public class EfCoreRepository : RepositoryBase, IE
{
var queryable = includeDetails
? await WithDetailsAsync()
- : await GetDbSetAsync();
+ : await GetQueryableAsync();
return await queryable
.OrderByIf>(!sorting.IsNullOrWhiteSpace(), sorting)
@@ -272,20 +276,20 @@ public class EfCoreRepository : RepositoryBase, IE
[Obsolete("Use GetQueryableAsync method.")]
protected override IQueryable GetQueryable()
{
- return DbSet.AsQueryable();
+ return DbSet.AsQueryable().AsNoTrackingIf(IsReadOnly);
}
- public override async Task> GetQueryableAsync()
+ public async override Task> GetQueryableAsync()
{
- return (await GetDbSetAsync()).AsQueryable();
+ return (await GetDbSetAsync()).AsQueryable().AsNoTrackingIf(IsReadOnly);
}
- protected override async Task SaveChangesAsync(CancellationToken cancellationToken)
+ protected async override Task SaveChangesAsync(CancellationToken cancellationToken)
{
await (await GetDbContextAsync()).SaveChangesAsync(cancellationToken);
}
- public override async Task FindAsync(
+ public async override Task FindAsync(
Expression> predicate,
bool includeDetails = true,
CancellationToken cancellationToken = default)
@@ -294,13 +298,14 @@ public class EfCoreRepository : RepositoryBase, IE
? await (await WithDetailsAsync())
.Where(predicate)
.SingleOrDefaultAsync(GetCancellationToken(cancellationToken))
- : await (await GetDbSetAsync())
+ : await (await GetQueryableAsync())
.Where(predicate)
.SingleOrDefaultAsync(GetCancellationToken(cancellationToken));
}
- public override async Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
+ public async override Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
var dbContext = await GetDbContextAsync();
var dbSet = dbContext.Set();
@@ -316,8 +321,9 @@ public class EfCoreRepository : RepositoryBase, IE
}
}
- public override async Task DeleteDirectAsync(Expression> predicate, CancellationToken cancellationToken = default)
+ public async override Task DeleteDirectAsync(Expression> predicate, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
var dbContext = await GetDbContextAsync();
var dbSet = dbContext.Set();
await dbSet.Where(predicate).ExecuteDeleteAsync(GetCancellationToken(cancellationToken));
@@ -358,7 +364,7 @@ public class EfCoreRepository : RepositoryBase, IE
return AbpEntityOptions.DefaultWithDetailsFunc(GetQueryable());
}
- public override async Task> WithDetailsAsync()
+ public async override Task> WithDetailsAsync()
{
if (AbpEntityOptions.DefaultWithDetailsFunc == null)
{
@@ -377,7 +383,7 @@ public class EfCoreRepository : RepositoryBase, IE
);
}
- public override async Task> WithDetailsAsync(params Expression>[] propertySelectors)
+ public async override Task> WithDetailsAsync(params Expression>[] propertySelectors)
{
return IncludeDetails(
await GetQueryableAsync(),
@@ -421,6 +427,21 @@ public class EfCoreRepository : RepositoryBase, IE
true
);
}
+
+ protected virtual void CheckReadOnly()
+ {
+ if (IsReadOnly)
+ {
+ throw new AbpRepositoryIsReadOnlyException($"Can not call " +
+ $"{nameof(InsertAsync)}, " +
+ $"{nameof(InsertManyAsync)}, " +
+ $"{nameof(UpdateAsync)}, " +
+ $"{nameof(UpdateManyAsync)}, " +
+ $"{nameof(DeleteAsync)}, " +
+ $"{nameof(DeleteManyAsync)}, " +
+ $"{nameof(DeleteDirectAsync)} methods on a read-only repository!");
+ }
+ }
}
public class EfCoreRepository : EfCoreRepository,
@@ -452,11 +473,14 @@ public class EfCoreRepository : EfCoreRepository e.Id).FirstOrDefaultAsync(e => e.Id.Equals(id), GetCancellationToken(cancellationToken))
- : await (await GetDbSetAsync()).FindAsync(new object[] { id }, GetCancellationToken(cancellationToken));
+ : IsReadOnly
+ ? await (await GetQueryableAsync()).OrderBy(e => e.Id).FirstOrDefaultAsync(e => e.Id.Equals(id), GetCancellationToken(cancellationToken))
+ : await (await GetDbSetAsync()).FindAsync(new object[] {id}, GetCancellationToken(cancellationToken));
}
public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
var entity = await FindAsync(id, cancellationToken: cancellationToken);
if (entity == null)
{
@@ -468,6 +492,7 @@ public class EfCoreRepository : EfCoreRepository ids, bool autoSave = false, CancellationToken cancellationToken = default)
{
+ CheckReadOnly();
cancellationToken = GetCancellationToken(cancellationToken);
var entities = await (await GetDbSetAsync()).Where(x => ids.Contains(x.Id)).ToListAsync(cancellationToken);
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyApiDescriptionFinder.cs
index 9c54fe840e..f7b9b838b5 100644
--- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyApiDescriptionFinder.cs
+++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyApiDescriptionFinder.cs
@@ -1,8 +1,10 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.FileProviders;
+using Microsoft.Extensions.FileProviders.Physical;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Modeling;
using Volo.Abp.Json;
@@ -92,15 +94,35 @@ public class ClientProxyApiDescriptionFinder : IClientProxyApiDescriptionFinder,
{
if (directoryContent.IsDirectory)
{
- GetGenerateProxyFileInfos(fileInfoList, directoryContent.PhysicalPath);
+ GetGenerateProxyFileInfos(fileInfoList, GetDirectoryContentPath(path, directoryContent));
}
else
{
if (directoryContent.Name.EndsWith("generate-proxy.json"))
{
- fileInfoList.Add(VirtualFileProvider.GetFileInfo(directoryContent.GetVirtualOrPhysicalPathOrNull()));
+ fileInfoList.Add(VirtualFileProvider.GetFileInfo(GetProxyFileInfoPath(path, directoryContent)));
}
}
}
}
+
+ private string GetDirectoryContentPath(string rootPath, IFileInfo fileInfo)
+ {
+ if (fileInfo is PhysicalDirectoryInfo physicalDirectoryInfo)
+ {
+ return rootPath + physicalDirectoryInfo.Name.EnsureStartsWith('/');
+ }
+
+ return fileInfo.PhysicalPath;
+ }
+
+ private string GetProxyFileInfoPath(string rootPath, IFileInfo fileInfo)
+ {
+ if (fileInfo is PhysicalFileInfo physicalFileInfo)
+ {
+ return rootPath + physicalFileInfo.Name.EnsureStartsWith('/');
+ }
+
+ return fileInfo.GetVirtualOrPhysicalPathOrNull();
+ }
}
diff --git a/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs b/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs
index c3523b4e1a..96e436760e 100644
--- a/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs
+++ b/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs
@@ -29,7 +29,7 @@ public class MailKitSmtpEmailSender : EmailSenderBase, IMailKitSmtpEmailSender
SmtpConfiguration = smtpConfiguration;
}
- protected override async Task SendEmailAsync(MailMessage mail)
+ protected async override Task SendEmailAsync(MailMessage mail)
{
using (var client = await BuildClientAsync())
{
diff --git a/framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/DefaultObjectMapper.cs b/framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/DefaultObjectMapper.cs
index 7048d183c7..6a2ab27870 100644
--- a/framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/DefaultObjectMapper.cs
+++ b/framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/DefaultObjectMapper.cs
@@ -1,5 +1,11 @@
using Microsoft.Extensions.DependencyInjection;
using System;
+using System.Collections;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Reflection;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.ObjectMapping;
@@ -19,6 +25,8 @@ public class DefaultObjectMapper : DefaultObjectMapper, IObjectMapper<
public class DefaultObjectMapper : IObjectMapper, ITransientDependency
{
+ protected static ConcurrentDictionary MethodInfoCache { get; } = new ConcurrentDictionary();
+
public IAutoObjectMappingProvider AutoObjectMappingProvider { get; }
protected IServiceProvider ServiceProvider { get; }
@@ -46,6 +54,12 @@ public class DefaultObjectMapper : IObjectMapper, ITransientDependency
{
return specificMapper.Map(source);
}
+
+ var result = TryToMapCollection(scope, source, default);
+ if (result != null)
+ {
+ return result;
+ }
}
if (source is IMapTo mapperSource)
@@ -85,6 +99,12 @@ public class DefaultObjectMapper : IObjectMapper, ITransientDependency
{
return specificMapper.Map(source, destination);
}
+
+ var result = TryToMapCollection(scope, source, destination);
+ if (result != null)
+ {
+ return result;
+ }
}
if (source is IMapTo mapperSource)
@@ -102,6 +122,131 @@ public class DefaultObjectMapper : IObjectMapper, ITransientDependency
return AutoMap(source, destination);
}
+ protected virtual TDestination? TryToMapCollection(IServiceScope serviceScope, TSource source, TDestination? destination)
+ {
+ if (!IsCollectionGenericType(out var sourceArgumentType, out var destinationArgumentType, out var definitionGenericType))
+ {
+ return default;
+ }
+
+ var mapperType = typeof(IObjectMapper<,>).MakeGenericType(sourceArgumentType, destinationArgumentType);
+ var specificMapper = serviceScope.ServiceProvider.GetService(mapperType);
+ if (specificMapper == null)
+ {
+ //skip, no specific mapper
+ return default;
+ }
+
+ var cacheKey = $"{mapperType.FullName}_{(destination == null ? "MapMethodWithSingleParameter" : "MapMethodWithDoubleParameters")}";
+ var method = MethodInfoCache.GetOrAdd(
+ cacheKey,
+ _ =>
+ {
+ return specificMapper
+ .GetType()
+ .GetMethods()
+ .First(x =>
+ x.Name == nameof(IObjectMapper