@ -1,3 +1,3 @@ |
|||
## Contribution |
|||
|
|||
See the [contribution guide](docs/en/Contribution/Index.md). |
|||
The contribution guide is available at [contribution guide](docs/en/contribution/index.md). |
|||
|
|||
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 145 KiB |
|
Before Width: | Height: | Size: 4.9 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 3.4 MiB After Width: | Height: | Size: 728 KiB |
|
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 263 KiB |
|
Before Width: | Height: | Size: 3.4 MiB After Width: | Height: | Size: 538 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 44 KiB |
@ -0,0 +1,223 @@ |
|||
# ABP Platform 9.0 Has Been Released Based on .NET 9.0 |
|||
|
|||
 |
|||
|
|||
Today, we are happy to release the [ABP](https://abp.io/) version **9.0 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 v9.0! Thanks to all of you. |
|||
|
|||
## Get Started with the 9.0 RC |
|||
|
|||
You can check the [Get Started page](https://abp.io/get-started) to see how to get started with ABP. You can either download [ABP Studio](https://abp.io/get-started#abp-studio-tab) (**recommended**, if you prefer a user-friendly GUI application - desktop application) or use the [ABP CLI](https://abp.io/docs/latest/cli). |
|||
|
|||
By default, ABP Studio uses stable versions to create solutions. Therefore, if you want to create a solution with a preview version, first you need to create a solution and then switch your solution to the preview version from the ABP Studio UI: |
|||
|
|||
 |
|||
|
|||
## Migration Guide |
|||
|
|||
There are a few breaking changes in this version that may affect your application. Please read the migration guide carefully, if you are upgrading from v8.x: [ABP Version 9.0 Migration Guide](https://abp.io/docs/9.0/release-info/migration-guides/abp-9-0) |
|||
|
|||
## What's New with ABP v9.0? |
|||
|
|||
In this section, I will introduce some major features released in this version. |
|||
Here is a brief list of titles explained in the next sections: |
|||
|
|||
* Upgraded to .NET 9.0 |
|||
* Introducing the **Extension Property Policy** |
|||
* Allow wildcards for Redirect Allowed URLs |
|||
* Docs Module: Show larger images on the same page |
|||
* Google Cloud Storage BLOB Provider |
|||
* Removed React Native mobile option from free templates |
|||
* Suite: Better naming for multiple navigation properties to the same entity |
|||
* CMS Kit Pro: Feedback feature improvements |
|||
|
|||
### Upgraded to .NET 9.0 |
|||
|
|||
We've upgraded ABP to .NET 9.0, so you need to move your solutions to .NET 9.0 if you want to use ABP 9.0. You can check [Microsoft’s Migrate from ASP.NET Core 8.0 to 9.0 documentation](https://learn.microsoft.com/en-us/aspnet/core/migration/80-90), to see how to update an existing ASP.NET Core 8.0 project to ASP.NET Core 9.0. |
|||
|
|||
> **Note:** Since the stable version of .NET 9 hasn't been released yet, we upgraded ABP to .NET v9.0-rc.2. We will update the entire ABP Platform to .NET 9 stable, after Microsoft releases it on November 13-14 with the stable ABP 9.0 release. |
|||
|
|||
### Introducing the Extension Property Policy |
|||
|
|||
ABP provides a module entity extension system, which is a high level extension system that allows you to define new properties for existing entities of the depended modules. This is a powerful way to dynamically add additional properties to entities without modifying the core structure. However, managing these properties across different modules and layers can become complex, especially when different policies or validation rules are required. |
|||
|
|||
**Extension Property Policy** feature allows developers to define custom policies for these properties, such as access control, validation, and data transformation, directly within ABP. |
|||
|
|||
**Example:** |
|||
|
|||
```csharp |
|||
ObjectExtensionManager.Instance.Modules().ConfigureIdentity(identity => |
|||
{ |
|||
identity.ConfigureUser(user => |
|||
{ |
|||
user.AddOrUpdateProperty<string>( //property type: string |
|||
"SocialSecurityNumber", //property name |
|||
property => |
|||
{ |
|||
//validation rules |
|||
property.Attributes.Add(new RequiredAttribute()); |
|||
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4}); |
|||
|
|||
//Global Features |
|||
property.Policy.GlobalFeatures = new ExtensionPropertyGlobalFeaturePolicyConfiguration() |
|||
{ |
|||
Features = new[] {"GlobalFeatureName1", "GlobalFeatureName2"}, |
|||
RequiresAll = true |
|||
}; |
|||
|
|||
//Features |
|||
property.Policy.Features = new ExtensionPropertyFeaturePolicyConfiguration() |
|||
{ |
|||
Features = new[] {"FeatureName1", "FeatureName2"}, |
|||
RequiresAll = false |
|||
}; |
|||
|
|||
//Permissions |
|||
property.Policy.Permissions = new ExtensionPropertyPermissionPolicyConfiguration() |
|||
{ |
|||
PermissionNames = new[] {"AbpTenantManagement.Tenants.Update", "AbpTenantManagement.Tenants.Delete"}, |
|||
RequiresAll = true |
|||
}; |
|||
} |
|||
); |
|||
}); |
|||
}); |
|||
``` |
|||
|
|||
### Allow Wildcards for RedirectAllowedURLs |
|||
|
|||
In this version, we made an improvement to the `RedirectAllowedUrls` configuration, which now allows greater flexibility in defining redirect URLs. Previously, developers faced restrictions when configuring URL redirects. Specifically, the `RedirectAllowedUrls` did not support using **wildcards (*)**, limiting how developers could specify which URLs were permissible for redirects. |
|||
|
|||
With the new changes in [#20628](https://github.com/abpframework/abp/pull/20628), the restriction has been relaxed, allowing developers to define redirect URLs that include wildcards. This makes it easier to handle scenarios where a broad range of URLs need to be allowed, without explicitly listing each one. |
|||
|
|||
```json |
|||
{ |
|||
"App": { |
|||
//... |
|||
"RedirectAllowedUrls": "http://*.domain,http://*.domain:4567" |
|||
} |
|||
``` |
|||
|
|||
### Docs Module: Show Larger Images |
|||
|
|||
As developers, we rely heavily on clear documentation to understand complex concepts and workflows. Often, an image is worth more than a thousand words, especially when explaining intricate user interfaces, workflows, or code structures. In recognition of this, we recently rolled out an improvement to the Docs Module that enables larger images to be displayed more effectively. |
|||
|
|||
 |
|||
|
|||
Before this enhancement, images embedded in documentation were often limited in size, which sometimes made it difficult to see the details in the diagrams, screenshots, or other visual contents. Now, images can be displayed at a larger size, offering better clarity and usability. |
|||
|
|||
> See [https://github.com/abpframework/abp/pull/20557](https://github.com/abpframework/abp/pull/20557) for more information. |
|||
|
|||
### Google Cloud Storage BLOB Provider |
|||
|
|||
ABP provides a BLOB Storing System, which allows you to work with BLOBs. This system is typically used to store file contents in a project and read these file contents when they are needed. Since ABP provides an abstraction to work with BLOBs, it also provides some pre-built storage providers such as [Azure](https://abp.io/docs/latest/framework/infrastructure/blob-storing/azure), [Aws](https://abp.io/docs/latest/framework/infrastructure/blob-storing/aws) and [Aliyun](https://abp.io/docs/latest/framework/infrastructure/blob-storing/aliyun). |
|||
|
|||
In this version, we have introduced a new BLOB Storage Provider for Google Cloud Storage: [`Volo.Abp.BlobStoring.Google`](https://www.nuget.org/packages/Volo.Abp.BlobStoring.Google) |
|||
|
|||
You can [read the documentation](https://abp.io/docs/9.0/framework/infrastructure/blob-storing/google) for configurations and use Google Cloud Storage as your BLOB Storage Provider easily. |
|||
|
|||
### Removed React Native Mobile Option From Free Templates |
|||
|
|||
In this version, we removed the **React Native** mobile option from the open source templates due to maintaining reasons. We updated the related documents and the ABP CLI (both old & new CLI) for this change, and with v9.0, you will not be able to create a free template with react-native as the mobile option. |
|||
|
|||
> **Note:** Pro templates still provide the **React Native** as the mobile option and we will continue supporting it. |
|||
|
|||
If you want to access the open-source React-Native template, you can visit the abp-archive repository from [here](https://github.com/abpframework/abp-archive). |
|||
|
|||
### Suite: Better Naming For Multiple Navigation Properties |
|||
|
|||
Prior to this version, when you defined multiple (same) navigation properties to same entity, then ABP Suite was renaming them with a duplicate number. |
|||
|
|||
As an example,let's assume that you have a book with an author and coauthor, prior to this version ABP Suite was creating a DTO class as below: |
|||
|
|||
```csharp |
|||
public class BookWithNavigationPropertiesDto |
|||
{ |
|||
public BookDto Book { get; set; } |
|||
|
|||
public AuthorDto Author { get; set; } |
|||
|
|||
public AuthorDto Author1 { get; set; } |
|||
} |
|||
``` |
|||
|
|||
Notice, that since the book entity has two same navigation properties, ABP Suite renamed them with a duplicate number. In this version, ABP Suite will ask you to define a propertyName for the **navigation properties** and you'll be able to specify a meaningful name such as (*CoAuthor*, in this example): |
|||
|
|||
```csharp |
|||
public class BookWithNavigationPropertiesDto |
|||
{ |
|||
public BookDto Book { get; set; } |
|||
|
|||
public AuthorDto Author { get; set; } |
|||
|
|||
//used the specified property name |
|||
public AuthorDto CoAuthor { get; set; } |
|||
} |
|||
``` |
|||
|
|||
ABP Suite respects the specified property name for the related navigation property and generates codes regarding that (by removing the *Id* postfix for the related places): |
|||
|
|||
 |
|||
|
|||
### CMS Kit Pro: Feedback Feature Improvements |
|||
|
|||
In this version, we revised the [CMS Kit's Feedback Feature](https://abp.io/docs/9.0/modules/cms-kit-pro/page-feedback) and as a result, we made the following improvements: |
|||
|
|||
* A new **auto-handle** setting has been added to the settings page. When this feature is enabled, if feedback is submitted without a user note, the feedback is automatically marked as handled. |
|||
* You can now require users to enter a note when submitting negative feedback. This can be configured in the settings page, ensuring that users provide context when they submit critical feedback. |
|||
* We've added a feedback user ID that is saved in local storage. This allows you to track the number of unique users submitting feedback or determine if the same user is sending new feedback on updated documents. |
|||
|
|||
> For further information about the Page Feedback System, please refer to the [documentation](https://abp.io/docs/9.0/modules/cms-kit-pro/page-feedback). |
|||
|
|||
## Community News |
|||
|
|||
### Join ABP at the .NET Conf 2024! |
|||
|
|||
ABP is excited to sponsor the [14th annual .NET Conf](https://www.dotnetconf.net/)! We've proudly supported the .NET community for years and recognize the importance of this premier virtual event. Mark your calendars for November 12-14, 2024, and join us for 3 incredible days of learning, networking, and fun. |
|||
|
|||
 |
|||
|
|||
Also, don't miss out on the co-founder of [Volosoft](https://volosoft.com/) and Lead Developer of [ABP](https://abp.io/), [Halil Ibrahim Kalkan](https://x.com/hibrahimkalkan)'s talk about "Building Modular Monolith Applications with ASP.NET Core and ABP Studio" at 10:00 - 10:30 AM GMT+3 on Thursday, November 14. |
|||
|
|||
### ABP Team Attended the .NETDeveloperDays 2024 |
|||
|
|||
We are thrilled to announce that we sponsored the [.NETDevelopersDays 2024](https://developerdays.eu/warsaw/) event. It's one of the premier conferences for .NET developers with **over 1.000 attendees**, **50+ expert speakers**, and **40+ sessions and workshops**. |
|||
|
|||
 |
|||
|
|||
Core team members of the ABP Framework, [Halil Ibrahim Kalkan](https://twitter.com/hibrahimkalkan), [İsmail Çağdaş](https://x.com/ismcagdas), [Enis Necipoğlu](https://x.com/EnisNecipoglu), and [Tarık Özdemir](https://x.com/mtozdemir) attended [.NETDevelopersDays 2024](https://developerdays.eu/warsaw/) on October 22-23, 2024 at Warsaw, Poland. |
|||
|
|||
These 2 days with the team were all about chatting and having fun with amazing attendees and speakers. We met with talented and passionate software developers and introduced the [ABP](https://github.com/abpframework/abp) - web application framework built on ASP.NET Core - to them. |
|||
|
|||
Also, we made a raffle and gifted an Xbox Series S to the lucky winner at the event: |
|||
|
|||
 |
|||
|
|||
Thanks to everyone who joined the fun and visited at our booth :) |
|||
|
|||
### New ABP Community Articles |
|||
|
|||
There are exciting articles contributed by the ABP community as always. I will highlight some of them here: |
|||
|
|||
* [Alper Ebiçoğlu](https://twitter.com/alperebicoglu) has created **five** new community articles: |
|||
* [When to Use Cookies, When to Use Local Storage?](https://abp.io/community/articles/when-to-use-cookies-when-to-use-local-storage-uexsjunf) |
|||
* [.NET 9 Performance Improvements Summary](https://abp.io/community/articles/.net-9-performance-improvements-summary-gmww3gl8) |
|||
* [ASP.NET Core SignalR New Features — Summary](https://abp.io/community/articles/asp.net-core-signalr-new-features-summary-kcydtdgq) |
|||
* [Difference Between "Promise" and "Observable" in Angular](https://abp.io/community/articles/difference-between-promise-and-observable-in-angular-bxv97pkc) |
|||
* [ASP.NET Core Blazor 9.0 New Features Summary 🆕](https://abp.io/community/articles/asp.net-core-blazor-9.0-new-features-summary--x0fovych) |
|||
* [Mohammad AlMohammad AlMahmoud](https://abp.io/community/members/Mohammad97Dev) has created **two** new community articles: |
|||
* [Implementing Multi-Language Functionality With ABP Framework](https://abp.io/community/articles/implementing-multilanguage-functionality-with-abp-framework-loq7kfx4) |
|||
* [Configure Quartz.Net in Abp FrameWork](https://abp.io/community/articles/configure-quartz.net-in-abp-framework-3bveq4y1) |
|||
* [.NET Aspire vs ABP Studio: Side by Side](https://abp.io/community/articles/.net-aspire-vs-abp-studio-side-by-side-t1c73d1l) by [Halil İbrahim Kalkan](https://twitter.com/hibrahimkalkan) |
|||
* [PoC of using GrapesJS for ABPs CMS Kit](https://abp.io/community/articles/poc-of-using-grapesjs-for-abps-cms-kit-1rmv4q41) by [Jack Fistelmann](https://abp.io/community/members/jfistelmann) |
|||
* [ABP-Powered Web App with Inertia.js, React, and Vite](https://abp.io/community/articles/abppowered-web-app-with-inertia.js-react-and-vite-j7cccvad) by [Anto Subash](https://antosubash.com/) |
|||
* [Multi-Tenancy Support in Angular Apps with ABP.IO](https://abp.io/community/articles/multitenancy-support-in-angular-apps-with-abp.io-lw9l36c5) by [HeadChannel Team](https://headchannel.co.uk/) |
|||
|
|||
Thanks to the ABP Community for all the content they have published. You can also [post your ABP-related (text or video) content](https://abp.io/community/posts/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://abp.io/docs/9.0/release-info/road-map) documentation to learn about the release schedule and planned features for the next releases. Please try ABP v9.0 RC and provide feedback to help us release a more stable version. |
|||
|
|||
Thanks for being a part of this community! |
|||
|
After Width: | Height: | Size: 287 KiB |
|
After Width: | Height: | Size: 525 KiB |
|
After Width: | Height: | Size: 212 KiB |
|
After Width: | Height: | Size: 892 KiB |
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 54 KiB |
@ -0,0 +1,99 @@ |
|||
### ASP.NET Core SignalR New Features — Summary |
|||
|
|||
In this article, I’ll highlight the latest .**NET 9 SignalR updates** for ASP.NET Core 9.0. |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
### SignalR Hub Accepts Base Classes |
|||
|
|||
SignalR `Hub` class can now get a base class of a polymorphic class. As you see in the example below, I can send `Animal` to `Process` method. Before .NET 9, we could only pass the derived classes: `Cat` and `Dog`. |
|||
|
|||
```csharp |
|||
/*** My Base Class is Animal ***/ |
|||
[JsonPolymorphic] |
|||
[JsonDerivedType(typeof(Cat), nameof(Cat))] |
|||
[JsonDerivedType(typeof(Dog), nameof(Dog))] |
|||
private class Animal |
|||
{ |
|||
public string Name { get; set; } |
|||
} |
|||
|
|||
/*** CAT derived from Animal ***/ |
|||
private class Cat : Animal |
|||
{ |
|||
public CatTypes CatType { get; set; } |
|||
} |
|||
|
|||
/*** DOG derived from Animal ***/ |
|||
private class Dog : Animal |
|||
{ |
|||
public DogTypes DogType { get; set; } |
|||
} |
|||
|
|||
|
|||
public class MyHub : Hub |
|||
{ |
|||
/*** We can use the base type Animal here ***/ |
|||
public void Process(Animal animal) |
|||
{ |
|||
if (animal is Cat) { ... } |
|||
else if (animal is Dog) { ... } |
|||
} |
|||
} |
|||
|
|||
``` |
|||
|
|||
|
|||
|
|||
### Better Diagnostics and Telemetry |
|||
|
|||
Microsoft focuses mainly on .NET Aspire nowadays. That’s why SignalR now integrates more deeply with the .NET Activity API, which is commonly used for distributed tracing. The enhancement is implemented for better monitoring in [.NET Aspire Dashboard](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/overview?tabs=bash#using-the-dashboard-with-net-aspire-projects). To support this feature: |
|||
|
|||
1- Add these packages to your`csproj`: |
|||
|
|||
```xml |
|||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" /> |
|||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" /> |
|||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" /> |
|||
``` |
|||
|
|||
2- Add the following startup code to your host project: |
|||
|
|||
```csharp |
|||
builder.Services.AddSignalR(); |
|||
/* After AddSignalR use AddOpenTelemetry() */ |
|||
builder |
|||
.Services |
|||
.AddOpenTelemetry() |
|||
.WithTracing(tracing => |
|||
{ |
|||
if (builder.Environment.IsDevelopment()) |
|||
{ |
|||
tracing.SetSampler(new AlwaysOnSampler()); //for dev env monitor all traces |
|||
} |
|||
|
|||
tracing.AddAspNetCoreInstrumentation(); |
|||
tracing.AddSource("Microsoft.AspNetCore.SignalR.Server"); |
|||
}); |
|||
|
|||
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing => tracing.AddOtlpExporter()); |
|||
``` |
|||
|
|||
Finally, you’ll see the **SignalR Hub** events on the [Aspire Dashboard](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/overview): |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
### Trimming and Native AOT Support |
|||
|
|||
With .NET 9, **trimming** and **native** **Ahead Of Time** compilation are **supported**. This will improve our application performance. To support AOT, your SignalR object serialization needs to be JSON, and you must use the `System.Text.Json` s[ource generator](https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation). Also on the server side, [you shouldn't use](https://github.com/dotnet/aspnetcore/issues/56179) `IAsyncEnumerable<T>` and `ChannelReader<T>` where `T` is a ValueType (`struct`) for Hub method arguments. One more limitation; [Strongly typed hubs](https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-8.0#strongly-typed-hubs) aren't supported with Native AOT (`PublishAot`). And you should use only `Task`, `Task<T>`, `ValueTask`, `ValueTask<T>` for `async` return types. |
|||
|
|||
|
|||
|
|||
--- |
|||
|
|||
That's all the new features coming to SignalR in .NET 9! |
|||
Happy coding 🧑🏽💻 |
|||
|
After Width: | Height: | Size: 663 KiB |
|
After Width: | Height: | Size: 44 KiB |
@ -0,0 +1,63 @@ |
|||
# When to Use Cookies, When to Use Local Storage? |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
## Cookies vs Local Storage |
|||
|
|||
When you want to save client-side data on browsers, you can use `Cookies` or `Local Storage` of the browser. While these methods look similar, they have different behaviors. You need to decide based on the specific use-case, security concerns and the data size being stored. I'll clarify the differences between these methods. |
|||
|
|||
|
|||
|
|||
## When to use Cookies 🍪? |
|||
|
|||
1. **Server Communication (e.g: Authentication Tokens):** Cookies are ideal when you need to send data automatically with HTTP requests to the server, such as authentication tokens (JWTs) or session IDs. Cookies can be configured to be sent only to specific domains or paths, making them useful for session management. |
|||
2. **Cross-Domain Communication:** Cookies can be shared across subdomains, which is useful when working with multiple subdomains under the same parent domain for microservice architecture. |
|||
3. **Expiration Control:** Cookies come with built-in expiration times. You don’t need to manually remove them after a certain period that should expire. |
|||
4. **Security:** Cookies can be marked as `HttpOnly` which makes them accessible **only via the server**, not via JavaScript! Also, when you set a cookie attribute, `Secure` it can be sent only over HTTPS, which forces enhanced security for sensitive data. |
|||
|
|||
|
|||
### Considerations for Cookies |
|||
|
|||
- **Size Limitation:** Cookies are generally limited to around 4KB of data. |
|||
- **Security Risks:** Cookies are susceptible to cross-site scripting (XSS) attacks unless marked `HttpOnly`. |
|||
|
|||
|
|||
--- |
|||
|
|||
|
|||
## When to use Local Storage🗄️? |
|||
|
|||
1. **Client-Side Data Storage:** Local storage is ideal for storing large amounts of data (up to 5–10 MB) that doesn’t need to be sent to the server with every request. For example; *user preferences*, *settings*, or *cached data*. |
|||
2. **Persistence:** Data in local storage persists even after the browser is restarted. This behavior makes it useful for long-term storage needs. |
|||
3. **No Automatic Server Transmission:** Local storage data is never automatically sent to the server, which can be a security advantage if you don’t want certain data to be exposed to the server or included in the requests. |
|||
|
|||
|
|||
### Considerations for Local Storage |
|||
|
|||
- **Security Risks:** Local storage is accessible via JavaScript, making it vulnerable to XSS attacks. Sensitive data should not be stored in local storage unless adequately encrypted. |
|||
|
|||
- **No Expiration Mechanism:** Local storage does not have a built-in expiration mechanism. You must manually remove the data when it’s no longer needed. |
|||
|
|||
|
|||
--- |
|||
|
|||
|
|||
|
|||
## Summary |
|||
|
|||
### Use Cookies |
|||
|
|||
- For data that needs to be sent to the server with HTTP requests, particularly for session management or authentication purposes. |
|||
|
|||
### Use Local Storage |
|||
|
|||
- For storing large amounts of client-side data that doesn’t need to be automatically sent to the server and for data that should persist across browser sessions. |
|||
|
|||
|
|||
|
|||
In many cases, you might use both cookies and local storage, depending on the specific requirements of different parts of your application. There are also other places where you can store the client-side data. You can check out [this article](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Client-side_storage) for more information. |
|||
|
|||
|
|||
Happy coding 🧑🏽💻 |
|||
|
After Width: | Height: | Size: 524 KiB |
@ -0,0 +1,96 @@ |
|||
# .NET 9 Performance Improvements Summary |
|||
|
|||
With every release, .NET becomes faster & faster! You get these improvements for free by just updating your project to the latest .NET! |
|||
|
|||
 |
|||
|
|||
It’s very interesting that **20% of these improvements** are implemented by **open-source volunteers** rather than Microsoft employees. These improvements mostly focus on cloud-native and high-throughput applications. I’ll briefly list them below. |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
## 1. Dynamic PGO with JIT Compiler |
|||
|
|||
* ### What is dynamic PGO? |
|||
With “Profile Guided Optimization” the compiler optimizes the code, based on the flow and the way the code executes. It is predicated on the idea that every potential behavior of the code will always transpire. |
|||
|
|||
* ### What’s Improved? |
|||
The tiered compilation, inlining, and dynamic PGO are three ways that .NET 9 optimizes the JIT compiler. This enhances runtime performance and speeds up the time for apps to launch. |
|||
|
|||
* ### Performance Gains |
|||
CPU use is lower during execution; therefore, **startup times are about 15% faster**. |
|||
|
|||
* ### As a Developer |
|||
Faster, smoother deployments with reduced warm-up times... These enhancements reduce latency for applications with complex workflows, particularly in microservices and high-throughput environments. |
|||
|
|||
* ### How to activate Dynamic PGO? |
|||
Add the following to your `csproj` file, or if you have several `csproj` files, you can add it once in `Directory.Build.props` file. Check out [this link](https://learn.microsoft.com/en-us/dotnet/core/runtime-config/compilation#profile-guided-optimization) to understand PGO. |
|||
|
|||
```xml |
|||
<PropertyGroup> |
|||
<TieredPGO>true</TieredPGO> |
|||
</PropertyGroup> |
|||
``` |
|||
|
|||
|
|||
|
|||
## 2. Library Improvements |
|||
|
|||
* ### What’s Improved? |
|||
|
|||
LINQ and JSON serialization, collections and libraries are significantly improved with .NET 9. |
|||
|
|||
* ### Performance Gains |
|||
|
|||
**JSON serialization** performance **increases by about 35%**. This helps with heavy data parsing and API requests. Less memory is allocated to `Span` operations as well, and LINQ techniques such as `Where` and `Select` are now faster. |
|||
|
|||
* ### As a Developer |
|||
|
|||
This means that apps will be faster, especially those that handle data primarily in JSON or manipulate data with LINQ. |
|||
|
|||
|
|||
|
|||
## 3. ASP.NET Core |
|||
|
|||
* ### What’s Improved? |
|||
Kestrel server has undergone significant modifications, mostly in processing the HTTP/2 and HTTP/3 protocols. |
|||
|
|||
* ### Performance Gains |
|||
Now, **Kestrel handles requests up to 20% faster** and **has a 25% reduction in average latency**. Improved connection management and SSL processing also result in overall efficiency gains. |
|||
|
|||
* ### As a Developer |
|||
These modifications result in less resource use, quicker response times for web applications, and more seamless scaling in high-traffic situations. |
|||
|
|||
|
|||
|
|||
## 4. Garbage Collection & Memory Management |
|||
|
|||
* ### What’s Improved? |
|||
NET 9’s garbage collection (GC) is more effective, especially for apps with high allocation rates. |
|||
|
|||
* ### Performance Gains |
|||
Applications experience smoother **garbage collection cycles with 8–12% less memory overhead**, which lowers latency and delays. |
|||
|
|||
* ### As a Developer |
|||
The performance will be more reliable and predictable for developers as there will be fewer memory-related bottlenecks, particularly in applications that involve frequent object allocations. |
|||
|
|||
|
|||
|
|||
## 5. Native AOT Compilation |
|||
|
|||
* ### What’s Improved? |
|||
Native AOT (Ahead-of-Time) compilation is now more efficient by lowering memory footprint and cold-start times. This leads to better support for cloud-native applications. |
|||
|
|||
* ### Performance Gains |
|||
Native AOT apps now have faster cold launches and use **30–40% less memory**. This improvement focuses on containerized applications. |
|||
|
|||
--- |
|||
|
|||
|
|||
|
|||
**References:** |
|||
|
|||
* [Microsoft .NET blog post](https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-9/). |
|||
* [What’s new in the .NET 9 runtime?](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/runtime#performance-improvements) |
|||
|
|||
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 432 KiB |
@ -0,0 +1,138 @@ |
|||
# .NET Aspire vs ABP Studio: Side by Side |
|||
|
|||
In this article, I will compare [.NET Aspire](https://learn.microsoft.com/en-us/dotnet/aspire/) by [ABP Studio](https://abp.io/docs/latest/studio) by explaining their similarities and differences. |
|||
|
|||
 |
|||
|
|||
## Introduction |
|||
|
|||
While .NET Aspire and ABP Studio are tools for different purpose with different scope and they have different approaches to solve the problems, many developers still may confuse since they also have some similar functionalities and solves some common problems. |
|||
|
|||
In this article, I will clarify all, and you will have a clear understanding of what are the similarities and differences of them. Let's start by briefly define what are .NET Aspire and ABP Studio. |
|||
|
|||
### What is .NET Aspire? |
|||
|
|||
**[.NET Aspire](https://learn.microsoft.com/en-us/dotnet/aspire/)** is a **cloud-ready framework** designed to simplify building distributed, observable, and production-ready applications. It provides a set of opinionated tools and NuGet packages tailored for cloud-native concerns like **orchestration**, **service integration** (e.g., Redis, PostgreSQL), and **telemetry**. Aspire focuses on the **local development experience**, making it easier to manage complex, multi-service apps by **abstracting away configuration details**. |
|||
|
|||
Here, a screenshot from [.NET Aspire dashboard](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/overview) that is used for application monitoring and inspection: |
|||
|
|||
 |
|||
|
|||
### What is ABP Studio? |
|||
|
|||
**[ABP Studio](https://abp.io/docs/latest/studio)** is a cross-platform **desktop application** designed to **simplify development** on the ABP Framework by **automating various tasks** and offering a streamlined, **integrated development environment**. It allows developers to **build**, **run**, **test**, **monitor**, and **deploy applications** more efficiently. With features like Kubernetes integration and support for complex multi-application systems, ABP Studio **enhances productivity**, especially in **microservice or modular monolith architectures**. |
|||
|
|||
Here, a screenshot from the ABP Studio [Solution Runner panel](https://abp.io/docs/latest/studio/running-applications) that is used to run, browse, monitor and inspect applications: |
|||
|
|||
 |
|||
|
|||
## A Brief Comparison |
|||
|
|||
Before deep diving details, I want to show a **table of features** to compare ABP Studio and .NET Aspire side by side: |
|||
|
|||
 |
|||
|
|||
## Comparing the Features |
|||
|
|||
In the next sections, I will go through each feature and explain differences and similarities. |
|||
|
|||
### Integration Packages |
|||
|
|||
ABP Framework has tens of integration packages to 3rd-party libraries and services. .NET Aspire also has some library integrations. But these integrations have different purposes: |
|||
|
|||
* **ABP Framework**'s integrations (like [MongoDB](https://abp.io/docs/latest/framework/data/mongodb), [RabbitMQ](https://abp.io/docs/latest/framework/infrastructure/background-jobs/rabbitmq), [Dapr](https://abp.io/docs/latest/framework/dapr), etc) are integrations for its abstractions and aimed to be **used directly by your application code**. They are complete and sophisticated integrations with the ABP Framework and your codebase. |
|||
* **.NET Aspire**'s integrations (like [MongoDB](https://learn.microsoft.com/en-us/dotnet/aspire/database/mongodb-integration), [RabbitMQ](https://learn.microsoft.com/en-us/dotnet/aspire/messaging/rabbitmq-integration), [Dapr](https://learn.microsoft.com/en-us/dotnet/aspire/frameworks/dapr), etc), on the other hand, for simplifying configuration, service discovery, orchestration and monitoring of these tools within .NET Aspire host. Basically, these are mostly for **integrating to .NET Aspire**, not for integrating to your application. |
|||
|
|||
For example, ABP's [MongoDB](https://abp.io/docs/latest/framework/data/mongodb) integration allows you to use MongoDB over [repository services](https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories), automatically handles database transactions, [audit logs](https://abp.io/docs/latest/framework/infrastructure/audit-logging), [event publishing](https://abp.io/docs/latest/framework/infrastructure/event-bus/distributed) on data saves, dynamic [connection string](https://abp.io/docs/latest/framework/fundamentals/connection-strings) management, [multi-tenancy](https://abp.io/docs/latest/framework/architecture/multi-tenancy) integration and so on. |
|||
|
|||
On the other hand, .NET Aspire's [MongoDB](https://learn.microsoft.com/en-us/dotnet/aspire/database/mongodb-integration) integration basically adds [MongoDB driver library](https://www.nuget.org/packages/MongoDB.Driver/) to your .NET Aspire host application and configures it so you can discover MongoDB server on runtime, use a MongoDB Docker container and see its health status, logs and traces on .NET Aspire dashboard. |
|||
|
|||
### Starter Templates |
|||
|
|||
Both of ABP Studio and .NET Aspire provide **startup solution templates for new applications**. However, there are huge differences between these startup solution templates and their purpose are completely different. |
|||
|
|||
* ABP Studio provides **production-ready** and [advanced solution templates](https://abp.io/docs/latest/solution-templates) for **layered**, **modular** or **microservice** solution development. They are well configured for **local development** and deploying to **Kubernetes** and other **production environments**. They provide different **UI and database options**, many optional modules and configuration. For example, you can check the [microservice solution template](https://abp.io/docs/latest/solution-templates/microservice/overview) to see how **sophisticated** it is. |
|||
* .NET Aspire's [project templates](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/setup-tooling?tabs=windows&pivots=visual-studio#net-aspire-project-templates)' main purpose is to provide a minimal application structure that is **pre-integrated to .NET Aspire** libraries and configured for **local development** environment. |
|||
|
|||
So, when you start with .NET Aspire project template, you will need to deal with a lot of work to make your solution production and enterprise ready. On the other hand, ABP Studio's solution templates are ready to launch your system from the first day and they provide you a perfect starting point for your new business idea. |
|||
|
|||
### Monitoring & Application Running |
|||
|
|||
Monitoring applications and services is an important requirement for building **complex distributed systems**. Both of ABP Studio and .NET Aspire provide **excellent tools** for that purpose. |
|||
|
|||
* ABP Studio's [Solution Runner panel](https://abp.io/docs/latest/studio/running-applications) provides a powerful UI to run and monitor applications and services. You can see all HTTP requests, distributed events, exceptions and detailed application logs, trace and find problems in your system. You can use its fully functional built-in browser to navigate application UIs easily. You can also create multiple profiles to group and configure the applications for different teams. |
|||
* .NET Aspire's [dashboard](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/overview) can be used to see the states of the running applications and containers, explore their console output, logs, traces and metrics to understand what is happing in your distributed system. |
|||
|
|||
Both tools are pretty useful for monitoring. In addition to monitoring, **ABP Studio offers an advanced UI to control the running applications**, build, start and stop individually or by a group of applications. |
|||
|
|||
### Architecting / Building Solutions |
|||
|
|||
One of the unique features of **ABP Studio** is that it **is an architectural tool** that helps you create the structure and architecture of your solution. You can create any kind of application, from **single-layer** simple web applications to **layered multi-application** solutions, from **monolith modular** to **microservice** systems. In the next section, I will briefly explains these architectural features. |
|||
|
|||
#### Building Modular Monolith Solutions |
|||
|
|||
With ABP Studio, you can create a new solution, **create modules and establish relations** (dependencies) between modules to architect your overall **modular monolith system** easily. |
|||
|
|||
Here, a screenshot where we are adding an existing package reference to the Products module of a modular CRM solution: |
|||
|
|||
 |
|||
|
|||
You can see the [Modular Application Development tutorial](https://abp.io/docs/latest/tutorials/modular-crm) to learn how to build such an application step by step. |
|||
|
|||
#### Building Microservice Solutions |
|||
|
|||
ABP Studio provides a full featured [microservice startup solution template](https://abp.io/docs/latest/solution-templates/microservice) and the fundamental tooling to build **large-scale microservice systems**. |
|||
|
|||
Here a screenshot that shows how to add new microservices, API gateways or web applications to a microservice solution: |
|||
|
|||
 |
|||
|
|||
.NET Aspire has no such a feature and has no such a plan to provide that kind of architectural solution building experience. |
|||
|
|||
### Kubernetes Integration |
|||
|
|||
Another great ABP Studio feature is [Kubernetes Integration](https://abp.io/docs/latest/studio/kubernetes). It allows you to develop your distributed / microservice solutions as integrated to [Kubernetes](https://kubernetes.io/). |
|||
|
|||
Here, a few tasks you can accomplish using ABP Studio's Kubernetes integration: |
|||
|
|||
* **Build docker images** of your applications and services |
|||
* **Install and uninstall Helm charts** to your Kubernetes cluster |
|||
* **Connect to internal services** of your Kubernetes cluster |
|||
* **Monitor** services and applications that are running in your Kubernetes cluster |
|||
* **Intercept traffic** of a service and redirect requests to your local machine. In that way, you can develop, test and run individual services or applications in your local computer that is **fully integrated** to other services and applications running in Kubernetes. |
|||
|
|||
ABP Studio's Kubernetes Integration makes microservice development so easy and comfortable. On the other hand, .NET Aspire has no such a Kubernetes integrated development experience. |
|||
|
|||
## The ABP Platform |
|||
|
|||
Until now, I directly compared ABP Studio and .NET Aspire features. .NET Aspire is directly built on .NET and ASP.NET Core. However, ABP Studio is not a standalone tool that is built on .NET and ASP.NET Core. It is built on the [ABP Platform](https://abp.io/) (which is built on .NET and ASP.NET Core). |
|||
|
|||
The following diagram shows ABP Platform components at a glance: |
|||
|
|||
 |
|||
|
|||
So, when you use ABP Studio, you also take full power of the [open source ABP Framework](https://github.com/abpframework/abp) and other ABP Platform features. |
|||
|
|||
## ABP and .NET Aspire Integration |
|||
|
|||
I have a good news to you. It is actually possible and pretty easy to make ABP Platform and .NET Aspire working together. |
|||
|
|||
You can check [@berkansasmaz](https://abp.io/community/members/berkansasmaz)'s great article: **[How to use .NET Aspire with ABP framework](https://abp.io/community/articles/how-to-use-.net-aspire-with-abp-framework-h29km4kk)**. |
|||
|
|||
## Licensing |
|||
|
|||
ABP Studio has a Community Edition which is completely free and available to everyone. It includes many of the features I mentioned here. There is also a commercial edition that is included in [commercial ABP licenses](https://abp.io/pricing). You can [check that blog post](https://abp.io/blog/announcing-abp-studio-general-availability) which clearly explains the license differences and introduces the fundamental ABP Studio features. |
|||
|
|||
On the other hand, .NET Aspire is a free tool developed and published by Microsoft. It has no commercial version. |
|||
|
|||
## Conclusion |
|||
|
|||
Both .NET Aspire and ABP Studio serve distinct purposes, catering to different types of development environments. While .NET Aspire excels in simplifying cloud-native application setups and observability, ABP Studio provides a comprehensive framework for modular monoliths and microservice architectures with full-fledged enterprise level production-ready startup solution templates and integrated tools. |
|||
|
|||
In the previous section, it was mentioned that it is possible to [use them together](https://abp.io/community/articles/how-to-use-.net-aspire-with-abp-framework-h29km4kk). You don't have to select one of them. However, in my opinion, when you use ABP Studio, you won't need .NET Aspire since ABP Studio can do everything and much more. If you have budget, I suggest to purchase a commercial ABP Studio [license](https://abp.io/pricing) so you can fully unlock its power. |
|||
|
|||
## Resources / Further Reading |
|||
|
|||
* [ABP Studio documentation](https://abp.io/docs/latest/studio) |
|||
* [.NET Aspire documentation](https://learn.microsoft.com/en-us/dotnet/aspire/) |
|||
* [How to use .NET Aspire with ABP framework](https://abp.io/community/articles/how-to-use-.net-aspire-with-abp-framework-h29km4kk) |
|||
|
After Width: | Height: | Size: 407 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 412 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 46 KiB |
@ -0,0 +1,147 @@ |
|||
# ABP Now Supports .NET 9 |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
**.NET 9.0.100-rc.2** has been released on **October 8, 2024**. To align with the latest .NET, we also released the ABP Platform [9.0.0-rc.1](https://github.com/abpframework/abp/releases/tag/9.0.0-rc.1) version. |
|||
**With this release, ABP now supports .NET 9.** |
|||
|
|||
The .NET 9 stable version is planned to be released on **November 12, 2024** before the [.NET Conf 2024](https://www.dotnetconf.net/) event. The ABP 9.0 stable version is planned to be released on November 19, 2024. |
|||
|
|||
--- |
|||
|
|||
- **Download the .NET 9 runtime** and SDK from the following link: |
|||
|
|||
[https://dotnet.microsoft.com/en-us/download/dotnet/9.0](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) |
|||
|
|||
- There are many enhancements and bug fixes with ABP 9.0. Read the ABP 9 announcement: |
|||
|
|||
https://abp.io/blog/announcing-abp-9-0-release-candidate |
|||
|
|||
- |
|||
Read **our migration ABP 9.0 migration guide** from the following link: |
|||
|
|||
[abp.io/docs/9.0/release-info/migration-guides/abp-9-0](https://abp.io/docs/9.0/release-info/migration-guides/abp-9-0) |
|||
|
|||
- The following is the **PR is for the .NET 9 upgrade** in the ABP source code: |
|||
|
|||
[https://github.com/abpframework/abp/pull/20803](https://github.com/abpframework/abp/pull/20803) |
|||
|
|||
--- |
|||
|
|||
|
|||
|
|||
## .NET 9 Releases |
|||
|
|||
In the following link, you can find **a list of all .NET 9 releases** with direct links to release notes and announcements/discussions: |
|||
|
|||
* https://github.com/dotnet/core/discussions/9234 |
|||
|
|||
|
|||
|
|||
--- |
|||
|
|||
|
|||
|
|||
## ABP Supports Both .NET 8 & .NET 9 |
|||
|
|||
The ABP 9.0 version fully supports .NET 9 within our new templates and modules. For developers who want to update their ABP packages to the latest but want to keep them in .NET 8, **we support both .NET 8 and .NET 9** in ABP 9. In your host application, you can choose your target framework. |
|||
|
|||
So you can decide which version you want to use in your startup Host Application’s `<TargetFramework>` tag. |
|||
|
|||
In [this link](https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp/Volo.Abp.csproj#L7) you can see that netstandard2.0/2.1 and net8/9 are supported. |
|||
|
|||
```xml |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<TargetFrameworks> |
|||
netstandard2.0;netstandard2.1;net8.0;net9.0 |
|||
</TargetFrameworks> |
|||
</Project> |
|||
``` |
|||
|
|||
|
|||
|
|||
### New ASP.NET Core Middleware: Static Asset Delivery |
|||
|
|||
`MapStaticAssets` is a new middleware that helps optimize the delivery of static assets in any ASP.NET Core app, including Blazor apps. With this change, some `JavaScript/CSS/Images` files exist in the [Virtual File System](https://abp.io/docs/latest/framework/infrastructure/virtual-file-system?_redirected=B8ABF606AA1BDF5C629883DF1061649A), but the new ASP.NET Core 9 `MapStaticAssets` can't handle them. You need to add `StaticFileMiddleware` to serve these files. In ABP 9, we added `MapAbpStaticAssetsan `extension method to support the new `MapStaticAssets`. You can read about this new feature at [this link](https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-9.0?view=aspnetcore-8.0#static-asset-delivery-optimization). |
|||
ABP’s new extension method is available [here](https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs#L129-L198). |
|||
|
|||
--- |
|||
|
|||
|
|||
|
|||
## How to Upgrade from .NET 8 to .NET 9: |
|||
|
|||
Install the latest .NET 9 SDK from [this link](https://dotnet.microsoft.com/en-us/download/dotnet/9.0). |
|||
Upgrade [dotnet-ef](https://learn.microsoft.com/en-us/ef/core/cli/dotnet) tool version with the following command: |
|||
|
|||
```bash |
|||
dotnet tool uninstall --global dotnet-ef && dotnet tool install --global dotnet-ef |
|||
``` |
|||
|
|||
 |
|||
|
|||
1. Change all `TargetFramework` tags from `net8.0` to `net9.0`. |
|||
2. Upgrade all Microsoft NuGet packages to `9.0.0`. |
|||
3. If you have `global.json`, update `dotnet`version to `9.0.0` . |
|||
4. Replace`app.UseStaticFiles()` to `app.MapAbpStaticAssets()` in your module classes and startup projects. |
|||
[See the related changes in the repository.](https://github.com/abpframework/abp/commit/0f34f6dfcdbeb5d27fd63cf764f1ef13eb9cdfcd) |
|||
|
|||
|
|||
|
|||
--- |
|||
|
|||
|
|||
|
|||
## What’s new with .NET 9 |
|||
|
|||
**.NET 9 Blazor New Features** |
|||
|
|||
- https://abp.io/community/articles/asp.net-core-blazor-9.0-new-features-summary--x0fovych |
|||
|
|||
**.NET 9 Performance Improvements Summary** |
|||
|
|||
- https://abp.io/community/articles/.net-9-performance-improvements-summary-gmww3gl8 |
|||
|
|||
**What’s new in .NET 9 (Microsoft’s post)** |
|||
|
|||
- https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/overview |
|||
|
|||
|
|||
|
|||
--- |
|||
|
|||
|
|||
|
|||
## We Are Eating Our Own Dog Food |
|||
|
|||
Before we release any version of ABP, **we test our upcoming version** on our sample apps and live website https://abp.io. The ABP.io website is also built on top of the ABP Framework, and you can see that we have already started to use .NET 9-rc.2 on our live website. |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
--- |
|||
|
|||
|
|||
|
|||
## Microsoft .NET Support Policy |
|||
|
|||
Lastly, I want to mention Microsoft's .NET support policy. |
|||
|
|||
- **.NET 7** support has been **finished** on **May 2024**. |
|||
- **.NET 8** will be supported until **November 2026**. |
|||
- **.NET 9** is on the standard term support, which means Microsoft will release patches until **May 2026**. |
|||
|
|||
Find detailed information about the .NET support policy at [this link.](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core) |
|||
|
|||
 |
|||
|
|||
--- |
|||
|
|||
|
|||
|
|||
## Finally |
|||
|
|||
.NET 9 is making a significant impact. It introduces features like Native AOT for faster applications, enhanced AI integration and improved tools for cloud-native and cross-platform development, all aimed at simplifying developers’ work. Whether you’re handling small projects or large-scale enterprise applications, it offers enhancements that **elevate your productivity by just upgrading your .NET version to 9.0** |
|||
@ -0,0 +1,125 @@ |
|||
# Hybrid Cache in .NET 9 |
|||
|
|||
.NET 9 introduces an exciting feature: **HybridCache**, an advanced caching mechanism that seamlessly combines multiple caching strategies to maximize performance and scalability. |
|||
|
|||
It offers a flexible caching solution that combines the best aspects of local and distributed caching. **HybridCache** is particularly useful in scenarios where quick, in-memory access is desirable but data consistency across multiple application instances is also a requirement. |
|||
|
|||
In this article, we’ll explore **HybridCache** in .NET 9 and how it integrates with ABP Framework using `AbpHybridCache`. This new feature offers a robust solution for applications that need to scale while maintaining efficient caching strategies. |
|||
|
|||
## What is HybridCache? |
|||
|
|||
**HybridCache** is designed to merge different caching layers, commonly including an in-memory cache (for high-speed access) and a distributed cache (for scalability across multiple instances). This hybrid approach allows for: |
|||
|
|||
* **Improved Performance**: Frequently accessed data is stored in-memory, reducing latency. |
|||
* **Increased Scalability**: Cached data can still be shared across distributed environments, essential for load-balanced applications. |
|||
* **Automatic Synchronization**: Changes in distributed cache automatically update the in-memory cache, ensuring data consistency. |
|||
|
|||
## Using HybridCache with ABP |
|||
|
|||
> For more information about the implementation in the ABP side, you can refer to the pull request [here](https://github.com/abpframework/abp/pull/20859). |
|||
|
|||
ABP's support for **HybridCache** is available starting from version 9.0 through the [`AbpHybridCache`](https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/Hybrid/AbpHybridCache.cs) implementation. By leveraging this feature, developers using ABP can implement hybrid caching in a way that aligns with ABP’s modular and extensible architecture. |
|||
|
|||
To demonstrate how to use **HybridCache** in ABP, let's start with a simple example. |
|||
|
|||
> You can create an ABP-based application with v9.0+, and then follow the next steps for using hybrid caching in your application. |
|||
|
|||
### Configuring the `AbpHybridCacheOptions` (Optional) |
|||
|
|||
First, you can configure the hybrid cache options in your module class as below (it's optional): |
|||
|
|||
```csharp |
|||
using Microsoft.Extensions.Caching.Hybrid; |
|||
using Volo.Abp.Caching.Hybrid; |
|||
|
|||
public class YourModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
//... |
|||
|
|||
Configure<AbpHybridCacheOptions>(options => |
|||
{ |
|||
//configuring the global hybrid cache options |
|||
options.GlobalHybridCacheEntryOptions = new HybridCacheEntryOptions() |
|||
{ |
|||
Expiration = TimeSpan.FromMinutes(20), |
|||
LocalCacheExpiration = TimeSpan.FromMinutes(10) |
|||
}; |
|||
}); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
* You can configure the `AbpHybridCacheOptions` to set *keyPrefix* for your cache keys, throw or hide exceptions for the distributed cache (by default *it hides errors*), or configure cache for specific cache item keys and more... |
|||
* By setting the `GlobalHybridCacheEntryOptions`, you specify the caching options globally in your application. Thanks to that, you don't need to manually pass the related options whenever you use the `IHybridCache` service. |
|||
|
|||
### Using the `IHybridCache` Service |
|||
|
|||
After the configuration, now you can inject the `IHybridCache` and use it to set and retrieve cache values: |
|||
|
|||
```csharp |
|||
using Volo.Abp.Caching.Hybrid; |
|||
|
|||
public class BookAppService : ApplicationService, IBookAppService |
|||
{ |
|||
private readonly IHybridCache<BookCacheItem> _hybridCache; |
|||
|
|||
public BookAppService(IHybridCache<BookCacheItem> hybridCache) |
|||
{ |
|||
_hybridCache = hybridCache; |
|||
} |
|||
|
|||
public async Task<BookCacheItem> GetBookWithPageCountAsync(string name) |
|||
{ |
|||
var cacheKey = "cacheKey:book-" + name; |
|||
|
|||
// Retrieve data from hybrid cache |
|||
return await _hybridCache.GetOrCreateAsync(cacheKey, async () => |
|||
{ |
|||
// Simulating getting and returning the data if not exist in the cache |
|||
return new BookCacheItem |
|||
{ |
|||
Name = name, |
|||
PageCount = 100 |
|||
}; |
|||
}); |
|||
} |
|||
} |
|||
|
|||
public class BookCacheItem |
|||
{ |
|||
public string Name { get; set; } |
|||
|
|||
public int PageCount { get; set; } |
|||
} |
|||
``` |
|||
|
|||
* You can use the `IHybridCache<TCacheItem>` or `IHybridCache<TCacheItem, TCacheKey>` service to leverage the hybrid caching. If you use `IHybridCache<TCacheItem>`as the service, then you should pass the cache key as *string* like in the example above. |
|||
* In this example, you used the `GetOrCreateAsync` method, which first tries to get the cache item with the provided cache key, if there is no cache with the specified key, then it runs the factory method and add the returned data to the cache. |
|||
* Alternatively, you can use the `SetAsync` method to set the cache item. |
|||
|
|||
### Debugging the `IHybridCache` Service (deep-dive) |
|||
|
|||
When you debug the `IHybridCache` service, you'll notice the L1 and L2 cache stores. (L1 is in-memory cache store and L2 is the distributed cache store): |
|||
|
|||
 |
|||
|
|||
As you can see from the figure, it only set the cache item to the **LocalCache** (`MemoryCache`) and did not set the **BackendCache** (`DistributedCache`) because I did not configure the distributed cache and not running my application in multiple instances. But as you can notice, even without an `IDistributedCache` configuration, the `HybridCache` service will still provide in-process caching. |
|||
|
|||
**Note:** If you configure distributed caching options, `HybridCache` service uses the distributed cache and sets the **BackendCache**. |
|||
|
|||
## Conclusion |
|||
|
|||
The **HybridCache** library in .NET 9 provides a powerful tool for applications needing both high-speed caching and consistency in distributed environments. |
|||
|
|||
With ABP Framework’s `AbpHybridCache` support, integrating this feature into an ABP-based application becomes straightforward. This setup helps ensure that cached data remains synchronized across instances, bringing a new level of flexibility to caching in .NET 9 applications. |
|||
|
|||
> For more information, you can refer to the [Microsoft's official document](https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-9.0?view=aspnetcore-9.0#new-hybridcache-library). |
|||
|
|||
## References |
|||
|
|||
- https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-9.0?view=aspnetcore-9.0#new-hybridcache-library |
|||
- https://www.youtube.com/watch?v=TDyZc11cJfA |
|||
- https://github.com/abpframework/abp/pull/20803 |
|||
- https://github.com/abpframework/abp/pull/20859 |
|||
|
After Width: | Height: | Size: 483 KiB |
|
After Width: | Height: | Size: 144 KiB |
@ -0,0 +1,86 @@ |
|||
# EF Core 9 Read-only Primitive Collections |
|||
|
|||
In this article, we will explore the new features introduced in EF Core 9, specifically focusing on Read-only Primitive Collections. EF Core 8 introduced support for mapping arrays and mutable lists of primitive types, and you can read more about it [here](https://abp.io/community/articles/ef-core-8-primitive-collections-ttn5b6xp). This has been expanded in EF Core 9 to include read-only collections/lists. Specifically, EF Core 9 supports collections typed as `IReadOnlyList`, `IReadOnlyCollection`, or `ReadOnlyCollection`. |
|||
|
|||
## Introduction to EF Core 9 Read-only Primitive Collections |
|||
|
|||
Entity Framework Core 9 introduces several enhancements, one of which is the support for Read-only Primitive Collections. This feature aims to provide better support for scenarios where collections of primitive types, such as `int`, `string`, or `bool`, need to be used in a read-only manner in your entity classes. Previously, developers had to use complex workarounds to ensure collections couldn't be modified, but EF Core 9 now provides a simpler, built-in solution to handle this more effectively. |
|||
|
|||
### Why Read-only Primitive Collections Matter |
|||
|
|||
Read-only Primitive Collections are particularly useful when you need to guarantee the integrity of certain data within your entities. For example, imagine you have a `Car` entity that has a collection of `Colors`, represented as a set of enums. You might not want these colors to be modified after they're initially set, ensuring that any business logic reliant on these values remains consistent. |
|||
|
|||
EF Core 9 introduces a convenient way to define these collections as read-only, helping developers maintain stricter control over their data. |
|||
|
|||
### How It Works |
|||
|
|||
Defining a read-only primitive collection is quite straightforward in EF Core 9. You can use the `IReadOnlyList<T>`, `IReadOnlyCollection<T>`, or `ReadOnlyCollection<T>` types to declare your properties, ensuring a consistent read-only behavior. This helps maintain data integrity by preventing modifications after the collection is set. Below is an example that includes a `Car` class and a `Color` enum. The `Car` class has a `Colors` property that holds a read-only list of available colors, ensuring that these values cannot be modified after being initially set: |
|||
|
|||
```csharp |
|||
public enum Color |
|||
{ |
|||
Black, |
|||
White, |
|||
Red, |
|||
Blue |
|||
} |
|||
|
|||
public class Car |
|||
{ |
|||
public int Id { get; set; } |
|||
public string Brand { get; set; } |
|||
public string Model { get; set; } |
|||
public IReadOnlyList<Color> Colors { get; private set; } = new List<Color> { Color.Black, Color.White }.AsReadOnly(); |
|||
|
|||
protected Car() |
|||
{ |
|||
/* This constructor is for deserialization / ORM purpose */ |
|||
} |
|||
|
|||
public Car(string brand, string model, IEnumerable<Color> colors) |
|||
{ |
|||
Brand = brand; |
|||
Model = model; |
|||
Colors = colors.ToList().AsReadOnly(); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
In the example above, `Colors` is defined as a read-only list, preventing any accidental modifications once it is set. This ensures that data integrity is maintained without the need for manual validation. |
|||
|
|||
To query cars with specific colors, you can use the following example: |
|||
|
|||
```csharp |
|||
var colors = new List<Color> { Color.Black, Color.White }; |
|||
var cars = await context.Cars |
|||
.Where(c => c.Colors.Intersect(colors).Any()) |
|||
.ToListAsync(); |
|||
``` |
|||
|
|||
The query selects all cars that have any of the specified colors in their `Colors` collection. |
|||
|
|||
The SQL result looks like this; as you can see, it sends colors as parameters instead of adding them inline. It also uses the `json_each` function to deserialize on the database side: |
|||
|
|||
```sql |
|||
SELECT "c"."id", |
|||
"c"."brand", |
|||
"c"."colors", |
|||
"c"."model" |
|||
FROM "cars" AS "c" |
|||
WHERE EXISTS (SELECT 1 |
|||
FROM (SELECT "c0"."value" |
|||
FROM Json_each("c"."colors") AS "c0" |
|||
INTERSECT |
|||
SELECT "c1"."value" |
|||
FROM Json_each(@__colors_0) AS "c1") AS "i") |
|||
``` |
|||
|
|||
### Conclusion |
|||
|
|||
Read-only primitive collections make it easier to enforce data integrity by preventing changes to your collection data. This feature helps simplify your code while ensuring that critical parts of your data remain consistent. |
|||
|
|||
## References |
|||
|
|||
- https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-9.0/whatsnew#read-only-primitive-collections |
|||
- https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-8.0/whatsnew#primitive-collections |
|||
- https://abp.io/community/articles/ef-core-8-primitive-collections-ttn5b6xp |
|||
@ -0,0 +1,54 @@ |
|||
# .NET Aspire 9.0 Features |
|||
|
|||
.NET Aspire 9.0 Release Candidate 1 is the next major release, supporting both .NET 8 and .NET 9. This version includes new features and improvements. |
|||
|
|||
## Upgrade to .NET Aspire 9 RC1 |
|||
|
|||
Now, you don't need workloads to develop .NET Aspire applications. In your project, you can add an SDK reference to `Aspire.AppHost.Sdk`. |
|||
For more information, you can check out [https://learn.microsoft.com/en-us/dotnet/aspire/whats-new/dotnet-aspire-9-release-candidate-1?tabs=windows&pivots=visual-studio#upgrade-to-net-aspire-9-rc1](https://learn.microsoft.com/en-us/dotnet/aspire/whats-new/dotnet-aspire-9-release-candidate-1?tabs=windows&pivots=visual-studio#upgrade-to-net-aspire-9-rc1) which explains upgrading an existing project in details. |
|||
|
|||
## Dashboard |
|||
|
|||
.NET Aspire offers a nice dashboard for developers to observe the performance and behavior of their applications. In this version, there are some enhancements; |
|||
|
|||
* **Manage resource lifecycle**: You can stop, start, and restart resources. |
|||
* **Mobile and responsive support**: The .NET Aspire dashboard is now mobile-friendly. |
|||
* **Sensitive properties**: Properties can be marked as sensitive, automatically masking them in the dashboard UI. |
|||
* **Volumes**: Configured container volumes are listed in resource details. |
|||
* **Health checks**: .NET Aspire 9 RC1 adds support for health checks. |
|||
|
|||
 |
|||
|
|||
## Telemetry |
|||
|
|||
.NET Aspire 9 RC1 comes with many new features to the Telemetry service. |
|||
|
|||
* **Improve telemetry filtering**: Telemetry data can now be filtered by attribute values. |
|||
* **Combine telemetry from multiple resources**: If a resource has multiple replicas, you can now filter telemetry data to view from all instances. |
|||
* **Browser telemetry support**: The dashboard now supports OpenTelemetry Protocol (OTLP) over HTTP and cross-origin resource sharing (CORS). |
|||
|
|||
 |
|||
|
|||
## Orchestration |
|||
|
|||
The .NET App Host is a core component of the .NET runtime that helps launch and execute .NET applications. |
|||
.NET Aspire 9 RC1 introduces many new features to the app host. Let's take a look; |
|||
|
|||
* **Waiting for dependencies**: You can configure a resource to wait for another resource to start before starting. |
|||
* **Resource health checks**: The `Waiting for dependencies` feature uses health checks to determine if a resource is ready. |
|||
|
|||
## Integrations |
|||
|
|||
.NET Aspire has integrations with some services and tools that make it easy to get started. New integrations are coming with .NET Aspire 9 RC1. |
|||
|
|||
* Redis Insight |
|||
* OpenAI (Preview) |
|||
* MongoDB |
|||
* Azure |
|||
|
|||
For Azure part, it is better to check the official documentation here [https://learn.microsoft.com/en-us/dotnet/aspire/whats-new/dotnet-aspire-9-release-candidate-1?tabs=windows&pivots=visual-studio#azure](https://learn.microsoft.com/en-us/dotnet/aspire/whats-new/dotnet-aspire-9-release-candidate-1?tabs=windows&pivots=visual-studio#azure) because it has a very detailed explanation. |
|||
|
|||
## ABP Studio |
|||
|
|||
.NET Aspire and [ABP Studio](https://abp.io/studio) are tools for different purposes with different scopes, and they have different approaches to solving problems; many developers may still be confused since they also have some similar functionalities and solve some common problems. You can check the comparison of .NET Aspire and ABP Studio in this [article](https://abp.io/community/articles/.net-aspire-vs-abp-studio-side-by-side-t1c73d1l). |
|||
|
|||
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 55 KiB |
@ -0,0 +1,113 @@ |
|||
# SignalR supports trimming and Native AOT |
|||
|
|||
## What is SignalR? |
|||
|
|||
SignalR is a library that allows you to add real-time web functionality to your applications. It provides a simple API for creating server-to-client remote procedure calls (RPC) that can be called from the server and client. Now SignalR supports trimming and Native AOT in .NET 8.0 and .NET 9.0. You can learn more about [SignalR new features](https://abp.io/community/articles/asp.net-core-signalr-new-features-summary-kcydtdgq) in this article. |
|||
|
|||
## What is trimming and Native AOT? |
|||
|
|||
AOT (Ahead-of-Time) compilation is a feature that allows you to compile your application into native code before running it. This can help improve performance and reduce startup times. Trimming is a feature that allows you to remove unused code from your application, reducing its size and improving performance. You can learn more about [Native AOT Compilation](https://abp.io/community/articles/native-aot-compilation-in-.net-8-oq7qtwov) in this article. |
|||
|
|||
## How to use SignalR with trimming and Native AOT? |
|||
|
|||
You can create ASP.NET Core AOT application with using the following command: |
|||
|
|||
```bash |
|||
dotnet new webapiaot -n Acme.Sample |
|||
``` |
|||
|
|||
The created application uses `CreateSlimBuilder` method to create minimal builder for the application. You can use `CreateBuilder` method to create a builder with all the services registered. However, deploying an application with `CreateSlimBuilder` method is more convenient because it reduces the size of the application. You can learn more about [CreateSlimBuilder vs CreateBuilder](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot#createslimbuilder-vs-createbuilder). |
|||
|
|||
Replace the `Program.cs` file with the following code: |
|||
|
|||
```csharp |
|||
using Microsoft.AspNetCore.SignalR; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
var builder = WebApplication.CreateSlimBuilder(args); |
|||
|
|||
builder.Services.AddSignalR(); |
|||
builder.Services.Configure<JsonHubProtocolOptions>(o => |
|||
{ |
|||
o.PayloadSerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default); |
|||
}); |
|||
|
|||
var app = builder.Build(); |
|||
|
|||
app.MapHub<ChatHub>("/chatHub"); |
|||
app.MapGet("/", () => Results.Content(""" |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<title>SignalR Chat</title> |
|||
</head> |
|||
<body> |
|||
<input id="userInput" placeholder="Enter your name" /> |
|||
<input id="messageInput" placeholder="Type a message" /> |
|||
<button onclick="sendMessage()">Send</button> |
|||
<ul id="messages"></ul> |
|||
|
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/microsoft-signalr/8.0.7/signalr.min.js"></script> |
|||
<script> |
|||
const connection = new signalR.HubConnectionBuilder() |
|||
.withUrl("/chatHub") |
|||
.build(); |
|||
|
|||
connection.on("ReceiveMessage", (user, message) => { |
|||
const li = document.createElement("li"); |
|||
li.textContent = `${user}: ${message}`; |
|||
document.getElementById("messages").appendChild(li); |
|||
}); |
|||
|
|||
async function sendMessage() { |
|||
const user = document.getElementById("userInput").value; |
|||
const message = document.getElementById("messageInput").value; |
|||
await connection.invoke("SendMessage", user, message); |
|||
} |
|||
|
|||
connection.start().catch(err => console.error(err)); |
|||
</script> |
|||
</body> |
|||
</html> |
|||
""", "text/html")); |
|||
|
|||
app.Run(); |
|||
|
|||
[JsonSerializable(typeof(string))] |
|||
internal partial class AppJsonSerializerContext : JsonSerializerContext { } |
|||
|
|||
public class ChatHub : Hub |
|||
{ |
|||
public async Task SendMessage(string user, string message) |
|||
{ |
|||
await Clients.All.SendAsync("ReceiveMessage", user, message); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
It is a simple chat application that uses SignalR to send and receive messages. |
|||
|
|||
 |
|||
|
|||
Before deploying the application, ensure that **Desktop development with C++** is installed on your machine if you're using Windows OS. For more details, you can check the [pre-requisites](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot#prerequisites). |
|||
|
|||
You can deploy the application with the following command: |
|||
|
|||
```bash |
|||
dotnet publish -c Release |
|||
``` |
|||
|
|||
### Limitations |
|||
|
|||
Since we are using Native AOT, there are some limitations that you should be aware of: |
|||
|
|||
- **Only the JSON protocol is supported**: For the payload serialization in SignalR, only the JSON protocol is supported. You need to configure the `JsonHubProtocolOptions` to use the `AppJsonSerializerContext` for serialization/deserialization. |
|||
- **Reflection**: Native AOT does not support reflection. You need to use the `JsonSerializable` attribute to specify the types that should be serialized/deserialized. In this example, we have used the `JsonSerializable` attribute for the `string` type in the `AppJsonSerializerContext` class. |
|||
|
|||
For more details, you can check the [limitations](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot#limitations-of-native-aot-deployment) of Native AOT. |
|||
|
|||
## Conclusion |
|||
|
|||
In this article, we learned how to use SignalR with trimming and Native AOT in .NET 8.0 and .NET 9.0. We created a simple chat application that uses SignalR to send and receive messages. We also discussed the limitations of using Native AOT and how to overcome them. |
|||
|
|||
For more information, you can refer to the [Microsoft's official document](https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-9.0?view=aspnetcore-9.0#signalr-supports-trimming-and-native-aot). |
|||
|
After Width: | Height: | Size: 31 KiB |
@ -0,0 +1,58 @@ |
|||
# Middleware Now Supports Keyed Dependency Injection in .NET 9 |
|||
|
|||
This article explores a new feature in .NET 9 that enables keyed dependency injection in middleware. Previously, .NET 8 introduced keyed services, which allowed developers to register multiple instances of the same service type with distinct keys. Now, .NET 9 extends this feature to middleware, making it easier to inject specific services within the middleware based on defined keys. For more details, see this [overview on the .NET blog](https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/rc1/aspnetcore.md#keyed-di-in-middleware). |
|||
|
|||
## What is Keyed Dependency Injection? |
|||
|
|||
Keyed dependency injection is a technique for registering multiple service versions with unique identifiers, or “keys.” This approach is especially helpful when multiple implementations of the same service are required in different contexts. For example, you may have various logging services but want to inject a specific logger based on the application’s current needs. By using keys, developers can ensure that the appropriate service version is injected precisely where it’s needed. |
|||
|
|||
## Using Keyed Dependency Injection in Middleware |
|||
|
|||
In .NET 9, developers can now use keyed dependency injection directly in middleware. Keyed services can be injected through the middleware constructor or via the `Invoke`/`InvokeAsync` methods, allowing for straightforward and flexible control of service instances in middleware components. Here’s an example of how to configure and use keyed dependency injection in middleware: |
|||
|
|||
```csharp |
|||
var builder = WebApplication.CreateBuilder(args); |
|||
|
|||
// Register services with unique keys |
|||
builder.Services.AddKeyedSingleton<MySingletonClass>("test"); |
|||
builder.Services.AddKeyedScoped<MyScopedClass>("test2"); |
|||
|
|||
var app = builder.Build(); |
|||
app.UseMiddleware<MyMiddleware>(); |
|||
app.Run(); |
|||
|
|||
internal class MyMiddleware |
|||
{ |
|||
private readonly RequestDelegate _next; |
|||
private readonly MySingletonClass _singletonService; |
|||
|
|||
// Constructor injection with key |
|||
public MyMiddleware(RequestDelegate next, [FromKeyedServices("test")] MySingletonClass singletonService) |
|||
{ |
|||
_next = next; |
|||
_singletonService = singletonService; |
|||
} |
|||
|
|||
// Invoke method with additional scoped service injection using key |
|||
public Task Invoke(HttpContext context, [FromKeyedServices("test2")] MyScopedClass scopedService) |
|||
{ |
|||
// Middleware logic here |
|||
return _next(context); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
In this example: |
|||
- `MySingletonClass` and `MyScopedClass` are registered with unique keys (`"test"` and `"test2"`). |
|||
- These services are injected into the middleware through both the constructor and `Invoke` method, based on their respective keys. |
|||
|
|||
This approach allows developers to manage which service instances are available within middleware precisely. |
|||
|
|||
## Conclusion |
|||
|
|||
Keyed dependency injection in middleware is a significant addition in .NET 9. It provides developers with more control over which services are injected based on specific keys. This enhancement enables selective service injection in middleware scenarios, allowing for more modular and maintainable applications. |
|||
|
|||
## References |
|||
|
|||
- [.NET 9 Release Notes](https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/rc1/aspnetcore.md#keyed-di-in-middleware) |
|||
- [Dependency Injection and Keyed Services](https://learn.microsoft.com/aspnet/core/fundamentals/dependency-injection#keyed-services) |
|||
@ -1,22 +1,26 @@ |
|||
# Optimizing Your Application for Production Environments |
|||
|
|||
ABP and the startup solution templates are configured well to get the maximum performance on production environments. However, there are still some points you need to pay attention to in order to optimize your system in production. In this document, we will mention some of these topics. |
|||
ABP and the startup solution templates are configured well to get the maximum performance on production environments. |
|||
However, you still need to pay attention to some points to optimize your system in production. |
|||
This document will explain optimization points for the production environment. |
|||
|
|||
## Caching Static Contents |
|||
|
|||
The following items are contents that can be cached in the client side (typically in the Browser) or in a CDN server: |
|||
The following items are contents that can be cached on the client side (typically in the Browser) or in a CDN server: |
|||
|
|||
* **Static images** can always be cached. Here, you should be careful that if you change an image, use a different file name, or use a versioning query-string parameter, so the browser (or CDN) understands it's been changed. |
|||
* **CSS and JavaScript files**. ABP's [bundling & minification](../framework/ui/mvc-razor-pages/bundling-minification.md) system always uses a query-string versioning parameter and a hash value in the files names of the CSS & JavaScript files for the [MVC (Razor Pages)](../framework/ui/mvc-razor-pages/overall.md) UI. So, you can safely cache these files in the client side or in a CDN server. |
|||
* **Static images** can always be cached. Here, you should be careful that if you change an image, use a different file name, or use a versioning query-string parameter so the browser (or CDN) understands it's been changed. |
|||
* **CSS and JavaScript files**. ABP's [bundling & minification](../framework/ui/mvc-razor-pages/bundling-minification.md) system always uses a query-string versioning parameter and a hash value in the files names of the CSS & JavaScript files for the [MVC (Razor Pages)](../framework/ui/mvc-razor-pages/overall.md) UI. So you can safely cache these files on the client side or on a CDN server. |
|||
* **Application bundle files** of an [Angular UI](../framework/ui/angular/quick-start.md) application. |
|||
* **[Application Localization Endpoint](../framework/api-development/standard-apis/localization.md)** can be cached per culture (it already has a `cultureName` query string parameter) if you don't use dynamic localization on the server-side. ABP's [Language Management](https://abp.io/modules/Volo.LanguageManagement) module provides dynamic localization. If you're using it, you can't cache that endpoint forever. However, you can still cache it for a while. Applying dynamic localization text changes to the application can delay for a few minutes, even for a few hours in a real life scenario. |
|||
* **[Application Localization Endpoint](../framework/api-development/standard-apis/localization.md)** can be cached per culture (it already has a `cultureName` query string parameter) if you don't use dynamic localization on the server-side. ABP's [Language Management](https://abp.io/modules/Volo.LanguageManagement) module provides dynamic localization. If you're using it, you can't cache that endpoint forever. However, you can still cache it for a while. Applying dynamic localization text changes to the application can delay a few minutes, even a few hours, in a real-life scenario. |
|||
|
|||
There may be more ways based on your solution structure and deployment environment, but these are the essential points you should consider to client-side cache in a production environment. |
|||
There may be more ways based on your solution structure and deployment environment, but these are the essential points you should consider for client-side cache in a production environment. |
|||
|
|||
## Bundling & Minification for MVC (Razor Pages) UI |
|||
|
|||
ABP's [bundling & minification](../framework/ui/mvc-razor-pages/bundling-minification.md) system automatically bundles, minifies and versions your CSS and JavaScript files in production environment. Normally, you don't need to do anything, if you haven't disabled it yourself in your application code. It is important to follow the [bundling & minification](../framework/ui/mvc-razor-pages/bundling-minification.md) document and truly use the system to get the maximum optimization. |
|||
ABP's [bundling & minification](../framework/ui/mvc-razor-pages/bundling-minification.md) system automatically bundles, minifies and versions your CSS and JavaScript files in the production environment. |
|||
Normally, you don't need to do anything if you have not disabled it yourself in your application code. |
|||
It is important to follow the [bundling & minification](../framework/ui/mvc-razor-pages/bundling-minification.md) document and truly use the system to get the maximum optimization. |
|||
|
|||
## Background Jobs |
|||
|
|||
ABP's [Background Jobs](../framework/infrastructure/background-jobs) system provides an abstraction with a basic implementation to enqueue jobs and execute them in a background thread. ABP's Default Background Job Manager may not be enough if you are adding too many jobs to the queue and want them to be executed in parallel by multiple servers with a high performance. If you need these, you should consider to configure a dedicated background job software, like [Hangfire](https://www.hangfire.io/). ABP has a pre-built [Hangfire integration](../framework/infrastructure/background-jobs/hangfire.md), so you can switch to Hangfire without changing your application code. |
|||
ABP's [Background Jobs](../framework/infrastructure/background-jobs) system provides an abstraction with a basic implementation to enqueue jobs and execute them in a background thread. ABP's Default Background Job Manager may not be enough if you are adding too many jobs to the queue and want them to be executed in parallel by multiple servers with a high performance. If you need these, you should consider configuring a dedicated background job software, like [Hangfire](https://www.hangfire.io/). ABP has a pre-built [Hangfire integration](../framework/infrastructure/background-jobs/hangfire.md), so you can switch to Hangfire without changing your application code. |
|||
|
|||
@ -0,0 +1,143 @@ |
|||
# Entity Filters |
|||
|
|||
Every CRUD page includes some sort of inputs to filter the listed data. Some of the inputs are common among all of the entities like the `Search` box. In addition, every entity has its own advanced filters depending on its fields. To reduce the amount of code written on every CRUD page, the Angular UI of ABP Commercial introduces a new type of component called `abp-advanced-entity-filters` |
|||
|
|||
## Setup |
|||
|
|||
The components are in the _@volo/abp.commercial.ng.ui_ package, which is included in the ABP templates. So, as long as your project is a product of these templates and unless you delete the package, you have access to the entity filter components. |
|||
You can either import the `CommercialUiModule` which contains other components as well as `AdvancedEntityFilters` or you can directly import the `AdvancedEntityFiltersModule` if you do not need other components. Here is how you import them in your Angular module: |
|||
|
|||
```javascript |
|||
import { |
|||
CommercialUiModule, |
|||
AdvancedEntityFiltersModule, |
|||
} from "@volo/abp.commercial.ng.ui"; |
|||
|
|||
@NgModule({ |
|||
imports: [ |
|||
// other imports |
|||
CommercialUiModule, |
|||
|
|||
// OR |
|||
|
|||
AdvancedEntityFiltersModule, |
|||
], |
|||
// rest of the module metadata |
|||
}) |
|||
export class YourModule {} |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
Let's take a look at the `Users` page from the `Identity` module. |
|||
|
|||
 |
|||
|
|||
As shown in the screenshot, `abp-advanced-entity-filters` usually contain two parts, an entity filter (common among entities), i.e. `abp-entity-filter`, and entity-specific filters which are encapsulated within the `abp-advanced-entity-filters-form` component. |
|||
|
|||
`users.component.html` |
|||
|
|||
```html |
|||
<abp-advanced-entity-filters [list]="list" localizationSourceName="AbpIdentity"> |
|||
<abp-advanced-entity-filters-form> |
|||
<form #filterForm (keyup.enter)="list.get()"> |
|||
<div class="row"> |
|||
<!-- Form elements are omitted --> |
|||
|
|||
<div class="col-12 col-sm-auto align-self-end mb-3"> |
|||
<div class="row"> |
|||
<div class="col-6 col-sm-auto d-grid"> |
|||
<button |
|||
type="button" |
|||
class="btn btn-outline-primary" |
|||
(click)="clearFilters()" |
|||
> |
|||
<span>{%{{{ 'AbpUi::Clear' | abpLocalization }}}%}</span> |
|||
</button> |
|||
</div> |
|||
<div class="col-6 col-sm-auto d-grid"> |
|||
<button |
|||
type="button" |
|||
class="btn btn-primary" |
|||
(click)="list.get()" |
|||
> |
|||
<span>{%{{{ 'AbpUi::Refresh' | abpLocalization }}}%}</span> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</abp-advanced-entity-filters-form> |
|||
</abp-advanced-entity-filters> |
|||
``` |
|||
|
|||
The `abp-advanced-entity-filters` already contains the `abp-entity-filter` component so you do not need to pass it. However, the `abp-entity-filter` component needs an instance of `ListService` which is usually stored in the `list` field of the page. You can also change the placeholder of the component via `entityFilterPlaceholder` input which is passed into the `abpLocalization` pipe so that it uses the translated text. Default is `'AbpUi::PagerSearch'` |
|||
|
|||
E.g |
|||
|
|||
```html |
|||
<abp-advanced-entity-filters |
|||
[list]="list" |
|||
entityFilterPlaceholder="AbpUi::PagerSearch" |
|||
> |
|||
<!-- ... --> |
|||
</abp-advanced-entity-filters> |
|||
``` |
|||
|
|||
### Inputs |
|||
|
|||
- `list`: an instance of `ListService` |
|||
- `entityFilterPlaceholder`: the placeholder of `abp-entity-filter` component. Default: `'AbpUi::PagerSearch'` |
|||
- `localizationSourceName`: the localization source of the current page. E.g: `AbpIdentity` |
|||
|
|||
### Inner components |
|||
|
|||
Some entities are simple and do not require any filter other than the `abp-entity-filter`. In this case, you can simply use the `abp-advanced-entity-filters` without anything in between. |
|||
|
|||
E.g. |
|||
|
|||
Let's remove `form` from the `Users` page |
|||
|
|||
```html |
|||
<abp-advanced-entity-filters [list]="list" localizationSourceName="AbpIdentity"> |
|||
</abp-advanced-entity-filters> |
|||
``` |
|||
|
|||
 |
|||
|
|||
If your component needs other filters, you can pass your own `form` within the `abp-advanced-entity-filters-form` component. This will render your form as well as a toggle (`abp-advanced-entity-filters-toggle`) to show and hide the form |
|||
|
|||
E.g. |
|||
|
|||
```html |
|||
<abp-advanced-entity-filters [list]="list" localizationSourceName="AbpIdentity"> |
|||
<abp-advanced-entity-filters-form> |
|||
<form> |
|||
<!-- Content is omitted for sake of simplicity --> |
|||
</form> |
|||
</abp-advanced-entity-filters-form> |
|||
</abp-advanced-entity-filters> |
|||
``` |
|||
|
|||
 |
|||
|
|||
Last but not least, if you need to render some content above the `abp-entity-filter` component, you can use the `abp-advanced-entity-filters-above-search`. |
|||
|
|||
E.g. |
|||
|
|||
```html |
|||
<abp-advanced-entity-filters [list]="list" localizationSourceName="AbpIdentity"> |
|||
<abp-advanced-entity-filters-above-search> |
|||
<h3>Custom Content above entity-filter</h3> |
|||
</abp-advanced-entity-filters-above-search> |
|||
|
|||
<abp-advanced-entity-filters-form> |
|||
<form> |
|||
<!-- Content is omitted for sake of simplicity --> |
|||
</form> |
|||
</abp-advanced-entity-filters-form> |
|||
</abp-advanced-entity-filters> |
|||
``` |
|||
|
|||
 |
|||