@ -0,0 +1,44 @@ |
|||
name: Create Release |
|||
|
|||
on: |
|||
workflow_dispatch: |
|||
inputs: |
|||
tag_name: |
|||
description: 'Tag Name' |
|||
required: true |
|||
prerelease: |
|||
description: 'Pre-release?' |
|||
required: true |
|||
branchName: |
|||
description: 'Branch Name' |
|||
required: true |
|||
|
|||
jobs: |
|||
build: |
|||
runs-on: ubuntu-latest |
|||
steps: |
|||
- name: Checkout code |
|||
uses: actions/checkout@v2 |
|||
with: |
|||
ref: ${{ github.event.inputs.branchName }} |
|||
|
|||
- name: Create Release |
|||
id: create_release |
|||
uses: actions/create-release@v1 |
|||
env: |
|||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
|||
with: |
|||
tag_name: ${{ github.event.inputs.tag_name }} |
|||
release_name: ${{ github.event.inputs.tag_name }} |
|||
draft: false |
|||
prerelease: ${{ github.event.inputs.prerelease }} |
|||
|
|||
- name: Checkout code at tag |
|||
uses: actions/checkout@v2 |
|||
with: |
|||
ref: ${{ github.event.inputs.tag_name }} |
|||
|
|||
- name: Build Project |
|||
run: | |
|||
# add your build commands here, depending on your project's requirements. |
|||
echo "Build project here" |
|||
@ -0,0 +1,131 @@ |
|||
## ℹ️ Description |
|||
This package is a part of the [ABP Framework](https://abp.io). |
|||
|
|||
### ABP — Open Source Web Application Framework for ASP.NET Core |
|||
ABP offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET and the ASP.NET Core platforms. ABP Framework is a complete open-source infrastructure to create modern web applications by following the best practices and conventions of software development. It provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation. |
|||
|
|||
|
|||
### For more information, check out the below links: |
|||
|
|||
🔗Official Website: https://abp.io |
|||
|
|||
🔗GitHub Repository: https://github.com/abpframework/abp |
|||
|
|||
🔗Samples: https://docs.abp.io/en/abp/latest/Samples/Index |
|||
|
|||
🔗Official Theme: https://www.LeptonTheme.com |
|||
|
|||
🔗Documentation: https://docs.abp.io |
|||
|
|||
🔗Community: https://community.abp.io |
|||
|
|||
🔗Blog: https://blog.abp.io |
|||
|
|||
🔗Books: https://abp.io/books |
|||
|
|||
🔗Twitter: https://twitter.com/abpframework |
|||
|
|||
🔗Discord: https://community.abp.io/discord |
|||
|
|||
🔗Stackoverflow: https://stackoverflow.com/questions/tagged/abp |
|||
|
|||
🔗YouTube: https://www.youtube.com/@Volosoft |
|||
|
|||
|
|||
## 🚀 Key Features of the ABP Framework |
|||
|
|||
🟡 Modularity |
|||
|
|||
🟡 Multi-Tenancy |
|||
|
|||
🟡 Bootstrap Tag Helpers |
|||
|
|||
🟡 Dynamic Forms |
|||
|
|||
🟡 Authentication |
|||
|
|||
🟡 Authorization |
|||
|
|||
🟡 Distributed Event Bus |
|||
|
|||
🟡 BLOB Storing |
|||
|
|||
🟡 Text Templating |
|||
|
|||
🟡 Tooling: ABP CLI |
|||
|
|||
🟡 Cross-Cutting Concerns |
|||
|
|||
🟡 Bundling & Minification |
|||
|
|||
🟡 Virtual File System |
|||
|
|||
🟡 Theming |
|||
|
|||
🟡 Background Jobs |
|||
|
|||
🟡 DDD Infrastructure |
|||
|
|||
🟡 Auto REST APIs |
|||
|
|||
🟡 Dynamic Client Proxies |
|||
|
|||
🟡 Multiple Database Providers |
|||
|
|||
🟡 Data filtering |
|||
|
|||
🟡 Test Infrastructure |
|||
|
|||
🟡 Audit Logging |
|||
|
|||
🟡 Object to Object Mapping |
|||
|
|||
🟡 Email & SMS Abstractions |
|||
|
|||
🟡 Localization |
|||
|
|||
🟡 Setting Management |
|||
|
|||
🟡 Extension Methods |
|||
|
|||
🟡 Aspect Oriented Programming |
|||
|
|||
🟡 Dependency Injection |
|||
|
|||
|
|||
### 📘 Supported Database Providers |
|||
|
|||
🔵 Entity Framework Core |
|||
|
|||
🔵 MongoDB |
|||
|
|||
🔵 Dapper |
|||
|
|||
|
|||
### 🎴 Supported UI Frameworks |
|||
|
|||
🔵 Angular |
|||
|
|||
🔵 Razor Pages |
|||
|
|||
🔵 Blazor Web Assembly |
|||
|
|||
🔵 Blazor Server |
|||
|
|||
🔵 MAUI with Blazor Hybrid |
|||
|
|||
|
|||
## 📫 Bug & Support |
|||
|
|||
Support for open-source ABP Framework client-side packages is available at [GitHub Issues](https://github.com/abpframework/abp/issues). |
|||
|
|||
|
|||
## 🏦 Go Commercial |
|||
|
|||
If you are building an enterprise-level application with pro support, extra tools like a code generator, fancy themes and a microservice template, time to invest in the commercial version! |
|||
|
|||
To understand how it works, see [How it Works]( https://commercial.abp.io/how-it-works) page. |
|||
|
|||
If you wonder why you should choose ABP Commercial, check out [Why ABP.IO Platform](https://docs.abp.io/en/commercial/latest/why-abp-io-platform) page. |
|||
|
|||
Official website: [https://commercial.abp.io](https://commercial.abp.io/) |
|||
@ -0,0 +1,267 @@ |
|||
# ABP.IO Platform 7.3 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.3 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.3! Thanks to all of you. |
|||
|
|||
## Get Started with the 7.3 RC |
|||
|
|||
Follow the steps below to try version 7.3.0 RC today: |
|||
|
|||
1) **Upgrade** the ABP CLI to version `7.3.0-rc.1` using a command line terminal: |
|||
|
|||
````bash |
|||
dotnet tool update Volo.Abp.Cli -g --version 7.3.0-rc.1 |
|||
```` |
|||
|
|||
**or install** it if you haven't before: |
|||
|
|||
````bash |
|||
dotnet tool install Volo.Abp.Cli -g --version 7.3.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.2: |
|||
|
|||
* [ABP Framework 7.2 to 7.3 Migration Guide](https://docs.abp.io/en/abp/7.3/Migration-Guides/Abp-7_3) |
|||
|
|||
> If you are using the CMS Kit or CMS Kit Pro module, please don't forget to create a new migration and apply it to your database. |
|||
|
|||
## What's New with ABP Framework 7.3? |
|||
|
|||
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: |
|||
|
|||
* Introducing the Volo.Abp.Imaging packages |
|||
* ABP CLI: switch-to-local command |
|||
* Monitoring Distributed Events |
|||
* Ordering of the Local Event Handlers |
|||
* Nonce attribute support for Content Security Policy (CSP) |
|||
* Other News |
|||
|
|||
### Introducing the Volo.Abp.Imaging packages |
|||
|
|||
ABP Framework provides some packages to compress and resize images. Currently, there are four official packages: |
|||
|
|||
* `Volo.Abp.Imaging.Abstractions`: Provides common services for compression and resizing purposes. |
|||
* `Volo.Abp.Imaging.AspNetCore`: Provides some attributes for controller actions that can automatically compress and/or resize uploaded files. |
|||
* `Volo.Abp.Imaging.ImageSharp`: Implements the image compression & resize operations using the [ImageSharp](https://github.com/SixLabors/ImageSharp) library. |
|||
* `Volo.Abp.Imaging.MagickNet`: Implements the image compression & resize operations using the [Magick.NET](https://github.com/dlemstra/Magick.NET) library. |
|||
|
|||
You can use one of these official providers (`ImageSharp` or `Magick.NET`) or implement your own image resizer/compressor contributor and use it in your application. |
|||
|
|||
> See the [Image Manipulation](https://docs.abp.io/en/abp/7.3/Image-Manipulation) documentation to learn more and see the required configurations. |
|||
|
|||
### ABP CLI: switch-to-local command |
|||
|
|||
In this version, ABP CLI introduces a new CLI command: **"switch-to-local"**. The `switch-to-local` command changes all NuGet package references on a solution to local project references for all the `.csproj` files in the specified folder (and all its subfolders with any depth). |
|||
|
|||
**Usage:** |
|||
|
|||
```bash |
|||
abp switch-to-local --paths "C:\Github\abp" |
|||
``` |
|||
|
|||
### Monitoring Distributed Events |
|||
|
|||
ABP Framework allows you to stay informed when your application **receives** or **sends** a distributed event. This enables you to track the event flow within your application and take appropriate actions based on the received or sent distributed events. |
|||
|
|||
You just need to subscribe to one of the `DistributedEventReceived` or `DistributedEventSent` events and take additional actions according to your cases. |
|||
|
|||
**Example: Get informed when your application sends an event to the distributed event bus** |
|||
|
|||
```csharp |
|||
public class DistributedEventSentHandler : ILocalEventHandler<DistributedEventSent>, ITransientDependency |
|||
{ |
|||
public async Task HandleEventAsync(DistributedEventSent eventData) |
|||
{ |
|||
// TODO: IMPLEMENT YOUR LOGIC... |
|||
} |
|||
} |
|||
``` |
|||
|
|||
> See the documentation to learn more: [https://docs.abp.io/en/abp/7.3/Distributed-Event-Bus](https://docs.abp.io/en/abp/7.3/Distributed-Event-Bus) |
|||
|
|||
### Ordering of the Local Event Handlers |
|||
|
|||
In this version, ABP Framework introduces the `LocalEventHandlerOrder` attribute, which can be used to set the execution order for the event handlers. This can be helpful if you want to handle your local event handlers in a specific order. |
|||
|
|||
**Example:** |
|||
|
|||
```csharp |
|||
[LocalEventHandlerOrder(-1)] |
|||
public class MyHandler |
|||
: ILocalEventHandler<StockCountChangedEvent>, |
|||
ITransientDependency |
|||
{ |
|||
public async Task HandleEventAsync(StockCountChangedEvent eventData) |
|||
{ |
|||
//TODO: your implementation |
|||
} |
|||
} |
|||
``` |
|||
|
|||
By default, all event handlers have an order value of 0. Thus, if you want to take certain event handlers to be executed before other event handlers, you can set the order value as a negative value. |
|||
|
|||
> See the documentation to learn more: [https://docs.abp.io/en/abp/7.3/Local-Event-Bus](https://docs.abp.io/en/abp/7.3/Local-Event-Bus) |
|||
|
|||
### Nonce attribute support for Content Security Policy (CSP) |
|||
|
|||
ABP Framework supports adding unique value to nonce attribute for script tags which can be used by Content Security Policy to determine whether or not a given fetch will be allowed to proceed for a given element. In other words, it provides a mechanism to execute only correct script tags with the correct nonce value. |
|||
|
|||
This feature is disabled by default. You can enable it by setting the *UseContentSecurityPolicyScriptNonce* property of the `AbpSecurityHeadersOptions` class to **true**: |
|||
|
|||
```csharp |
|||
Configure<AbpSecurityHeadersOptions>(options => |
|||
{ |
|||
//adding script-src nonce |
|||
options.UseContentSecurityPolicyScriptNonce = true; //false by default |
|||
}); |
|||
``` |
|||
|
|||
> See the [Security Headers](https://docs.abp.io/en/abp/7.3/UI/AspNetCore/Security-Headers) documentation for more information. |
|||
|
|||
### Other News |
|||
|
|||
* Upgraded the [Blazorise](https://blazorise.com/) library to v1.2.3 for Blazor UI. After the upgrade, ensure that all Blazorise-related packages are using v1.2.3 in your application. |
|||
* Module Entity Extension support has been added for the CMS Kit module. See [#16572](https://github.com/abpframework/abp/issues/16572) for more information. |
|||
|
|||
If you want to see more details, you can check [the release on GitHub](https://github.com/abpframework/abp/releases/tag/5.3.0-rc.1), which contains a list of all the issues and pull requests were closed with this version. |
|||
|
|||
## What's New with ABP Commercial 7.3? |
|||
|
|||
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 a few new features coming with ABP Commercial 7.3. |
|||
|
|||
### Account Module - Using Authenticator App for Two-Factor Authentication |
|||
|
|||
In this version, ABP Commercial provides a new **Two-Factor Authentication (2FA) provider** that allows you to log in to an application by scanning a QR Code with an Authenticator App, such as Microsoft Authenticator or Google Authenticator. |
|||
|
|||
You need to apply the following actions to configure an Authenticator and then you are free to log in by using the Authenticator App: |
|||
|
|||
**Step 1 - Enable Two Factor Authentication and Scan the QR Code:** |
|||
|
|||
 |
|||
|
|||
**Step 2 - Verify the QR Code with an authenticator app:** |
|||
|
|||
 |
|||
|
|||
**Step 3 - Save the recovery codes for later use in case of not being able to login by verifying the QR code:** |
|||
|
|||
 |
|||
|
|||
You can disable the two-factor authentication and reset the Authenticator App anytime you want, just by disabling the two-factor authentication or resetting the authenticator: |
|||
|
|||
 |
|||
|
|||
### Upgrade Blazorise to v1.2.3 |
|||
|
|||
Upgraded the [Blazorise](https://blazorise.com/) library to v1.2.3 for Blazor UI. If you are upgrading your project to v7.3.0, please ensure that all the Blazorise-related packages are using v1.2.3 in your application. Otherwise, you might get errors due to incompatible versions. |
|||
|
|||
### CMS Kit: Module Entity Extensions |
|||
|
|||
Module entity extension system is a high-level extension system that allows you to define new properties for existing entities of the dependent modules. ABP Framework and ABP Commercial use this system to allow developers to extend entities in different modules. |
|||
|
|||
In this version, Module Entity Extension support has been added for the CMS Kit Pro module. |
|||
|
|||
You can open the `YourProjectNameModuleExtensionConfigurator` class inside the `Domain.Shared` project of your solution and change the `ConfigureExtraProperties` method as shown below to add a new property to the `Poll` entity of the [CMS Kit Pro module](https://docs.abp.io/en/commercial/latest/modules/cms-kit/index): |
|||
|
|||
```csharp |
|||
public static void ConfigureExtraProperties() |
|||
{ |
|||
OneTimeRunner.Run(() => |
|||
{ |
|||
ObjectExtensionManager.Instance.Modules() |
|||
.ConfigureCmsKitPro(cmsKitPro => |
|||
{ |
|||
cmsKitPro.ConfigurePoll(poll => |
|||
{ |
|||
poll.AddOrUpdateProperty<string>( |
|||
"<property-name>", |
|||
property => |
|||
{ |
|||
//configuration for this property |
|||
} |
|||
) |
|||
}); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
``` |
|||
|
|||
> See the [Module Entity Extensions documentation](https://docs.abp.io/en/abp/latest/Module-Entity-Extensions) to learn more. |
|||
|
|||
### LeptonX Account Layout |
|||
|
|||
In this version, Account Layout has been re-designed for LeptonX Theme. You can see the new account layout in the following figure: |
|||
|
|||
 |
|||
|
|||
> To use this new account layout, ensure that your LeptonX Theme package versions are v2.3+. |
|||
|
|||
## Community News |
|||
|
|||
### ABP Community Talks 2023.4: Angular 16 and ABP v7.3 |
|||
|
|||
 |
|||
|
|||
In this episode, the core ABP team talked about what's new with ABP v7.3 and Angular 16. You can watch the event from [here](https://www.youtube.com/watch?v=lq6u4vQURcI). |
|||
|
|||
### ABP .NET Conference 2023 |
|||
|
|||
 |
|||
|
|||
We organized ABP .NET Conference 2023 on May 2023 and we are happy to share the success of the conference, which captivated overwhelmingly interested live viewers from all over the world. 13 great line up of speakers which includes .NET experts and Microsoft MVPs delivered captivating talks that resonated with the audiences. Each of the talks attracted a great amount of interest and a lot of questions, sparking curiosity in the attendees. |
|||
|
|||
Thanks to all speakers and attendees for joining our event. |
|||
|
|||
> We shared our takeaways in a blog post, which you can read at [https://blog.abp.io/abp/ABP-.NET-Conference-2023-Wrap-Up](https://blog.abp.io/abp/ABP-.NET-Conference-2023-Wrap-Up). |
|||
|
|||
### Volosoft Attendeed & Sponsored Devnot .NET Conference 2023 |
|||
|
|||
 |
|||
|
|||
We are thrilled to announce that the Volosoft Company proudly attended as one of the Gold Sponsors at the Devnot .NET Conference 2023! We are happy to join and be a sponsor of events and contribute to the software society, empowering developers and driving innovation with the .NET community. |
|||
|
|||
 |
|||
|
|||
Co-Founder of [Volosoft](https://volosoft.com/) and Lead Developer of the ABP Framework, [Halil Ibrahim Kalkan](https://twitter.com/hibrahimkalkan) gave a word about "Dealing with Concurrency and Multi Threading in .NET" at this event. |
|||
|
|||
> You can check [this blog post](https://volosoft.com/blog/Reflecting-on-Devnot-Dotnet-Conference-2023) if you want to learn more about the Devnot .NET Conference 2023. |
|||
|
|||
### New ABP Community Posts |
|||
|
|||
There are exciting articles contributed by the ABP community as always. I will highlight some of them here: |
|||
|
|||
* [Authority Delegation in ABP Commercial](https://community.abp.io/posts/authority-delegation-in-abp-commercial-3wtljpp0) by [Liang Shiwei](https://github.com/realLiangshiwei) |
|||
* [What's new in Angular 16? New Features and Updates](https://community.abp.io/posts/whats-new-in-angular-16-new-features-and-updates-s1izi9br) by [Masum Ulu](https://twitter.com/masumulu) |
|||
* [Kubernetes Integrated Microservice Development with ABP Studio](https://community.abp.io/videos/kubernetes-integrated-microservice-development-with-abp-studio-oix9zkp8) by [Halil Ibrahim Kalkan](https://twitter.com/hibrahimkalkan) |
|||
|
|||
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. |
|||
|
|||
### New ABP Blog Posts |
|||
|
|||
There are also some exciting blog posts written by the ABP team. You can see the following list for some of those articles: |
|||
|
|||
* [ABP .NET Conference 2023 Wrap Up](https://blog.abp.io/abp/ABP-.NET-Conference-2023-Wrap-Up) by [Bige Beşikçi](https://twitter.com/bigedediki) |
|||
* [Meet Volosoft at the Devnot .NET Conference 2023!](https://volosoft.com/blog/Meet-Volosoft-at-the-Devnot-.NET-Conference-2023) by [Roo Xu](https://github.com/Roo1227) |
|||
|
|||
## 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.3/Road-Map) documentation to learn about the release schedule and planned features for the next releases. Please try ABP v7.3 RC and provide feedback to help us release a more stable version. |
|||
|
|||
Thanks for being a part of this community! |
|||
|
After Width: | Height: | Size: 742 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 234 KiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 691 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 250 KiB |
|
After Width: | Height: | Size: 305 KiB |
|
After Width: | Height: | Size: 421 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 256 KiB |
|
After Width: | Height: | Size: 247 KiB |
@ -0,0 +1,226 @@ |
|||
# Kubernetes Integrated Microservice Development with .NET and ABP Studio |
|||
|
|||
## Abstract |
|||
|
|||
**Microservice architecture** is a quite common approach to build **highly scalable** solutions with a large development team. While there are standard tools, like **Kubernetes**, to deploy, run and scale your microservices, the **development side** is not as mature as that. It is not easy to develop, run and test a single microservice that **depends on** other microservices and services. **Running** a copy of the entire system in the developer's machine is impractical. |
|||
|
|||
In this article, I will introduce an **efficient** way of creating a **development environment** that is well **integrated to Kubernetes**. In this way, you can just run the microservice you are building and let Kubernetes run all your dependencies in your local machine or a remote server. |
|||
|
|||
I will demonstrate the solution by introducing and using a brand new tool for ABP Developers: **ABP Studio**! |
|||
|
|||
>**This article is based on my *[Kubernetes Integrated Microservice Development with ABP Studio](https://www.youtube.com/watch?v=XiPRcIHJ3NE)* talk performed in [ABP Dotnet Conf'23](https://abp.io/conference). You can watch that talk if you would like watching rather than reading.** |
|||
|
|||
## Topics |
|||
|
|||
Let’s start by introducing the main topics I will cover in this article: |
|||
|
|||
* I will begin by defining the **problem**: Why it is hard to prepare a development environment for a microservice development. |
|||
* I will mention and demonstrate how **Microsoft’s Tye project** tries to solve the problem and why it falls short. |
|||
* Then I will introduce the **ABP Studio**, a brand new product for .NET developers, which has an efficient solution for **running multi-application solutions** locally. |
|||
* Finally, I will offer an efficient way of developing such complex solutions locally by **integrating Kubernetes into our development environment**, and demonstrate how ABP Studio automates it for us. |
|||
|
|||
## Difficulties of a Microservice Development Environment |
|||
|
|||
It is important to understand what is the essential problem when we try to set up a development environment for a microservice solution. To understand the main difficulty, let’s see what a microservice solution looks like: |
|||
|
|||
 |
|||
|
|||
A typical microservice solution consists of many components communicating to each other. In this example; |
|||
|
|||
* We have **two applications** for users. One for back-office admin users and one for the end-users of the system, a public website. |
|||
* These applications use dedicated **API Gateways** since we are using the Backend For Frontend pattern here. |
|||
* There is a separate **authentication service** application to login and manage user accounts. |
|||
* Behind the API gateways, we typically have many API applications, called **microservices**. Here, I show only three microservices, but there will be tens of microservices even in a medium-size system. Each of these microservices may have their own databases. |
|||
* The microservices typically **interact** with each other using REST API calls or asynchronous messaging through an event bus service, like RabbitMQ here. |
|||
|
|||
There will be much more **supporting services**, like Redis, Elasticsearch and so on. As you see, we have a lot of independent services and applications interacting with each other in a typical microservice solution. |
|||
|
|||
### How to run a single service locally? |
|||
|
|||
Generally, your responsibility is developing **one or a few of these microservices** or applications, not all of them. For example, you may be responsible for developing or testing the Product microservice: |
|||
|
|||
 |
|||
|
|||
All you want to do is to write your code, then run and test your service if it is correctly working. However, to be able to **develop**, **run**, **test** or **debug** the product microservice, all of the service and infrastructure dependencies need to be running and communicating to each other. |
|||
|
|||
Okay, maybe not all, but most of them are needed. Otherwise, you can not open the application UI, login to the system, add products to basket and place an order to see if it is working properly, or you can not **live debug** your service code in case of trouble. |
|||
|
|||
So, how to make the whole system up and running easily to be able to **focus on developing**, testing and debugging the Product microservice? |
|||
|
|||
## The Project Tye |
|||
|
|||
You are not the only one getting trouble to develop, run, test and debug a microservice solution. Microsoft also thought of it and introduced a tool called the [Project Tye](https://github.com/dotnet/tye). With its own words in their GitHub repository: |
|||
|
|||
> Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. |
|||
|
|||
Tye can **simplify microservices development** by making it easy to run many services with one command, use dependencies in containers, discover addresses of other services using simple conventions. It can also deploy .NET applications to Kubernetes by automatically creating containers for .NET applications and generating Kubernetes manifests with minimal knowledge or configuration. |
|||
|
|||
The deployment part is not mature and they have to do a lot of work. However, the solution runner part works very well. |
|||
|
|||
Tye project consists of three major components: |
|||
|
|||
* A **YAML file** to configure your services |
|||
* A **CLI tool** to run and deploy the solution |
|||
* And a **dashboard** to visualize the running services. |
|||
|
|||
### The tye.yaml file |
|||
|
|||
Tye uses a YAML file to configure your solution. It typically contains many service definitions. There are three type of services can be defined in this YAML file: |
|||
|
|||
* You can add a **.NET Project**, so Tye runs it locally with **dotnet run** |
|||
* You can add a **container definition**, and Tye runs it using **Docker** |
|||
* And an arbitrary **executable application** that can be run using a terminal command |
|||
|
|||
Here, an example content of a `tye.yaml` file: |
|||
|
|||
 |
|||
|
|||
### The Tye CLI |
|||
|
|||
Once you define your YAML file, Tye can run all the services with a single terminal command: **tye run**. It builds all .NET applications before running them. If you specify the **watch parameter**, it watches the changes in your .NET projects, re-builds and runs them when a change happens. There are also [other commands](https://github.com/dotnet/tye/blob/main/docs/reference/commandline/README.md) to build and deploy your solution. |
|||
|
|||
### The Tye Dashboard |
|||
|
|||
The final major component is the Tye Dashboard. With this dashboard, you can see the **list of the services** with their statuses. You can also view their **logs** and open their **UI** with a single click. |
|||
|
|||
A screenshot from the Tye Dashboard: |
|||
|
|||
 |
|||
|
|||
### The Example Microservice Solution |
|||
|
|||
I’ve prepared a microservice solution for demos in this article and I will use the same solution in all demos. Here, an overall diagram of the example solution: |
|||
|
|||
 |
|||
|
|||
We have two web applications, two API Gateways, 5 microservices. 3 of them are shown here: Product, Ordering and Identity microservices. Every microservice has its independent SQL Server database. They communicate through REST API calls and distributed events via RabbitMQ. |
|||
|
|||
### The Project Tye Demo |
|||
|
|||
You can watch my 6-minutes demo to see the Project Tye in action: |
|||
|
|||
<iframe width="560" height="315" src="https://www.youtube.com/embed/S0-z29lMokA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> |
|||
|
|||
[Click here to watch the demo on YouTube](https://www.youtube.com/watch?v=S0-z29lMokA) |
|||
|
|||
### Tye: Shortcomings |
|||
|
|||
The demo shows how the Tye project is useful. However, there are many missing points and problems with the current project state. Let’s talk about them; |
|||
|
|||
* The first problem is that it **starts very slow**, because every time you run it, it builds all the services. It takes more than 1 minute for a solution with only ten services. |
|||
* It currently can run everything in your **local computer**. Even if you want to develop a single service, running tens of services locally consumes your system resources. You need a lot of RAM and CPU if you want to work a large solution locally. |
|||
* The **UI part** is currently very simple. For example, if you want to debug one of your services by running it in Visual Studio, you need to stop all the services, change the YAML file to exclude that service from Tye, then run all the services again. Only after that you can run your service in Visual Studio to debug it as integrated to other services. Obviously this process is not easy and comfortable. |
|||
* We can only see the application logs in the UI. **More insights** about the internals of services would be very helpful. |
|||
* Tye currently has some **partial documents** in its GitHub repository. However, the documentation is far away from being complete. |
|||
* Finally, and most importantly, there is **no active development** on the Tye project on GitHub. It was already an experimental project with its early state, as declared in its GitHub repository. |
|||
|
|||
So, basically, it seems Microsoft has no further interest in this project and you can expect it will be retired in the near future. |
|||
|
|||
## ABP Studio |
|||
|
|||
Okay, now we came to the ABP Studio part. At [Volosoft](https://www.volosoft.com/), we were silently working on the ABP Studio project for more than one year. |
|||
|
|||
ABP Studio is a **cross-platform desktop application** for ABP developers. It is **well integrated** to the ABP Framework and aims to provide a comfortable development environment for you by **automating things**, **providing insights** about your solution, making **develop**, **run** and **deploy** your solutions much easier. |
|||
|
|||
We are planning to release a **beta version** in **Q3 of 2023**. You can expect the following features shipping with the initial release: |
|||
|
|||
* You can **create new ABP solutions** and modules easily with a lot of options. |
|||
* You can easily **install or uninstall modules** to your solution. |
|||
* You can **explore** the fundamental **structures** of your solution or used modules, like entities, repositories, application services, UI pages, HTTP APIs, database tables and much more. |
|||
* You can build **multi-module monolith applications** or distributed microservice solutions by easily adding modules and services into your solution. |
|||
* You can easily **run multiple applications** and services with a single click, just like I demonstrated with the Project Tye. However, it has much more features. |
|||
* You can run your service by **integrating** it into a **Kubernetes** cluster, so you don’t need to run all your dependencies and all other services in your local development environment. This is the essential topic of this talk and I will later demonstrate how it works. |
|||
|
|||
## ABP Studio Solution Runner |
|||
|
|||
I've prepared a demo of the ABP Studio Solution Runner, but first I want to mention the main features of the solution runner: |
|||
|
|||
* First of all, it can run one, **multiple** or **all services** with a single click. In this way, it is very easy to stop a service, run it in Visual Studio to **test** or **debug**. |
|||
* All the services are **connected to ABP Studio** and send their internal data to **visualize** on the ABP Studio UI. |
|||
* In the **overall view**, you can see a list of services, view **real-time** HTTP Request and exception counts for each service. |
|||
* You can see all details of all **HTTP requests** coming to any service. |
|||
* You can see **exception details** as real-time in any service, easily filter and search. |
|||
* Just like Tye, you can see the **application logs**. But as more, you can filter logs by log level or search in the log texts. |
|||
* Last but not least, ABP Studio has an **integrated Chrome browser** inside it. You can browse the UI of your application without leaving the solution runner. |
|||
|
|||
### ABP Studio Solution Runner Demo |
|||
|
|||
You can watch my 9-minutes demo to see ABP Studio Solution Runner in action: |
|||
|
|||
<iframe width="560" height="315" src="https://www.youtube.com/embed/sSCxyccoHqE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> |
|||
|
|||
[Click here to watch the demo on YouTube](https://www.youtube.com/watch?v=sSCxyccoHqE) |
|||
|
|||
## ABP Studio Kubernetes Tunnel |
|||
|
|||
Finally, we came to the essential topic I want to talk about. Until that point, we had a good understanding of the problem and possible solutions. In this part, we will make a final touch to the solution to have **a great development environment for a microservice solution**. |
|||
|
|||
ABP Studio Kubernetes Tunnel System allows you to **connect your local development environment to a local or remote Kubernetes cluster**, where that cluster already runs your microservice solution. In this way, you can access any service in Kubernetes with their service name as DNS, just like they are running in your local computer. This is established with a secure VPN connection. |
|||
|
|||
Secondly, you can **intercept any service** in that cluster, so all the **traffic to the intercepted service is automatically redirected to your service** that is running in your local machine. When your service needs to use any service in Kubernetes, the traffic is redirected back to the cluster, just like your local service is running inside the Kubernetes. In this way, you don’t need to care about how all other services are configured and running. You just focus on the service you are responsible for developing, testing or debugging. You can use your favorite IDE since you are running your service in your local machine as you always do. |
|||
|
|||
The solution runner is a great way of running multiple services locally. However, if your solution consists of hundreds of services, running all them in your local machine will consume your system resources and slow down your development speed. The best news is that: You can use the **Kubernetes Tunnelling combined with all the solution runner features** to have a perfect local microservice development environment. |
|||
|
|||
### How ABP Studio Kubernetes Tunnel works |
|||
|
|||
I am sure that you want to see it in action, but before that, let me explain how the solution works. |
|||
|
|||
 |
|||
|
|||
* **Kubernetes cluster** is shown on the right side and your **local development machine** is shown on the left side. |
|||
* As you know, when a **user requests a web page** from your web application, the request is accepted by an **Ingress Controller** inside your Kubernetes cluster. |
|||
* The Ingress controller forwards the request to your **web application**, which then uses an **API gateway** to consume your microservices. |
|||
* Assume that we have the **Product**, **Ordering** and **Identity** microservices. |
|||
* These microservices have their own SQL Server **database** and they are also using **RabbitMQ**, **Redis** and some other **infrastructure services**. |
|||
* On the other hand, we want to develop, run or test our **Product microservice** in our **own laptop** using our favorite IDE, let’s say using Visual Studio. |
|||
* If we don’t make anything special, the **product microservice in the Kubernetes cluster** will be used by the users, as you can expect. Even if you can somehow run the product microservice in your local computer, the Kubernetes system won’t have any knowledge about it. They are in different systems. |
|||
* At this point, ABP Studio comes into play. When you **connect** to the Kubernetes cluster with ABP Studio, it first installs a **VPN server** into your cluster and a **VPN client** into your local machine. |
|||
* Then it establishes a secure **VPN tunnel** between your computer and the target Kubernetes cluster. In this way, you can access all services in Kubernetes with their internal cluster IP addresses. |
|||
* ABP Studio also installs the **ABP Studio Client Proxy Server** pod into the Kubernetes cluster, and the **ABP Studio Proxy Client** into the developer machine. It is used to collect data from the services and show them in the ABP Studio UI, like HTTP Requests, exceptions, or logs as we’ve seen in the solution runner before. |
|||
* Finally, ABP Studio also adds **DNS records to your hosts file**, so you can access to internal Kubernetes services directly with their service names, in addition to their IP addresses. |
|||
|
|||
All of these happen when you click the Connect button on the ABP Studio. Now, your computer can use the **internals of the Kubernetes cluster**. But, how the HTTP Requests coming to the Product service in the Kubernetes cluster are **redirected to your local machine**? |
|||
|
|||
* When you want to run and test a service locally, you **intercept the matched service** in the Kubernetes cluster. When you Intercept a service, ABP Studio makes some more changes in your local computer and in your Kubernetes cluster. |
|||
* As first, it installs a **pod** and a **service** into the Kubernetes cluster to intercept the requests coming to the Product microservice and **proxies the requests to** a client application in **your local computer**. |
|||
* The local client application then **forwards requests** to the Product microservice instance you are running in your local machine. In this way, whenever the Product service is used in Kubernetes, your local product service is executed. You can easily run, test or debug your service as you normally do with your standard IDE, for example with Visual Studio. |
|||
* What happens when your local product service needs to **access** the SQL Server database or RabbitMQ, or another microservice in the Kubernetes cluster? It can **directly use** them just like local services, through the **VPN tunnel** we have already created. |
|||
* ABP Studio makes a final change in your local product microservice project: It overrides all the **environment variables** with the ones obtained from the product service in the Kubernetes pod. In this way, your local product service instance feels itself in the Kubernetes cluster. Database connection strings and all other settings will be the same with the Kubernetes environment. |
|||
|
|||
Don’t worry, ABP Studio **doesn’t change your local environment variables**. The change only affects the live product service instance, and it is **reverted** when you disable the interception in ABP Studio. Also, when you click the **Disconnect** button in ABP Studio, all the changes made to your cluster and your local computer will be cleared. It won’t leave any sign in your systems. |
|||
|
|||
### ABP Studio Kubernetes Tunnel Demo |
|||
|
|||
So, now we have a fully Kubernetes integrated development environment. Let’s see how it is used in ABP Studio in the following 9-minutes demo: |
|||
|
|||
<iframe width="560" height="315" src="https://www.youtube.com/embed/CeUq2ysz-mQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> |
|||
|
|||
[Click here to watch the demo on YouTube](https://www.youtube.com/watch?v=CeUq2ysz-mQ) |
|||
|
|||
## ABP Studio Roadmap |
|||
|
|||
In the next months, the team will be working on the following items: |
|||
|
|||
* Our first goal is to **finalize and stabilize** the current features. We will also **document** how to use them. Only after that, we will open it to customers as a beta version. |
|||
* We’ve focused on the development part until now. We also want to add some **deployment** capabilities to ABP Studio in the future. |
|||
* Another goal is to make **module customizations** much easier than current by the help of ABP Studio. With ABP Studio, we have completely re-though how to discover and install modules. Based on that, we will also work on a common place to publish and consume application modules for the ABP Framework. |
|||
|
|||
We have other great plans for that product. However, I can not declare them yet as they are secrets for now :) We’ve planned to release the first beta version in **Q3 of 2023**. |
|||
|
|||
I want to notice that ABP Studio is not a new version or replacement of **ABP Suite**. We built the ABP Studio from scratch. Both products will be developed and shipped in parallel. ABP Suite will continue to focus on code generation. ABP Studio doesn’t have any code generation capabilities yet. So, you will use both of them together. |
|||
|
|||
## Summary |
|||
|
|||
Okay let’s summarize what I’ve explained in this article: |
|||
|
|||
* First, I explained **why it is hard to set up a microservice development environment**. We’ve talked about the hardness of developing, running and testing a single microservice that depends on infrastructure services and other microservices. |
|||
* I’ve introduced **Project Tye**, a project developed by Microsoft to allow you to easily run multi-application solutions. We made a demo, then discussed its missing points. |
|||
* Then I **introduced ABP Studio**, a new product by Volosoft for ABP developers. |
|||
As the first important feature, I explained the ABP Studio **Solution Runner** and demonstrated how it works and how you can develop and debug your services. |
|||
* Finally, I introduced ABP Studio’s **Kubernetes Tunneling** feature. First, I explained how it works with a complicated diagram. Then I made a short demo to see it in action. |
|||
|
|||
With that final part, we had a **great and easy to use microservice development environment**. It is great, because we can focus on only a single service, while we don’t care about all other parts of the solution. Also, we can save our local development machine system resources by delegating running the dependencies to a remote Kubernetes server. |
|||
|
|||
## See Also |
|||
|
|||
* ABP Dotnet Conf'23 Talk on YouTube: [Kubernetes Integrated Microservice Development with ABP Studio](https://www.youtube.com/watch?v=XiPRcIHJ3NE) |
|||
@ -0,0 +1,28 @@ |
|||
# ABP Version 7.3 Migration Guide |
|||
|
|||
This document is a guide for upgrading ABP v7.2 solutions to ABP v7.3. There are a few changes in this version that may affect your applications, please read it carefully and apply the necessary changes to your application. |
|||
|
|||
## OpenIddict - Refactoring of `ClaimsPrincipal` |
|||
|
|||
There are some changes that you might need to fix in your code. You can see the following list of the required changes: |
|||
|
|||
* `AbpOpenIddictClaimDestinationsManager` was renamed as `AbpOpenIddictClaimsPrincipalManager`. |
|||
* Use `AbpOpenIddictClaimsPrincipalManager.HandleAsync` instead of `AbpOpenIddictClaimDestinationsManager.SetAsync`, which is removed. |
|||
* `AbpDefaultOpenIddictClaimDestinationsProvider` was renamed as `AbpDefaultOpenIddictClaimsPrincipalHandler`. |
|||
* `IAbpOpenIddictClaimDestinationsProvider` was renamed as `IAbpOpenIddictClaimsPrincipalHandler`. |
|||
* Use `IAbpOpenIddictClaimsPrincipalHandler.HandleAsync` instead of `IAbpOpenIddictClaimDestinationsProvider.SetAsync`, which is removed. |
|||
* `AbpOpenIddictClaimDestinationsOptions` was renamed as `AbpOpenIddictClaimsPrincipalOptions`. |
|||
|
|||
Please check [this PR](https://github.com/abpframework/abp/pull/16537) if you encounter any problems related to OpenIddict Module. |
|||
|
|||
## Nonce attribute support for Content Security Policy (CSP) |
|||
|
|||
ABP Framework supports adding unique value to nonce attribute for script tags which can be used by Content Security Policy to determine whether or not a given fetch will be allowed to proceed for a given element. In other words, it provides a mechanism to execute only correct script tags with the correct nonce value. |
|||
|
|||
> See the [Security Headers](../UI/AspNetCore/Security-Headers.md) documentation for more information. |
|||
|
|||
This feature comes with a small restriction. If you use any C# code used inside the script tag, it may cause errors (Because a new `NonceScriptTagHelper` has been added, and it replaces script tags in the HTML contents). |
|||
|
|||
For example, `<script @string.Empty></script>` will no longer work. However, you can use the C# code for an attribute of script tag, for example, `<script src="@string.Empty"></script>` is completely valid and won't cause any problem. |
|||
|
|||
> Note: You should not use any C# code used inside the script tag, even if you don't use this feature. Because it might cause errors. |
|||
@ -0,0 +1,8 @@ |
|||
# ABP Version 7.4 Migration Guide |
|||
|
|||
This document is a guide for upgrading ABP v7.3 solutions to ABP v7.4. There are a few changes in this version that may affect your applications, please read it carefully and apply the necessary changes to your application. |
|||
|
|||
## TemplateDefinition |
|||
|
|||
The `LocalizationResource(Type)` of `TemplateDefinition` class is changed to `LocalizationResourceName(string)`. |
|||
|
|||
|
After Width: | Height: | Size: 1.4 MiB |
@ -0,0 +1,131 @@ |
|||
## ℹ️ Description |
|||
This package is a part of the [ABP Framework](https://abp.io). |
|||
|
|||
### ABP — Open Source Web Application Framework for ASP.NET Core |
|||
ABP offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET and the ASP.NET Core platforms. ABP Framework is a complete open-source infrastructure to create modern web applications by following the best practices and conventions of software development. It provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation. |
|||
|
|||
|
|||
### For more information, check out the below links: |
|||
|
|||
🔗Official Website: https://abp.io |
|||
|
|||
🔗GitHub Repository: https://github.com/abpframework/abp |
|||
|
|||
🔗Samples: https://docs.abp.io/en/abp/latest/Samples/Index |
|||
|
|||
🔗Official Theme: https://www.LeptonTheme.com |
|||
|
|||
🔗Documentation: https://docs.abp.io |
|||
|
|||
🔗Community: https://community.abp.io |
|||
|
|||
🔗Blog: https://blog.abp.io |
|||
|
|||
🔗Books: https://abp.io/books |
|||
|
|||
🔗Twitter: https://twitter.com/abpframework |
|||
|
|||
🔗Discord: https://community.abp.io/discord |
|||
|
|||
🔗Stackoverflow: https://stackoverflow.com/questions/tagged/abp |
|||
|
|||
🔗YouTube: https://www.youtube.com/@Volosoft |
|||
|
|||
|
|||
## 🚀 Key Features of the ABP Framework |
|||
|
|||
🟡 Modularity |
|||
|
|||
🟡 Multi-Tenancy |
|||
|
|||
🟡 Bootstrap Tag Helpers |
|||
|
|||
🟡 Dynamic Forms |
|||
|
|||
🟡 Authentication |
|||
|
|||
🟡 Authorization |
|||
|
|||
🟡 Distributed Event Bus |
|||
|
|||
🟡 BLOB Storing |
|||
|
|||
🟡 Text Templating |
|||
|
|||
🟡 Tooling: ABP CLI |
|||
|
|||
🟡 Cross-Cutting Concerns |
|||
|
|||
🟡 Bundling & Minification |
|||
|
|||
🟡 Virtual File System |
|||
|
|||
🟡 Theming |
|||
|
|||
🟡 Background Jobs |
|||
|
|||
🟡 DDD Infrastructure |
|||
|
|||
🟡 Auto REST APIs |
|||
|
|||
🟡 Dynamic Client Proxies |
|||
|
|||
🟡 Multiple Database Providers |
|||
|
|||
🟡 Data filtering |
|||
|
|||
🟡 Test Infrastructure |
|||
|
|||
🟡 Audit Logging |
|||
|
|||
🟡 Object to Object Mapping |
|||
|
|||
🟡 Email & SMS Abstractions |
|||
|
|||
🟡 Localization |
|||
|
|||
🟡 Setting Management |
|||
|
|||
🟡 Extension Methods |
|||
|
|||
🟡 Aspect Oriented Programming |
|||
|
|||
🟡 Dependency Injection |
|||
|
|||
|
|||
### 📘 Supported Database Providers |
|||
|
|||
🔵 Entity Framework Core |
|||
|
|||
🔵 MongoDB |
|||
|
|||
🔵 Dapper |
|||
|
|||
|
|||
### 🎴 Supported UI Frameworks |
|||
|
|||
🔵 Angular |
|||
|
|||
🔵 Razor Pages |
|||
|
|||
🔵 Blazor Web Assembly |
|||
|
|||
🔵 Blazor Server |
|||
|
|||
🔵 MAUI with Blazor Hybrid |
|||
|
|||
|
|||
## 📫 Bug & Support |
|||
|
|||
Support for open-source ABP Framework client-side packages is available at [GitHub Issues](https://github.com/abpframework/abp/issues). |
|||
|
|||
|
|||
## 🏦 Go Commercial |
|||
|
|||
If you are building an enterprise-level application with pro support, extra tools like a code generator, fancy themes and a microservice template, time to invest in the commercial version! |
|||
|
|||
To understand how it works, see [How it Works]( https://commercial.abp.io/how-it-works) page. |
|||
|
|||
If you wonder why you should choose ABP Commercial, check out [Why ABP.IO Platform](https://docs.abp.io/en/commercial/latest/why-abp-io-platform) page. |
|||
|
|||
Official website: [https://commercial.abp.io](https://commercial.abp.io/) |
|||
@ -1,6 +1,11 @@ |
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Layout; |
|||
using System; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Layout; |
|||
|
|||
public static class StandardLayouts |
|||
{ |
|||
public const string Application = "Application"; |
|||
public const string Account = "Account"; |
|||
public const string Public = "Public"; |
|||
public const string Empty = "Empty"; |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
public class AbpThemingOptions |
|||
{ |
|||
public ThemeDictionary Themes { get; } |
|||
|
|||
public string DefaultThemeName { get; set; } |
|||
|
|||
public AbpThemingOptions() |
|||
{ |
|||
Themes = new ThemeDictionary(); |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
using System; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
public class DefaultThemeManager : IThemeManager, IScopedDependency, IServiceProviderAccessor |
|||
{ |
|||
public IServiceProvider ServiceProvider { get; } |
|||
public ITheme CurrentTheme => GetCurrentTheme(); |
|||
|
|||
private ITheme _currentTheme; |
|||
|
|||
protected IThemeSelector ThemeSelector { get; } |
|||
|
|||
public DefaultThemeManager( |
|||
IServiceProvider serviceProvider, |
|||
IThemeSelector themeSelector) |
|||
{ |
|||
ServiceProvider = serviceProvider; |
|||
ThemeSelector = themeSelector; |
|||
} |
|||
|
|||
protected virtual ITheme GetCurrentTheme() |
|||
{ |
|||
if (_currentTheme != null) |
|||
{ |
|||
return _currentTheme; |
|||
} |
|||
|
|||
_currentTheme = (ITheme)ServiceProvider.GetRequiredService(ThemeSelector.GetCurrentThemeInfo().ThemeType); |
|||
return CurrentTheme; |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using System.Linq; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
public class DefaultThemeSelector : IThemeSelector, ITransientDependency |
|||
{ |
|||
protected AbpThemingOptions Options { get; } |
|||
|
|||
public DefaultThemeSelector(IOptions<AbpThemingOptions> options) |
|||
{ |
|||
Options = options.Value; |
|||
} |
|||
|
|||
public virtual ThemeInfo GetCurrentThemeInfo() |
|||
{ |
|||
if (!Options.Themes.Any()) |
|||
{ |
|||
throw new AbpException($"No theme registered! Use {nameof(AbpThemingOptions)} to register themes."); |
|||
} |
|||
|
|||
if (Options.DefaultThemeName == null) |
|||
{ |
|||
return Options.Themes.Values.First(); |
|||
} |
|||
|
|||
var themeInfo = Options.Themes.Values.FirstOrDefault(t => t.Name == Options.DefaultThemeName); |
|||
if (themeInfo == null) |
|||
{ |
|||
throw new AbpException("Default theme is configured but it's not found in the registered themes: " + Options.DefaultThemeName); |
|||
} |
|||
|
|||
return themeInfo; |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
public interface ITheme |
|||
{ |
|||
Type GetLayout(string name, bool fallbackToDefault = true); |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
public interface IThemeManager |
|||
{ |
|||
ITheme CurrentTheme { get; } |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
public interface IThemeSelector |
|||
{ |
|||
ThemeInfo GetCurrentThemeInfo(); |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
public class ThemeDictionary : Dictionary<Type, ThemeInfo> |
|||
{ |
|||
public ThemeInfo Add<TTheme>() |
|||
where TTheme : ITheme |
|||
{ |
|||
return Add(typeof(TTheme)); |
|||
} |
|||
|
|||
public ThemeInfo Add(Type themeType) |
|||
{ |
|||
if (ContainsKey(themeType)) |
|||
{ |
|||
throw new AbpException("This theme is already added before: " + themeType.AssemblyQualifiedName); |
|||
} |
|||
|
|||
return this[themeType] = new ThemeInfo(themeType); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using Volo.Abp.AspNetCore.Components.Web.Theming.Layout; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
public static class ThemeExtensions |
|||
{ |
|||
public static Type GetApplicationLayout(this ITheme theme, bool fallbackToDefault = true) |
|||
{ |
|||
return theme.GetLayout(StandardLayouts.Application, fallbackToDefault); |
|||
} |
|||
|
|||
public static Type GetAccountLayout(this ITheme theme, bool fallbackToDefault = true) |
|||
{ |
|||
return theme.GetLayout(StandardLayouts.Account, fallbackToDefault); |
|||
} |
|||
|
|||
public static Type GetPublicLayout(this ITheme theme, bool fallbackToDefault = true) |
|||
{ |
|||
return theme.GetLayout(StandardLayouts.Public, fallbackToDefault); |
|||
} |
|||
|
|||
public static Type GetEmptyLayout(this ITheme theme, bool fallbackToDefault = true) |
|||
{ |
|||
return theme.GetLayout(StandardLayouts.Empty, fallbackToDefault); |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
public class ThemeInfo |
|||
{ |
|||
public Type ThemeType { get; } |
|||
|
|||
public string Name { get; } |
|||
|
|||
public ThemeInfo([NotNull] Type themeType) |
|||
{ |
|||
Check.NotNull(themeType, nameof(themeType)); |
|||
|
|||
if (!typeof(ITheme).IsAssignableFrom(themeType)) |
|||
{ |
|||
throw new AbpException($"Given {nameof(themeType)} ({themeType.AssemblyQualifiedName}) should be type of {typeof(ITheme).AssemblyQualifiedName}"); |
|||
} |
|||
|
|||
ThemeType = themeType; |
|||
Name = ThemeNameAttribute.GetName(themeType); |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Linq; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Theming; |
|||
|
|||
[AttributeUsage(AttributeTargets.Class)] |
|||
public class ThemeNameAttribute : Attribute |
|||
{ |
|||
public string Name { get; set; } |
|||
|
|||
public ThemeNameAttribute(string name) |
|||
{ |
|||
Name = name; |
|||
} |
|||
|
|||
public static string GetName(Type themeType) |
|||
{ |
|||
return themeType |
|||
.GetCustomAttributes(true) |
|||
.OfType<ThemeNameAttribute>() |
|||
.FirstOrDefault()?.Name ?? themeType.Name; |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Security; |
|||
|
|||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] |
|||
public class IgnoreAbpSecurityHeaderAttribute : Attribute |
|||
{ |
|||
|
|||
} |
|||
@ -1,51 +0,0 @@ |
|||
using System; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Tracing; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Tracing; |
|||
|
|||
[Dependency(ReplaceServices = true)] |
|||
public class AspNetCoreCorrelationIdProvider : ICorrelationIdProvider, ITransientDependency |
|||
{ |
|||
protected IHttpContextAccessor HttpContextAccessor { get; } |
|||
protected AbpCorrelationIdOptions Options { get; } |
|||
|
|||
public AspNetCoreCorrelationIdProvider( |
|||
IHttpContextAccessor httpContextAccessor, |
|||
IOptions<AbpCorrelationIdOptions> options) |
|||
{ |
|||
HttpContextAccessor = httpContextAccessor; |
|||
Options = options.Value; |
|||
} |
|||
|
|||
public virtual string Get() |
|||
{ |
|||
if (HttpContextAccessor.HttpContext?.Request?.Headers == null) |
|||
{ |
|||
return CreateNewCorrelationId(); |
|||
} |
|||
|
|||
string correlationId = HttpContextAccessor.HttpContext.Request.Headers[Options.HttpHeaderName]; |
|||
|
|||
if (correlationId.IsNullOrEmpty()) |
|||
{ |
|||
lock (HttpContextAccessor.HttpContext.Request.Headers) |
|||
{ |
|||
if (correlationId.IsNullOrEmpty()) |
|||
{ |
|||
correlationId = CreateNewCorrelationId(); |
|||
HttpContextAccessor.HttpContext.Request.Headers[Options.HttpHeaderName] = correlationId; |
|||
} |
|||
} |
|||
} |
|||
|
|||
return correlationId; |
|||
} |
|||
|
|||
protected virtual string CreateNewCorrelationId() |
|||
{ |
|||
return Guid.NewGuid().ToString("N"); |
|||
} |
|||
} |
|||