Browse Source

Refine microservice tutorial in parts 03 and 05 to clarify instructions for generating C# proxies and creating entities, including updates on folder structure and application service configuration.

pull/21456/head
ahmetfarukulu 1 year ago
parent
commit
01bbb09b13
  1. BIN
      docs/en/tutorials/microservice/images/abp-studio-entity-framework-core-update-database.png
  2. BIN
      docs/en/tutorials/microservice/images/abp-studio-generate-proxy-window-ordering-module.png
  3. BIN
      docs/en/tutorials/microservice/images/abp-studio-generate-proxy-window.png
  4. BIN
      docs/en/tutorials/microservice/images/sql-server-orders-database-table.png
  5. 2
      docs/en/tutorials/microservice/part-03.md
  6. 25
      docs/en/tutorials/microservice/part-05.md

BIN
docs/en/tutorials/microservice/images/abp-studio-entity-framework-core-update-database.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

BIN
docs/en/tutorials/microservice/images/abp-studio-generate-proxy-window-ordering-module.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 83 KiB

BIN
docs/en/tutorials/microservice/images/abp-studio-generate-proxy-window.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 87 KiB

BIN
docs/en/tutorials/microservice/images/sql-server-orders-database-table.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

2
docs/en/tutorials/microservice/part-03.md

@ -85,7 +85,7 @@ Now, we need to generate the [Static API Proxy](../../framework/api-development/
![abp-studio-generate-proxy](images/abp-studio-generate-proxy.png)
It will open the *Generate C# Proxies* window. Select the `CloudCrm.CatalogService` application, and it will automatically populate the *URL* field. Choose the *catalog* module, and check the *Without contracts* checkbox, since we already have a dependency on the `CloudCrm.CatalogService.Contracts` package in the `CloudCrm.Web` project.
It will open the *Generate C# Proxies* window. Select the `CloudCrm.CatalogService` application, and it will automatically populate the *URL* field. Select the *catalog* module, set the service type to *application*, and check the *Without contracts* checkbox, as the `CloudCrm.Web` project already depends on the `CloudCrm.CatalogService.Contracts` package.
![abp-studio-generate-proxy-window](images/abp-studio-generate-proxy-window.png)

25
docs/en/tutorials/microservice/part-05.md

@ -18,7 +18,7 @@ In the previous part, we created the Ordering microservice. In this part, we wil
## Creating the Order Entity
We will start by creating the `Order` entity, which will represent an order in our system. We'll add this entity to the `CloudCrm.OrderingService` project. Open the `Entities` folder and place `Order.cs` into that folder.
We will start by creating the `Order` entity, which will represent an order in our system. We'll add this entity to the `CloudCrm.OrderingService` project. Create a new folder named `Entities` and add a class named `Order` inside it.
```csharp
using CloudCrm.OrderingService.Enums;
@ -38,9 +38,11 @@ To keep this example simple, we allow users to include only a single product wit
### Adding the OrderState Enum
We also need to define the `OrderState` enum. Open an `Enums` folder in the `CloudCrm.OrderingService.Contracts` project and create an `OrderState.cs` file inside it:
We also need to define the `OrderState` enum. In the `CloudCrm.OrderingService.Contracts` project, create a folder named `Enums` and add an `OrderState` enum inside it:
```csharp
namespace CloudCrm.OrderingService.Enums;
public enum OrderState : byte
{
Placed = 0,
@ -130,15 +132,7 @@ Once you click the *OK* button, a new database migration class is added to the `
![visual-studio-new-migration-class](images/visual-studio-new-migration-class.png)
Now, you can return to ABP Studio, right-click the `CloudCrm.OrderingService` project and select the *EF Core CLI* -> *Update Database* command:
![abp-studio-entity-framework-core-update-database](images/abp-studio-entity-framework-core-update-database.png)
> Since we are using a Docker Compose setup, the *Docker-Dependencies* must be running to apply the migration. If it is not running, you can start it by right-clicking on the `Docker-Dependencies` [CLI application](../../studio/running-applications.md#cli-application-1) and selecting *Run* -> *Start* on the *Solution Runner*.
After the operation completes, you can check your database to see the new `Orders` table has been created:
![sql-server-orders-database-table](images/sql-server-orders-database-table.png)
The changes will be applied to the database during the next application startup. For more details, refer to the [database migrations on service startup](../../solution-templates/microservice/database-configurations.md#database-migrations-on-service-startup) section.
## Creating the Application Service
@ -298,10 +292,11 @@ Create a new `Orders` folder under the `Pages` folder in the `CloudCrm.Web` proj
```csharp
using CloudCrm.OrderingService.Services;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace CloudCrm.Web.Pages.Orders;
public class Index : PageModel
public class Index : AbpPageModel
{
public List<OrderDto> Orders { get; set; }
@ -347,16 +342,16 @@ This page shows a list of orders on the UI. We haven't created a UI to create ne
### Generating the UI Proxy
To select the *Application* during proxy generation, ensure that the `CloudCrm.OrderingService` is *Started* beforehand. You can start the application using [Solution Runner](../../studio/running-applications.md).
Now, we need to generate the [Static API Proxy](../../framework/api-development/static-csharp-clients.md) for the *Web* project. Right-click the *CloudCrm.Web* [package](../../studio/concepts.md#package) and select the *ABP CLI* -> *Generate Proxy* -> *C#* command:
![abp-studio-generate-proxy-2](images/abp-studio-generate-proxy-2.png)
It will open the *Generate C# Proxies* window. Select the `CloudCrm.OrderingService` application, and it will automatically populate the *URL* field. Choose the *ordering* module, and check the *Without contracts* checkbox, since we already have a dependency on the `CloudCrm.OrderingService.Contracts` package in the `CloudCrm.Web` project.
It will open the *Generate C# Proxies* window. Select the `CloudCrm.OrderingService` application, and it will automatically populate the *URL* field. Choose the *ordering* module and service type is *application* lastly check the *Without contracts* checkbox, since we already have a dependency on the `CloudCrm.OrderingService.Contracts` package in the `CloudCrm.Web` project.
![abp-studio-generate-proxy-window-ordering-module](images/abp-studio-generate-proxy-window-ordering-module.png)
> To be able to select the *Application*, you must *Build & Start* the related application beforehand. You can start the application using [Solution Runner](../../studio/running-applications.md).
Lastly, we need to configure the use of a static HTTP client for the `OrderingService` in the `CloudCrm.Web` project. Open the `CloudCrmWebModule.cs` file in the `Web` project and add the following line to the `ConfigureServices` method:
```csharp

Loading…
Cancel
Save