Browse Source

Merge pull request #21578 from abpframework/auto-merge/rel-9-0/3280

Merge branch dev with rel-9.0
pull/21580/head
maliming 2 years ago
committed by GitHub
parent
commit
55538e3cb5
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      docs/en/tutorials/book-store-with-abp-suite/part-01.md
  2. 62
      docs/en/tutorials/book-store-with-abp-suite/part-02.md
  3. 4
      docs/en/tutorials/book-store-with-abp-suite/part-03.md
  4. 2
      docs/en/tutorials/book-store-with-abp-suite/part-04.md

7
docs/en/tutorials/book-store-with-abp-suite/part-01.md

@ -10,6 +10,10 @@
````json
//[doc-nav]
{
"Previous": {
"Name": "Overview",
"Path": "tutorials/book-store-with-abp-suite/index"
},
"Next": {
"Name": "Creating the Books",
"Path": "tutorials/book-store-with-abp-suite/part-02"
@ -21,11 +25,14 @@ Before starting the development, create a new solution named `Acme.BookStore` an
You can use the following configurations:
* **Solution Template:** Application (Layered)
* **Solution Name:** `Acme.BookStore`
* **UI Framework:** {{if UI=="MVC"}} ASP.NET Core MVC / Razor Pages {{end}}
* **UI Theme:** LeptonX
* **Mobile Framework:** None
* **Database Provider:** {{if DB=="EF"}} Entity Framework Core {{end}}
* **Public Website:** No
* **Tiered:** No
You can select the other options based on your preference.

62
docs/en/tutorials/book-store-with-abp-suite/part-02.md

@ -36,7 +36,28 @@ After clicking the related command, pre-integrated browser of ABP Studio should
## Creating the Book Entity
Let's create a `Book` entity with some properties. First, type `Book` for the *Name* field and leave the other options as is. ABP Suite automatically calculates proper values for the rest of the inputs for you:
Before creating the `Book` entity, first we can create a `BookType` enum in the `Acme.BookStore.Domain.Shared` project under the **Books** folder as follows:
```csharp
namespace Acme.BookStore.Books;
public enum BookType
{
Undefined,
Adventure,
Biography,
Dystopia,
Fantastic,
Horror,
Science,
ScienceFiction,
Poetry
}
```
After creating an _enum_ file in your project, you can define it as a property while creating the entity. ABP Suite asks for an enum path to read the enum file, and set the namespace, and enum name in the generated code accordingly. Then, you can create the `Book` entity with some properties.
Type `Book` for the *Name* field and leave the other options as is. ABP Suite automatically calculates proper values for the rest of the inputs for you:
![](./images/suite-book-entity-1.png)
@ -55,10 +76,16 @@ After, specifying the entity metadata, open the *Properties* tab and create the
![](./images/suite-book-entity-3.png)
Here the details:
While defining the properties, you define a *Type* property with the type of *enum*. ABP Suite asks for an enum path and fill the all other inputs by reading the specified enum file. Therefore, you can specify the enum path for the `Type` property like in the following figure:
![](./images/suite-book-entity-4.png)
> After you select the enum file, ABP Suite automatically sets the namespace and enum name, and lists your enum values in the next section. You can change these values, but for now, you can leave as is.
Here is the all details for the `Book` entity:
* `Name` is **required**, it's a **string** property and maximum length is **128**.
* `Type` is an **enum** and the enum file path is *\Acme.BookStore.Domain.Shared\Books\BookType.cs* (we will create the file, in the next section).
* `Type` is an **enum** and the enum file path is *\Acme.BookStore.Domain.Shared\Books\BookType.cs*.
* `PublishDate` is a **DateTime** property and **not nullable**.
* `Price` is a **float** property and **required**.
@ -66,33 +93,6 @@ You can leave the other configurations as default.
> ABP Suite allows you to define properties with a great range of options, for example, you can specify the property type as *string*, *int*, *float*, *Guid*, *DateTime*, and even *File* (for file upload) and also you can set any options while defining your properties, such as specifying it as *required*, or *nullable*, setting *max-min length*, *default value* and more...
While defining the properties, you defined a *Type* property with the type of *enum*. ABP Suite asks for an enum path to read the enum file, and set the namespace, and enum name in the generated code.
For that purpose, you should create a `BookType` enum in the `Acme.BookStore.Domain.Shared` project under the **Books** folder as follows:
```csharp
namespace Acme.BookStore.Books;
public enum BookType
{
Undefined,
Adventure,
Biography,
Dystopia,
Fantastic,
Horror,
Science,
ScienceFiction,
Poetry
}
```
Then, you can specify the enum path for the `Type` property in ABP Suite like in the following figure:
![](./images/suite-book-entity-4.png)
> After you select the enum file, ABP Suite automatically sets the namespace and enum name, and lists your enum values in the next section. You can change these values, but for now, you can leave as is.
After that, you can click the **Save and Generate** button to start the code generation process:
![](./images/suite-book-entity-5.png)
@ -106,7 +106,7 @@ ABP Suite will generate the necessary code for you. It generates:
* **Unit & integration tests**,
* A new **migration** (and also applies to the database),
* All related **permission**, **object mapping** and **navigation menu item** configurations,
* and all required **UI components and pages**.
* and all required **UI components and pages**...
It will take some time to complete the process. After the process is completed, you will see a success message, you can click the *Ok* button, and build & start the application by clicking the *Run -> Build & Start* button in the *Solution Runner* panel:

4
docs/en/tutorials/book-store-with-abp-suite/part-03.md

@ -50,9 +50,9 @@ After, specifying the entity metadata, open the *Properties* tab and create the
Here the details:
* `Name` is **required**, it's a **string** property, and it's a **textarea**. Minimum length is **2** and maximum length is **128**.
* `Name` is **required**, it's a **string** property. Minimum length is **2** and maximum length is **128**.
* `BirthDate` is a **DateTime** property and **not nullable**.
* `ShortBio` is a **string** property, it's **required**, maximum length is **256**.
* `ShortBio` is **required**, it's a **string** property, it's a **textarea**, maximum length is **256**.
You can leave the other configurations as default.

2
docs/en/tutorials/book-store-with-abp-suite/part-04.md

@ -49,6 +49,8 @@ Here is the details:
* Selected the display property as *Name*, this will be used in the dropdown component to set an author with a book & also it will be shown in the datatable of the *Books* page.
* Also, made the relation **required** and set it **filterable** so books can be filterable by authors.
> **Note**: You should delete all existing books in the database (if any), before the code generation. Because, a new foreign-key will be added to the _books_ table and if there is any record in the table, then a new migration can't apply to the database and you may need to update the database manually.
After, specifying the metadata, you can click the *Ok* button to close the modal. Then, click the **Save and generate** button to start code generation process. ABP Suite will establish one-to-many relationship between the entities, and will generate all necessary code automatically:
![](./images/suite-end-of-generation-modal.png)

Loading…
Cancel
Save