Browse Source

Merge pull request #21129 from abpframework/doc/minimal-module

Modular CRM tutorial updated
pull/21147/head
Engincan VESKE 1 year ago
committed by GitHub
parent
commit
d71b9176fa
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. BIN
      docs/en/get-started/images/abp-studio-new-solution-dialog-additional-options-microservice.png
  2. BIN
      docs/en/get-started/images/abp-studio-new-solution-dialog-additional-options.png
  3. 2
      docs/en/get-started/layered-web-application.md
  4. 2
      docs/en/get-started/microservice.md
  5. BIN
      docs/en/studio/images/solution-explorer/abp-solution.png
  6. BIN
      docs/en/studio/images/solution-explorer/create-new-microservice-nolayers-additional-options.png
  7. BIN
      docs/en/studio/images/solution-explorer/create-new-microservice-nolayers-enable-integration.png
  8. BIN
      docs/en/studio/images/solution-explorer/create-new-module.png
  9. BIN
      docs/en/studio/images/solution-explorer/folder-context-menu.png
  10. BIN
      docs/en/studio/images/solution-explorer/imported-module.png
  11. BIN
      docs/en/studio/images/solution-explorer/imports-context-menu.png
  12. BIN
      docs/en/studio/images/solution-explorer/module-context-menu.png
  13. BIN
      docs/en/studio/images/solution-explorer/package-context-menu.png
  14. 6
      docs/en/studio/solution-explorer.md
  15. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-ddd-module.png
  16. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-empty-module-dialog.png
  17. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-empty-module.png
  18. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-package-class-library.png
  19. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-package-mvc-ui.png
  20. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-package.png
  21. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module-additional-dialog.png
  22. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module-db-dialog.png
  23. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module-dialog.png
  24. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module-ui-dialog.png
  25. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module.png
  26. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-nuget-package-reference.png
  27. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-2.png
  28. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-3.png
  29. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-4.png
  30. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-6.png
  31. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-7.png
  32. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog-2.png
  33. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog-3.png
  34. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog-5.png
  35. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog-6.png
  36. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog.png
  37. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference.png
  38. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-added-ddd-contracts-package.png
  39. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-added-ddd-domain-package.png
  40. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-browser-list-of-orders-with-product-name.png
  41. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-browser-orders-menu-item.png
  42. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-create-new-module-dialog-step-additional-options.png
  43. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-create-new-module-dialog-step-db.png
  44. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-install-module-dialog-for-ordering.png
  45. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-install-module-dialog.png
  46. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-modular-crm-with-standard-module.png
  47. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-modular-crm-with-two-modules.png
  48. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-new-package-under-the-module.png
  49. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-project-reference-example.png
  50. BIN
      docs/en/tutorials/modular-crm/images/abp-studio-solution-runner-orders-page.png
  51. BIN
      docs/en/tutorials/modular-crm/images/file-system-odering-module-initial-folder.png
  52. BIN
      docs/en/tutorials/modular-crm/images/file-system-ordering-module-initial-folder.png
  53. BIN
      docs/en/tutorials/modular-crm/images/ordering-module-visual-studio.png
  54. BIN
      docs/en/tutorials/modular-crm/images/visual-studio-order-entity.png
  55. BIN
      docs/en/tutorials/modular-crm/images/visual-studio-order-event.png
  56. BIN
      docs/en/tutorials/modular-crm/images/visual-studio-ordering-module-initial.png
  57. BIN
      docs/en/tutorials/modular-crm/images/visual-studio-ordering-ui-package-dependency.png
  58. BIN
      docs/en/tutorials/modular-crm/images/visual-studio-pages-folder.png
  59. 6
      docs/en/tutorials/modular-crm/part-02.md
  60. 73
      docs/en/tutorials/modular-crm/part-04.md
  61. 306
      docs/en/tutorials/modular-crm/part-05.md
  62. 30
      docs/en/tutorials/modular-crm/part-06.md
  63. 13
      docs/en/tutorials/modular-crm/part-07.md

BIN
docs/en/get-started/images/abp-studio-new-solution-dialog-additional-options-microservice.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 83 KiB

BIN
docs/en/get-started/images/abp-studio-new-solution-dialog-additional-options.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 88 KiB

2
docs/en/get-started/layered-web-application.md

@ -119,7 +119,7 @@ Here, you can select the database management systems (DBMS){{ if DB == "EF" }} a
![abp-studio-new-solution-dialog-additional-options](images/abp-studio-new-solution-dialog-additional-options.png)
If you uncheck the *Kubernetes Configuration* option, the solution will not include the Kubernetes configuration files, such as Helm charts and other Kubernetes-related files. You can also specify *Social Logins*; if you uncheck this option, the solution will not be configured for social login.
If you uncheck the *Kubernetes Configuration* option, the solution will not include the Kubernetes configuration files, such as Helm charts and other Kubernetes-related files. You can also specify *Social Logins*; if you uncheck this option, the solution will not be configured for social login. Lastly, you can specify the *Include Tests* option to include or exclude the test projects from the solution.
Now, we are ready to allow ABP Studio to create our solution. Just click the *Create* button and let the ABP Studio do the rest for you. After clicking the Create button, the dialog is closed and your solution is loaded into ABP Studio:

2
docs/en/get-started/microservice.md

@ -71,7 +71,7 @@ Click the Next button to see *Additional Options* selection:
![abp-studio-new-solution-dialog-additional-options](images/abp-studio-new-solution-dialog-additional-options-microservice.png)
If you unchecked the *Kubernetes Configuration* option, the solution will not include the Kubernetes configuration files which include the Helm charts and other Kubernetes related files. You can also specify *Social Logins*; if you uncheck this option, the solution will not be configured for social login.
If you unchecked the *Kubernetes Configuration* option, the solution will not include the Kubernetes configuration files which include the Helm charts and other Kubernetes related files. You can also specify *Social Logins*; if you uncheck this option, the solution will not be configured for social login. Lastly, you can specify the *Include Tests* option to include the test projects in the solution.
Now, we are ready to allow ABP Studio to create our solution. Just click the *Create* button and let the ABP Studio do the rest for you. After clicking the Create button, the dialog is closed and your solution is loaded into ABP Studio:

BIN
docs/en/studio/images/solution-explorer/abp-solution.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 74 KiB

BIN
docs/en/studio/images/solution-explorer/create-new-microservice-nolayers-additional-options.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
docs/en/studio/images/solution-explorer/create-new-microservice-nolayers-enable-integration.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 80 KiB

BIN
docs/en/studio/images/solution-explorer/create-new-module.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 28 KiB

BIN
docs/en/studio/images/solution-explorer/folder-context-menu.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 41 KiB

BIN
docs/en/studio/images/solution-explorer/imported-module.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 71 KiB

BIN
docs/en/studio/images/solution-explorer/imports-context-menu.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 73 KiB

BIN
docs/en/studio/images/solution-explorer/module-context-menu.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 53 KiB

BIN
docs/en/studio/images/solution-explorer/package-context-menu.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 54 KiB

6
docs/en/studio/solution-explorer.md

@ -123,7 +123,7 @@ A [module](./concepts.md#module) is a sub-solution that can contains zero, one o
### Adding a New Empty Module
Create a new module by clicking the *Add* -> *New Module* -> *Empty Module* button at the root of the solution or in the solution folder context menu. The *Microservice* solution template also includes *Microservice*, *Gateway*, and *Web* modules. Other solution templates, such as *Application (Layered)*, can only create *Empty*, and *DDD* modules.
Create a new module by clicking the *Add* -> *New Module* -> *Empty Module* button at the root of the solution or in the solution folder context menu. The *Microservice* solution template also includes *Microservice*, *Gateway*, and *Web* modules. Other solution templates, such as *Application (Layered)*, can only create *Empty*, *DDD* and *Standard* modules.
![create-new-module](./images/solution-explorer/create-new-module.png)
@ -149,6 +149,10 @@ When you create a microservice, you must edit some [configurations](../solution-
![create-new-microservice-nolayers-enable-integration](./images/solution-explorer/create-new-microservice-nolayers-enable-integration.png)
You can uncheck the *Include Tests* option if you don't want to include test projects in your microservice module. Click the *Create* button to add the microservice module to the solution.
![create-new-microservice-nolayers-additional-options](./images/solution-explorer/create-new-microservice-nolayers-additional-options.png)
After creating the *Microservice (service-nolayers)* module, it will be added to the solution, and you should see the following structure in the solution explorer.
![created-new-microservice-nolayers](./images/solution-explorer/created-new-microservice-nolayers.png)

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-ddd-module.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-empty-module-dialog.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-empty-module.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-package-class-library.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-package-mvc-ui.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-package.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module-additional-dialog.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module-db-dialog.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module-dialog.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module-ui-dialog.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-new-standard-module.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-nuget-package-reference.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 30 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-7.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog-2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog-3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 82 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog-5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog-6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference-dialog.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-add-package-reference.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-added-ddd-contracts-package.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-added-ddd-domain-package.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-browser-list-of-orders-with-product-name.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 52 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-browser-orders-menu-item.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 81 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-create-new-module-dialog-step-additional-options.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-create-new-module-dialog-step-db.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 50 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-install-module-dialog-for-ordering.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 147 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-install-module-dialog.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 142 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-modular-crm-with-standard-module.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-modular-crm-with-two-modules.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-new-package-under-the-module.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-project-reference-example.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

BIN
docs/en/tutorials/modular-crm/images/abp-studio-solution-runner-orders-page.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

BIN
docs/en/tutorials/modular-crm/images/file-system-odering-module-initial-folder.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

BIN
docs/en/tutorials/modular-crm/images/file-system-ordering-module-initial-folder.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
docs/en/tutorials/modular-crm/images/ordering-module-visual-studio.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
docs/en/tutorials/modular-crm/images/visual-studio-order-entity.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 60 KiB

BIN
docs/en/tutorials/modular-crm/images/visual-studio-order-event.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 35 KiB

BIN
docs/en/tutorials/modular-crm/images/visual-studio-ordering-module-initial.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

BIN
docs/en/tutorials/modular-crm/images/visual-studio-ordering-ui-package-dependency.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
docs/en/tutorials/modular-crm/images/visual-studio-pages-folder.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

6
docs/en/tutorials/modular-crm/part-02.md

@ -69,7 +69,11 @@ The next step is to select the database provider (or providers) you want to supp
![abp-studio-create-new-module-dialog-step-db](images/abp-studio-create-new-module-dialog-step-db.png)
Since our main application is using Entity Framework Core and we will use the `ModularCrm.Products` module only for that main application, we can select the *Entity Framework Core* option and click the *Create* button.
Since our main application is using Entity Framework Core and we will use the `ModularCrm.Products` module only for that main application, we can select the *Entity Framework Core* option and click the *Next* button.
![abp-studio-create-new-module-dialog-step-additional-options](images/abp-studio-create-new-module-dialog-step-additional-options.png)
Lastly, you can uncheck the *Include Tests* option if you don't want to include test projects in your module. Click the *Create* button to create the new module.
### Exploring the New Module

73
docs/en/tutorials/modular-crm/part-04.md

@ -16,76 +16,41 @@
In this part, you will build a new module for placing orders and install it in the main CRM application.
## Creating an Empty Module
## Creating a Standard Module
In this part, we have used the *DDD Module* template for the Product module and will use the *Empty Module* template for the Ordering module.
In this part, we have used the *DDD Module* template for the Product module and will use the *Standard Module* template for the Ordering module.
Right-click the `modules` folder on the *Solution Explorer* panel, and select the *Add* -> *New Module* -> *Empty Module* command:
Right-click the `modules` folder on the *Solution Explorer* panel, and select the *Add* -> *New Module* -> *Standard Module* command:
![abp-studio-add-new-empty-module](images/abp-studio-add-new-empty-module.png)
![abp-studio-add-new-standard-module](images/abp-studio-add-new-standard-module.png)
That command opens a dialog to define the properties of the new module:
![abp-studio-add-new-empty-module-dialog](images/abp-studio-add-new-empty-module-dialog.png)
![abp-studio-add-new-standard-module-dialog](images/abp-studio-add-new-standard-module-dialog.png)
Set `ModularCrm.Ordering` as the *Module name*, leave the *Output folder* as is and click the *Create* button. It will create the new `ModularCrm.Ordering` module under the `modules` folder in the *Solution Explorer*:
Set `ModularCrm.Ordering` as the *Module name*, leave the *Output folder* as is and click the *Next* button.
![abp-studio-modular-crm-with-two-modules](images/abp-studio-modular-crm-with-two-modules.png)
![abp-studio-add-new-standard-module-ui-dialog](images/abp-studio-add-new-standard-module-ui-dialog.png)
Since we've created an empty module, it is really empty. If you open the `modules/modularcrm.ordering` in your file system, you can see the initial files:
Similar to DDD module creation, you can choose the type of UI you want to support in your module or select *No UI* if you don't need a user interface. In this example, we'll select the *MVC* option and click *Next*. One difference is that, for a standard module, you can only choose one UI type.
![file-system-odering-module-initial-folder](images/file-system-odering-module-initial-folder.png)
![abp-studio-add-new-standard-module-db-dialog](images/abp-studio-add-new-standard-module-db-dialog.png)
## Creating the Module Packages
The same limitation applies to the database selection. You can only choose one database provider for a standard module. Select the *Entity Framework Core* option and click *Next*.
In this section, we will create packages under the Ordering module. The Products module was well layered based on Domain Driven Design principles. This time, we will keep things very simple and will only create two packages for the Ordering module:
![abp-studio-add-new-standard-module-additional-dialog](images/abp-studio-add-new-standard-module-additional-dialog.png)
* `ModularCrm.Ordering`: Contains all the module code without any layering. It will contain entities, database access code, services, controllers, UI pages and whatever we need to implement the *Ordering* module.
* `ModularCrm.Ordering.Contracts`: Contains the services and objects we want to share with other modules. `ModularCrm.Ordering` uses (and implements) this package.
You can uncheck the *Include Tests* option to keep the module simple. Click the *Create* button to create the module.
> If your modules are relatively small and easy to maintain, they will only be used by your main application, and you don't care about layering, then you can create such simple module structures.
![abp-studio-modular-crm-with-standard-module](images/abp-studio-modular-crm-with-standard-module.png)
We will create and configure everything from scratch. You have already learned the easy way in the previous parts, where we created the Products module. It is time to deepen your understanding of the details and learn how ABP Studio allows you to set up custom structures. Let's begin.
Since we've created a standard module, it doesn't have multiple layers like the DDD module. If you open the `modules/modularcrm.ordering` in your file system, you can see the initial files:
### Creating the `ModularCrm.Ordering.Contracts` Package
![file-system-odering-module-initial-folder](images/file-system-ordering-module-initial-folder.png)
Right-click the `ModularCrm.Ordering` module on the *Solution Explorer* and select the *Add* -> *Package* -> *New Package* command as shown in the following figure:
Because only a single UI package can be chosen, the UI type doesn’t matter. This is why the package name is changed to *ModularCrm.Ordering.UI*. Additionally, there are no *Domain*, *EntityFrameworkCore*, or *Http* layers like in the DDD module. We're going to use the `ModularCrm.Ordering` package for the domain business logic. You can open `ModularCrm.Ordering.sln` in your favorite IDE (e.g. Visual Studio):
![abp-studio-add-new-package](images/abp-studio-add-new-package.png)
That command opens a new dialog to create a new package:
![abp-studio-add-new-package-class-library](images/abp-studio-add-new-package-class-library.png)
With that dialog, you can build your module or application layer by layer. There are templates for any package. However, here we will go with the simplest one: *ABP Class Library*. ABP Class Library is an empty C# class library with the [core ABP package](https://www.nuget.org/packages/Volo.Abp.Core) dependency and a [module class](../../framework/architecture/modularity/basics.md).
Type `ModularCrm.Ordering.Contracts` as the *Package name* and click the *Create* button. It will add the package under the `ModularCrm.Ordering` module:
![abp-studio-new-package-under-the-module](images/abp-studio-new-package-under-the-module.png)
### Creating the `ModularCrm.Ordering` Package
Right-click the `ModularCrm.Ordering` module on the *Solution Explorer* again and select the *Add* -> *Package* -> *New Package* command to create a second package:
![abp-studio-add-new-package-mvc-ui](images/abp-studio-add-new-package-mvc-ui.png)
This time, we select the MVC UI template and set the Package name to `ModularCrm.Ordering`. Then, click the Create button to add the new package.
### Add Package Reference
After the package has been added, right-click the `ModularCrm.Ordering` package and select the *Add Package Reference* command:
![abp-studio-add-package-reference](images/abp-studio-add-package-reference.png)
That command opens a dialog to select the package:
![abp-studio-add-package-reference-dialog](images/abp-studio-add-package-reference-dialog.png)
In that dialog, you can add package references from various sources. Here, we will add a reference for the package in the current module. So, select the `ModularCrm.Ordering.Contracts` package in the *This module* tab and click the *OK* button. You can see the package reference under the *Projects* dependencies on the *Solution Explorer* panel:
![abp-studio-project-reference-example](images/abp-studio-project-reference-example.png)
The initial module creation has been completed. Now, we have a new module with two packages. However, it is not related to other modules and applications in the solution yet.
![ordering-module-visual-studio](images/ordering-module-visual-studio.png)
## Installing into the Main Application
@ -105,8 +70,8 @@ Select the `ModularCrm.Ordering` module and check the *Install this module* opti
![abp-studio-install-module-dialog](images/abp-studio-install-module-dialog.png)
Select the `ModuleCrm.Ordering` package in the left area and the `ModularCrm.Domain` package in the middle area, as shown in the preceding figure, and click the *OK* button.
Select the `ModuleCrm.Ordering` package from the left area and the `ModularCrm.Domain` package from the middle area. Then, select the `ModularCrm.Ordering.UI` package from the left area and the `ModularCrm.Web` package from the middle area, as shown in the preceding figure. Finally, click *OK*.
> Since the Ordering module is not layered, we didn't install its packages to the layers of our main application. We are installing it only to `ModularCrm.Domain`. In this way, we can use the Ordering module from any layer of our application since `ModularCrm.Domain` is one of the core packages of our application. If you build your modules as non-layered and you don't have much code in the main application's .NET solution, you can also consider creating a non-layered main application that composes these modules.
In this part of the tutorial, we've created an empty module and added packages. This allows you to create modules or applications with a custom structure. In the next part, we will add functionality to the Ordering module.
In this part of the tutorial, we've created a standard module. This allows you to create modules or applications with a different structure. In the next part, we will add functionality to the Ordering module.

306
docs/en/tutorials/modular-crm/part-05.md

@ -14,7 +14,7 @@
}
````
In the previous part, we created a custom Ordering module and installed it into the main application. However, the Ordering module has no functionality now. In this part, we will create an `Order` entity and add functionality to create and list the orders.
In the previous part, we created Ordering module and installed it into the main application. However, the Ordering module has no functionality now. In this part, we will create an `Order` entity and add functionality to create and list the orders.
## Creating an `Order` Entity
@ -22,37 +22,9 @@ Open the `ModularCrm.Ordering` .NET solution in your IDE.
> Tip: You can open the folder of a module's .NET solution by right-clicking the related module in ABP Studio and selecting the *Open with* -> *Explorer* command.
The following figure shows the `ModularCrm.Ordering` module in the *Solution Explorer* panel of Visual Studio:
![visual-studio-ordering-module-initial](images/visual-studio-ordering-module-initial.png)
### Adding `Volo.Abp.Ddd.Domain` Package Reference
As you see in the preceding figure, the solution structure is very minimal. It also has a minimal ABP dependency. ABP Framework has [hundreds of NuGet packages](https://abp.io/packages), but the `ModularCrm.Ordering` project only has the [`Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared`](https://abp.io/package-detail/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared) package reference:
![visual-studio-ordering-ui-package-dependency](images/visual-studio-ordering-ui-package-dependency.png)
We will create an [entity class](../../framework/architecture/domain-driven-design/entities.md). ABP defines base entity classes and other related infrastructure in the [`Volo.Abp.Ddd.Domain`](https://abp.io/package-detail/Volo.Abp.Ddd.Domain) package. So, we need to add a reference to that NuGet package.
You can add that package and manually arrange the [module](../../framework/architecture/modularity/basics.md) class dependency. However, we will use ABP Studio as a more practical option.
Return to ABP Studio, right-click the `ModularCrm.Ordering` package in the *Solution Explorer* and select the *Add Package Reference* command:
![abp-studio-add-package-reference-2](images/abp-studio-add-package-reference-2.png)
That command opens a dialog to add a new package reference:
![abp-studio-add-nuget-package-reference](images/abp-studio-add-nuget-package-reference.png)
Select the *NuGet* tab, type `Volo.Abp.Ddd.Domain` as the *Package name* and write the version of the package you want to install. Please be sure that you are installing the same version as the other ABP packages you are already using. ABP Studio will provide an easier way to select the package and its version in future ABP versions.
Click the *OK* button. Now you can check the *Packages* under the `ModularCrm.Ordering` module *Dependencies* to see the `Volo.Abp.Ddd.Domain` package is installed:
![abp-studio-added-ddd-domain-package](images/abp-studio-added-ddd-domain-package.png)
### Adding an `Order` Class
Now, you can return your IDE and add an `Order` class to the `ModularCrm.Ordering` project (open an `Entities` folder and place the `Order.cs` into that folder):
Create an `Order` class to the `ModularCrm.Ordering` project (open an `Entities` folder and place the `Order.cs` into that folder):
````csharp
using System;
@ -77,7 +49,7 @@ We allow users to place only a single product within an order. The `Order` entit
We used an `OrderState` enumeration that has not yet been defined. Open an `Enums` folder in the `ModularCrm.Ordering.Contracts` project and create an `OrderState.cs` file inside it:
````csharp
namespace ModularCrm.Ordering.Contracts.Enums;
namespace ModularCrm.Ordering.Enums;
public enum OrderState : byte
{
@ -93,48 +65,64 @@ The final structure of the Ordering module should be similar to the following fi
## Configuring the Database Mapping
The `Order` entity has been created. Now, we need to configure the database mapping for that entity. We will first install the Entity Framework Core package, define the database table mapping, create a database migration and update the database.
### Installing the Entity Framework Core Package
The `Order` entity has been created. Now, we need to configure the database mapping for that entity. We will first define the database table mapping, create a database migration and update the database.
> In this section, we will install the [`Volo.Abp.EntityFrameworkCore`](https://abp.io/package-detail/Volo.Abp.EntityFrameworkCore) package to the Ordering module. That package is DBMS-independent and leaves the DBMS selection to the final application. If you want, you can install a DBMS-specific package instead. For example, you can install the [`Volo.Abp.EntityFrameworkCore.SqlServer`](https://abp.io/package-detail/Volo.Abp.EntityFrameworkCore.SqlServer) package if you are using SQL Server and want to make SQL Server specific configuration for your module's database.
> You can search for other packages on the [abp.io/packages](https://abp.io/packages) page.
Stop the web application if it is still running. Return to ABP Studio, right-click the `ModularCrm.Ordering` package on the *Solution Explorer* panel and select the *Add Package Reference* command:
![abp-studio-add-package-reference-3](images/abp-studio-add-package-reference-3.png)
### Defining the Database Mappings
Select the *NuGet* tab, type `Volo.Abp.EntityFrameworkCore` as the *Package name* and specify a *Version* that is compatible with the ABP version used by your solution:
Entity Framework Core requires defining a `DbContext` class as the main object for the database mapping. We want to use the main application's `DbContext` object. That way, we can control the database migrations at a single point, ensure database transactions on multi-module operations, and establish relations between database tables of different modules. However, the Ordering module can not use the main application's `DbContext` object because it doesn't depend on the main application, and we don't want to establish such a dependency.
![abp-studio-add-package-reference-dialog-2](images/abp-studio-add-package-reference-dialog-2.png)
As a solution, we will use `DbContext` interface in the Ordering module which is then implemented by the main module's `DbContext`.
Once you click the *OK* button, the NuGet package reference is added.
Open your IDE, in `Data` folder under the `ModularCrm.Ordering` project, and edit `IOrderingDbContext` interface as shown:
### Defining the Database Mappings
````csharp
using Microsoft.EntityFrameworkCore;
using ModularCrm.Ordering.Entities;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
Entity Framework Core requires defining a `DbContext` class as the main object for the database mapping. We want to use the main application's `DbContext` object. That way, we can control the database migrations at a single point, ensure database transactions on multi-module operations, and establish relations between database tables of different modules. However, the Ordering module can not use the main application's `DbContext` object because it doesn't depend on the main application, and we don't want to establish such a dependency.
namespace ModularCrm.Ordering.Data;
As a solution, we will define a `DbContext` interface in the Ordering module which is then implemented by the main module's `DbContext`.
[ConnectionStringName(OrderingDbProperties.ConnectionStringName)]
public interface IOrderingDbContext : IEfCoreDbContext
{
DbSet<Order> Orders { get; set; }
}
````
Open your IDE, create a `Data` folder under the `ModularCrm.Ordering` project, and create an `IOrderingDbContext` interface under that folder:
Afterwards, create *Orders* `DbSet` for the `OrderingDbContext` class in the `Data` folder under the `ModularCrm.Ordering` project.
````csharp
using Microsoft.EntityFrameworkCore;
using ModularCrm.Ordering.Entities;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
namespace ModularCrm.Ordering.Data
namespace ModularCrm.Ordering.Data;
[ConnectionStringName(OrderingDbProperties.ConnectionStringName)]
public class OrderingDbContext : AbpDbContext<OrderingDbContext>, IOrderingDbContext
{
public interface IOrderingDbContext : IEfCoreDbContext
public DbSet<Order> Orders { get; set; }
public OrderingDbContext(DbContextOptions<OrderingDbContext> options) : base(options)
{
DbSet<Order> Orders { get; set; }
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigureOrdering();
}
}
````
We can inject and use the `IOrderingDbContext` in the Ordering module. However, we will not usually directly use that interface. Instead, we will use ABP's [repositories](../../framework/architecture/domain-driven-design/repositories.md), which internally uses that interface.
It is best to configure the database table mapping for the `Order` entity in the Ordering module. We will create an extension method that will be called by the main application later. Create a class named `OrderingDbContextModelCreatingExtensions` in the same `Data` folder:
It is best to configure the database table mapping for the `Order` entity in the Ordering module. We will use the `OrderingDbContextModelCreatingExtensions` in the same `Data` folder:
````csharp
using Microsoft.EntityFrameworkCore;
@ -142,26 +130,26 @@ using ModularCrm.Ordering.Entities;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
namespace ModularCrm.Ordering.Data
namespace ModularCrm.Ordering.Data;
public static class OrderingDbContextModelCreatingExtensions
{
public static class OrderingDbContextModelCreatingExtensions
public static void ConfigureOrdering(
this ModelBuilder builder)
{
public static void ConfigureOrdering(this ModelBuilder builder)
{
Check.NotNull(builder, nameof(builder));
Check.NotNull(builder, nameof(builder));
builder.Entity<Order>(b =>
{
//Configure table name
b.ToTable("Orders");
builder.Entity<Order>(b =>
{
//Configure table name
b.ToTable("Orders");
//Always call this method to set base entity properties
b.ConfigureByConvention();
//Always call this method to set base entity properties
b.ConfigureByConvention();
//Properties of the entity
b.Property(q => q.CustomerName).IsRequired().HasMaxLength(120);
});
}
//Properties of the entity
b.Property(q => q.CustomerName).IsRequired().HasMaxLength(120);
});
}
}
````
@ -204,7 +192,7 @@ protected override void OnModelCreating(ModelBuilder builder)
}
````
In this way, the Ordering module can use' ModularCrmDbContext' over the `IProductsDbContext` interface. This part is only needed once for a module. Next time, you can add a new database migration, as explained in the next section.
In this way, the Ordering module can use 'ModularCrmDbContext' over the `IProductsDbContext` interface. This part is only needed once for a module. Next time, you can add a new database migration, as explained in the next section.
#### Add a Database Migration
@ -238,30 +226,14 @@ We will create an application service to manage the `Order` entities.
### Defining the Application Service Contract
We're gonna create the `IOrderAppService` interface under the `ModularCrm.Ordering.Contracts` project but first, we need to add `Volo.Abp.Ddd.Application.Contracts` package reference.
Right-click the `ModularCrm.Ordering.Contracts` project in the *Solution Explorer* panel and select the *Add Package Reference* command:
![abp-studio-add-package-reference-6](images/abp-studio-add-package-reference-6.png)
This command opens a dialog to add a new package reference:
![abp-studio-add-package-reference-dialog-5](images/abp-studio-add-package-reference-dialog-5.png)
Select the *NuGet* tab, type `Volo.Abp.Ddd.Application.Contracts` as the *Package name* and write the version of the package you want to install. Please be sure that you are installing the same version as the other ABP packages you are already using.
Click the *Ok* button. Now you can check the *Packages* under the `ModularCrm.Ordering.Contracts` project *Dependencies* to see the `Volo.Abp.Ddd.Application.Contracts` package is installed:
![abp-studio-added-ddd-contracts-package](images/abp-studio-added-ddd-contracts-package.png)
Return to your IDE, open the `ModularCrm.Ordering` module's .NET solution and create an `IOrderAppService` interface under the `Services` folder for `ModularCrm.Ordering.Contracts` project:
We're gonna create the `IOrderAppService` interface under the `ModularCrm.Ordering.Contracts` project. Return to your IDE, open the `ModularCrm.Ordering` module's .NET solution and create an `IOrderAppService` interface under the `Services` folder for `ModularCrm.Ordering.Contracts` project:
````csharp
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace ModularCrm.Ordering.Contracts.Services;
namespace ModularCrm.Ordering.Services;
public interface IOrderAppService : IApplicationService
{
@ -297,9 +269,9 @@ Create a `OrderDto` class under the `ModularCrm.Ordering.Contracts` project:
````csharp
using System;
using ModularCrm.Ordering.Contracts.Enums;
using ModularCrm.Ordering.Enums;
namespace ModularCrm.Ordering.Contracts.Services;
namespace ModularCrm.Ordering.Services;
public class OrderDto
{
@ -316,72 +288,43 @@ The new files under the `ModularCrm.Ordering.Contracts` project should be like t
### Implementing the Application Service
Before creating the `OrderAppService` class, we need to add the `Volo.Abp.Ddd.Application` and `Volo.Abp.AutoMapper` packages to the Ordering module.
Right-click the `ModularCrm.Ordering` package in the *Solution Explorer* panel and select the *Add Package Reference* command:
![abp-studio-add-package-reference-7](images/abp-studio-add-package-reference-7.png)
This command opens a dialog to add a new package reference:
![abp-studio-add-package-reference-dialog-6](images/abp-studio-add-package-reference-dialog-6.png)
Select the *NuGet* tab, enter `Volo.Abp.Ddd.Application` as the *Package name*, and specify the version of the package you wish to install. Afterward, you can add the `Volo.Abp.AutoMapper` package in the same dialog. Ensure that you install the same version as the other ABP packages you are already using.
Click the *OK* button. Now we should configure the *AutoMapper* object to map the `Order` entity to the `OrderDto` object. We will create a class named `OrderingApplicationAutoMapperProfile` under the `ModularCrm.Ordering` project:
Now we should configure the *AutoMapper* object to map the `Order` entity to the `OrderDto` object. We will use the `OrderingAutoMapperProfile` under the `ModularCrm.Ordering` project:
````csharp
using AutoMapper;
using ModularCrm.Ordering.Contracts.Services;
using ModularCrm.Ordering.Entities;
using ModularCrm.Ordering.Services;
namespace ModularCrm.Ordering;
public class OrderingApplicationAutoMapperProfile : Profile
public class OrderingAutoMapperProfile : Profile
{
public OrderingApplicationAutoMapperProfile()
public OrderingAutoMapperProfile()
{
CreateMap<Order, OrderDto>();
}
}
````
And configure the `OrderingWebModule` class to use the `OrderingApplicationAutoMapperProfile`:
````csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
//Add these lines
context.Services.AddAutoMapperObjectMapper<OrderingWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<OrderingWebModule>(validate: true);
});
}
````
Now, we can implement the `IOrderAppService` interface. Create an `OrderAppService` class under the `Services` folder of the `ModularCrm.Ordering` project:
````csharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ModularCrm.Ordering.Contracts.Enums;
using ModularCrm.Ordering.Contracts.Services;
using ModularCrm.Ordering.Enums;
using ModularCrm.Ordering.Entities;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
namespace ModularCrm.Ordering.Services;
public class OrderAppService : ApplicationService, IOrderAppService
public class OrderAppService : OrderingAppService, IOrderAppService
{
private readonly IRepository<Order> _orderRepository;
public OrderAppService(IRepository<Order, Guid> orderRepository)
{
_orderRepository = orderRepository;
ObjectMapperContext = typeof(OrderingWebModule);
}
public async Task<List<OrderDto>> GetListAsync()
@ -415,7 +358,7 @@ private void ConfigureAutoApiControllers()
options.ConventionalControllers.Create(typeof(ProductsApplicationModule).Assembly);
//ADD THE FOLLOWING LINE:
options.ConventionalControllers.Create(typeof(OrderingWebModule).Assembly);
options.ConventionalControllers.Create(typeof(OrderingModule).Assembly);
});
}
````
@ -442,32 +385,17 @@ If you check the database, you should see the entities created in the *Orders* t
## Creating the User Interface
### Creating a `_ViewImports.cshtml` File
Open the `ModularCrm.Ordering` .NET solution in your favorite IDE, locate the `ModularCrm.Ordering` project and create a `Pages` folder under that project. Then add a `_ViewImports.cshtml` file under that `Pages` folder with the following content:
````csharp
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling
````
That file imports some tag helpers from ASP.NET Core and ABP. The `Pages` folder should be like the following figure:
![visual-studio-pages-folder](images/visual-studio-pages-folder.png)
### Creating the Orders Page
Create an `Orders` folder under the `Pages` folder and add an `Index.cshtml` Razor Page inside that new folder. Then replace the `Index.cshtml.cs` content with the following code block:
Replace the `Index.cshtml.cs` content in the `Pages/Ordering` folder of the `ModularCrm.Ordering.UI` project with the following code block:
````csharp
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Collections.Generic;
using System.Threading.Tasks;
using ModularCrm.Ordering.Contracts.Services;
using Microsoft.AspNetCore.Mvc.RazorPages;
using ModularCrm.Ordering.Services;
namespace ModularCrm.Ordering.Pages.Orders
namespace ModularCrm.Ordering.UI.Pages.Ordering
{
public class IndexModel : PageModel
{
@ -488,11 +416,11 @@ namespace ModularCrm.Ordering.Pages.Orders
}
````
Here, we are injecting a repository to query `Order` entities from the database to show on the page. Open the `Index.cshtml` file and replace the content with the following code block:
Here, we are injecting `IOrderAppService` to query `Order` entities from the database to show on the page. Open the `Index.cshtml` file and replace the content with the following code block:
````html
@page
@model ModularCrm.Ordering.Pages.Orders.IndexModel
@model ModularCrm.Ordering.UI.Pages.Ordering.IndexModel
<h1>Orders</h1>
@ -514,87 +442,65 @@ Here, we are injecting a repository to query `Order` entities from the database
This page shows a list of orders on the UI. We haven't created a UI to create new orders, and we will not do it to keep this tutorial simple. If you want to learn how to create advanced UIs with ABP, please follow the [Book Store tutorial](../book-store/index.md).
### Building the Application
Now, we will run the application to see the result. Please stop the application if it is already running. Then open the *Solution Runner* panel, right-click the `ModularCrm.Web` application, and select the *Build* -> *Graph Build* command:
![abp-studio-solution-runner-graph-build](images/abp-studio-solution-runner-graph-build.png)
We've performed a graph build since we've made a change on a module, and more than building the main application is needed. *Graph Build* command also builds the depended modules if necessary. Alternatively, you could build the Ordering module first (on ABP Studio or your IDE), then right-click the `ModularCrm.Web` application and select the *Run* -> *Build & Start*. This approach can be faster if you have too many modules and you make a change in one of the modules.
### Running the Application
Run the main application on ABP Studio, manually type `/Orders` to the end of your application's URL to open the *Orders* page:
![abp-studio-solution-runner-orders-page](images/abp-studio-solution-runner-orders-page.png)
Great! We can see the list of orders. However, there are two problems:
1. The Order page has no menu item on the main menu. This is because we haven't configured the [navigation menu system](../../framework/ui/mvc-razor-pages/navigation-menu.md) yet.
2. We see Product's GUID ID instead of its name. This is because the Ordering module has no integration with the Products module and doesn't have access to Product module's database to perform a JOIN query.
We will solve the second problem in the [next part](part-06.md), but we can easily add a menu item for the Orders page now.
### Adding a Menu Item
### Editing the Menu Item
ABP provides a modular navigation [menu system](../../framework/ui/mvc-razor-pages/navigation-menu.md) where each module can contribute to the main menu dynamically.
Open the `ModularCrm.Ordering` .NET solution in your IDE and add the following `OrderingMenuContributor` class into the `ModularCrm.Ordering` project:
Edit the `OrderingMenuContributor` class into the `ModularCrm.Ordering.UI` project:
````csharp
using System.Threading.Tasks;
using Volo.Abp.UI.Navigation;
namespace ModularCrm.Ordering
namespace ModularCrm.Ordering.UI.Menus;
public class OrderingMenuContributor : IMenuContributor
{
public class OrderingMenuContributor : IMenuContributor
public async Task ConfigureMenuAsync(MenuConfigurationContext context)
{
public Task ConfigureMenuAsync(MenuConfigurationContext context)
if (context.Menu.Name == StandardMenus.Main)
{
if (context.Menu.Name == StandardMenus.Main)
{
context.Menu.AddItem(
new ApplicationMenuItem(
"ModularCrm.Orders.Index", // Unique menu id
"Orders", // Menu display text
"~/Orders", // URL
"fa-solid fa-basket-shopping" // Icon CSS class
)
);
}
return Task.CompletedTask;
await ConfigureMainMenuAsync(context);
}
}
private Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{
context.Menu.AddItem(
new ApplicationMenuItem(
OrderingMenus.Prefix, // Unique menu id
"Orders", // Menu display text
"~/Ordering", // URL
"fa-solid fa-basket-shopping" // Icon CSS class
)
);
return Task.CompletedTask;
}
}
````
`OrderingMenuContributor` implements the `IMenuContributor` interface, which forces us to implement the `ConfigureMenuAsync` method. In that method, we can manipulate the menu items (add new menu items, remove existing menu items or change the properties of existing menu items). The `ConfigureMenuAsync` method is executed whenever the menu is rendered on the UI, so you can dynamically decide how to manipulate the menu items.
After creating such a class, we should configure the `AbpNavigationOptions` to add that contributor. Open the `OrderingWebModule` class in the `ModularCrm.Ordering` project and add the following configuration code into the `ConfigureServices` method:
> You can check the [menu documentation](../../framework/ui/mvc-razor-pages/navigation-menu.md) to learn more about manipulating menu items.
````csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
//... other configurations
### Building the Application
Configure<AbpNavigationOptions>(options =>
{
options.MenuContributors.Add(new OrderingMenuContributor());
});
}
````
Now, we will run the application to see the result. Please stop the application if it is already running. Then open the *Solution Runner* panel, right-click the `ModularCrm.Web` application, and select the *Build* -> *Graph Build* command:
![abp-studio-solution-runner-graph-build](images/abp-studio-solution-runner-graph-build.png)
That's all. You can stop the main application (if it is already working), make a graph build on the main application, run it again on ABP Studio's *Solution Runner* panel and *Browse* it to see the result:
We've performed a graph build since we've made a change on a module, and more than building the main application is needed. *Graph Build* command also builds the depended modules if necessary. Alternatively, you could build the Ordering module first (on ABP Studio or your IDE), then right-click the `ModularCrm.Web` application and select the *Run* -> *Build & Start*. This approach can be faster if you have too many modules and you make a change in one of the modules. Now you can run the application by right-clicking the `ModularCrm.Web` application and selecting the *Run* -> *Start* command.
![abp-studio-browser-orders-menu-item](images/abp-studio-browser-orders-menu-item.png)
The *Orders* menu item is added under the *Products* menu item.
Great! We can see the list of orders. However, there is a problem:
> You can check the [menu documentation](../../framework/ui/mvc-razor-pages/navigation-menu.md) to learn more about manipulating menu items.
1. We see Product's GUID ID instead of its name. This is because the Ordering module has no integration with the Products module and doesn't have access to Product module's database to perform a JOIN query.
## Summary
We will solve this problem in the [next part](part-06.md).
In this part of the *Modular CRM* tutorial, we've built the functionality inside the Ordering module we created in the [previous part](part-04.md). Since we've created the Ordering module from scratch (with the *Empty Module* template), we had to implement many aspects manually, add ABP packages, create some configuration classes, etc. It is good to do all these manually for one time to learn the things, but it is better to use the other module templates (that pre-configure the fundamentals for us) for a more comfortable development experience.
## Summary
In the next part, we will work on establishing communication between the Orders module and the Products module.
In this part of the *Modular CRM* tutorial, we've built the functionality inside the Ordering module we created in the [previous part](part-04.md). In the next part, we will work on establishing communication between the Orders module and the Products module.

30
docs/en/tutorials/modular-crm/part-06.md

@ -26,9 +26,9 @@ Let's begin from the first one: The Integration Services.
## The Need for the Integration Services
Remember from the [previous part](part-05.md), the Orders page shows products' identities instead of their names:
Remember from the [previous part](part-05.md), the Orders page shows product's identities instead of their names:
![abp-studio-solution-runner-orders-page](images/abp-studio-solution-runner-orders-page.png)
![abp-studio-browser-orders-menu-item](images/abp-studio-browser-orders-menu-item.png)
That is because the Orders module has no access to the product data, so it can not perform a JOIN query to get the names of products from the `Products` table. That is a natural result of the modular design. However, we also don't want to show a product's identity on the UI, which is not a good user experience.
@ -152,8 +152,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ModularCrm.Ordering.Contracts.Enums;
using ModularCrm.Ordering.Contracts.Services;
using ModularCrm.Ordering.Enums;
using ModularCrm.Ordering.Entities;
using ModularCrm.Products.Integration;
using Volo.Abp.Application.Services;
@ -172,7 +171,6 @@ public class OrderAppService : ApplicationService, IOrderAppService
{
_orderRepository = orderRepository;
_productIntegrationService = productIntegrationService;
ObjectMapperContext = typeof(OrderingWebModule);
}
public async Task<List<OrderDto>> GetListAsync()
@ -182,7 +180,7 @@ public class OrderAppService : ApplicationService, IOrderAppService
// Prepare a list of products we need
var productIds = orders.Select(o => o.ProductId).Distinct().ToList();
var products = (await _productIntegrationService
.GetProductsByIdsAsync(productIds))
.GetProductsByIdsAsync(productIds))
.ToDictionary(p => p.Id, p => p.Name);
var orderDtos = ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
@ -213,9 +211,9 @@ And also, open the `OrderDto` class (the `OrderDto.cs` file under the `Services`
````csharp
using System;
using ModularCrm.Ordering.Contracts.Enums;
using ModularCrm.Ordering.Enums;
namespace ModularCrm.Ordering.Contracts.Services;
namespace ModularCrm.Ordering.Services;
public class OrderDto
{
@ -227,11 +225,11 @@ public class OrderDto
}
````
Lastly, open the `OrderingApplicationAutoMapperProfile` class (the `OrderingApplicationAutoMapperProfile.cs` file under the `Services` folder of the `ModularCrm.Ordering` project of the `ModularCrm.Ordering` .NET solution) and ignore the `ProductName` property in the mapping configuration:
Lastly, open the `OrderingAutoMapperProfile` class (the `OrderingAutoMapperProfile.cs` file under the `Services` folder of the `ModularCrm.Ordering` project of the `ModularCrm.Ordering` .NET solution) and ignore the `ProductName` property in the mapping configuration:
````csharp
using AutoMapper;
using ModularCrm.Ordering.Contracts.Services;
using ModularCrm.Ordering.Services;
using ModularCrm.Ordering.Entities;
using Volo.Abp.AutoMapper;
@ -262,7 +260,7 @@ Open the `Index.cshtml` file, and change the `@order.ProductId` part by `@Model.
````html
@page
@model ModularCrm.Ordering.Pages.Orders.IndexModel
@model ModularCrm.Ordering.UI.Pages.Ordering.IndexModel
<h1>Orders</h1>
@ -271,11 +269,11 @@ Open the `Index.cshtml` file, and change the `@order.ProductId` part by `@Model.
<abp-list-group>
@foreach (var order in Model.Orders)
{
<abp-list-group-item>
<strong>Customer:</strong> @order.CustomerName <br />
<strong>Product:</strong> @order.ProductName <br />
<strong>State:</strong> @order.State
</abp-list-group-item>
<abp-list-group-item>
<strong>Customer:</strong> @order.CustomerName <br />
<strong>Product:</strong> @order.ProductName <br />
<strong>State:</strong> @order.State
</abp-list-group-item>
}
</abp-list-group>
</abp-card-body>

13
docs/en/tutorials/modular-crm/part-07.md

@ -42,7 +42,7 @@ We've placed the `OrderPlacedEto` class inside the `ModularCrm.Ordering.Contract
````csharp
using System;
namespace ModularCrm.Ordering.Contracts.Events
namespace ModularCrm.Ordering.Events
{
public class OrderPlacedEto
{
@ -63,18 +63,16 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ModularCrm.Ordering.Contracts.Enums;
using ModularCrm.Ordering.Contracts.Events;
using ModularCrm.Ordering.Contracts.Services;
using ModularCrm.Ordering.Enums;
using ModularCrm.Ordering.Events;
using ModularCrm.Ordering.Entities;
using ModularCrm.Products.Integration;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus.Distributed;
namespace ModularCrm.Ordering.Services;
public class OrderAppService : ApplicationService, IOrderAppService
public class OrderAppService : OrderingAppService, IOrderAppService
{
private readonly IRepository<Order> _orderRepository;
private readonly IProductIntegrationService _productIntegrationService;
@ -88,7 +86,6 @@ public class OrderAppService : ApplicationService, IOrderAppService
_orderRepository = orderRepository;
_productIntegrationService = productIntegrationService;
_distributedEventBus = distributedEventBus;
ObjectMapperContext = typeof(OrderingWebModule);
}
public async Task<List<OrderDto>> GetListAsync()
@ -174,7 +171,7 @@ Open the Product module's .NET solution in your IDE, locate the `ModularCrm.Prod
Replace the `OrderEventHandler.cs` file's content with the following code block:
````csharp
using ModularCrm.Ordering.Contracts.Events;
using ModularCrm.Ordering.Events;
using System;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;

Loading…
Cancel
Save