ABP Suite: Best CRUD Page Generation Tool for .NET
Tags: dotnet, codegeneration, csharp, abpsuite
Published: 2024-02-14 09:49:27

In this article, I will list some CRUD page generation/code generation tools for .NET and then we will explore the ABP Suite that empowers .NET developers to generate CRUD pages and is distinguished from other tools by its features and user-friendly UI. 

## Code/CRUD Page Generation Tools

There are some CRUD page generation tools that you may already know as listed below:

* [ABP Suite (supports plenty of UI options - MVC, Blazor WASM, Blazor Server, Angular, etc. - also supports mobile options)](https://commercial.abp.io/tools/suite)
* [Radzen (only supports Blazor & Angular)](https://www.radzen.com/documentation/)
* [CodeSmith Generator](https://www.codesmithtools.com/product/generator#overview)
* Also, there are a bunch of open-source code generation tools with limited options...

Among these code-generation tools, ABP Suite is in a special place in my opinion. It's not just related to working on it, but also its capabilities, and what it's providing is really noteworthy. Therefore, in the following section, I want to mention what ABP Suite is and some of its capabilities.

> If you are looking for a code generation tool that's gonna speed up your business, I highly recommend you to check the [ABP Commercial](https://commercial.abp.io/), try its demo, and see all of its capabilities.

## ABP Suite

[ABP Commercial](https://commercial.abp.io/) is a complete web development platform built on [open-source ABP Framework](https://abp.io/).

[ABP Suite](https://commercial.abp.io/tools/suite) is a complementary tool to [ABP Commercial](https://commercial.abp.io/) and allows you to build web pages in a matter of minutes.

**ABP Suite** allows you to easily create CRUD pages. You just need to define your entity and its properties and let the rest go to ABP Suite for you! ABP Suite generates all the necessary code for your CRUD page in a few seconds. It supports Angular, MVC, and Blazor (both Blazor Server and Blazor WASM) UIs.

### Creating A New Solution

You can create a new solution from the ABP Suite UI, by selecting one of the [startup templates provided by ABP Commercial](https://docs.abp.io/en/commercial/latest/startup-templates/index).

![ABP Suite - Creating a new solution](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ozbsvlvxcqydboz43g8k.png)

You can select a **template type**, **project name**, **output folder** where the project will be created, **UI Framework** as your front-end, **mobile** option (React Native or MAUI), **database provider**, **database management system** (if the database provider is Entity Framework Core), **connection string**, **theme** and more...

> [See the documentation](https://docs.abp.io/en/commercial/latest/abp-suite/create-solution) for all other options and their descriptions.

### Generating CRUD Pages

When you add an existing project or create a new one, the project will be listed in the "Open Recent" section. Then, you can select the project, and start generating CRUD pages.

![ABP Suite - Generating CRUD Pages](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6vg7h61f0fkeww2qotl.png)

ABP Suite provides the following features for code generation:

* [Creating One-To-Many & Many-To-Many Relationships](https://docs.abp.io/en/commercial/latest/abp-suite/creating-many-to-many-relationship)
* [Generating CRUD Pages From an Existing Database Table](https://docs.abp.io/en/commercial/latest/abp-suite/generating-entities-from-an-existing-database-table)
* [Customizable Code Support (allows you to customize the generated code to your needs)](https://docs.abp.io/en/commercial/latest/abp-suite/customizing-the-generated-code)
* [Creating Master-Detail (Master/Child) Relationship](https://docs.abp.io/en/commercial/latest/abp-suite/creating-master-detail-relationship)

Let's deep-dive into these features and see them one by one.

#### Creating One-to-Many & Many-to-Many Relationship

ABP Suite allows you to create one-to-many and many-to-many relationships. You only need to click the **Navigations** tab and click either the **Add navigation connection (n-n)** button to establish a many-to-many relationship or the **Add navigation property (1-n)** button to establish a one-to-many relationship.

![ABP Suite - One to many relationship / ABP Suite - Many to many relationship](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/di2g1jspxmgh7qdca74m.png)

When you establish a many-to-many relationship, ABP Suite will do the rest for you and generate a join entity (also join table in the database) and all of the required codes by following DDD principles.

For example, if you establish a many-to-many relationship between the **Book** and **Category** entities, then ABP Suite creates the related join table named **"BookCategories"**:

![ABP Suite - Many to many relationship](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mlsf9xv4c91952rdc1r0.png)

Also, if you selected the **Create User Interface** option, it creates the related web page for you as in the following figure:

![ABP Suite - Many to many relationship - BookCategories](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfgsy36dbghjuuo856iq.png)

It's the same if you establish a one-to-many relationship. ABP Suite adds the related navigation property to the related entity and generates all related codes for you, including **export to excel** support, **customizable code support**, **web pages**, **unit tests**, **advanced filters**, and more according to the enabled options...

#### Generating CRUD Pages From an Existing Database Table

If you have an existing database table, you can generate the entities using ABP Suite and create a CRUD page based on those entities.

You first need to create an application from ABP Suite or add an existing project. Then, after opening the project in [ABP Suite](https://commercial.abp.io/tools/suite), you can scroll down to the bottom and click the **Load Entity From Database** button:

![ABP Suite - Load Entity from Database](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fjh3pgbzsj8r4phoftm4.png)

A modal will be opened, and then you can specify the connection string for your database, test the connection, and click the **Connect** button to allow ABP Suite to list all tables for you:

![ABP Suite - Tables Loaded from Database](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aenuc04i9h3iz4ta01h2.png)

Then, you can uncheck the related properties such as **Id**, **ConcurrencyStamp** and others, you can click the **"Ok"** button.

After that, ABP Suite will auto-fill all related entity metadata for you in the UI, and then you can revise them and by clicking the **"Save and generate"** button, you can generate the related entity within seconds.

Here is the video that summarizes the process:

{% embed https://www.youtube.com/embed/RMphf3kozy8?si=EHBOA98f0OnKINSh" %}

#### Customizable Code Support

ABP Suite allows you to customize the generated code blocks and preserve your custom code changes in the next CRUD Page Generation. It specifies hook points to allow adding custom code blocks. Then, the code written by you to these hook points will be respected and will not be overridden in the next CRUD Page Generation.

![ABP Suite - Customizing the Generated Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gw5ufik3p0oo1613ua4b.png)

To enable custom code support, you should check the Customizable code option in the CRUD Page Generation page (it's selected by default). When you enable the custom code support, you will see some hook points in your application on both the backend and UI side.

On the C# side (backend), you'll be seeing some abstract classes and classes that derive from them (for entities, application services, interfaces, domain services, and so on ...) according to the template that you have created.

You can write your custom code in those classes (with the `*.Extended.cs` extension) and next time when you need to re-generate the entity, your custom code will not be overridden (only the base abstract classes will be re-generated and your changes on Suite will be respected).

![ABP Suite - Backend - C# Side Customizations](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtyvc71uroeowdmc6fqe.png)

Let me share an example from the [documentation](https://docs.abp.io/en/commercial/latest/abp-suite/customizing-the-generated-code):

| `IBookRepository.Extended.cs` | `EfCoreBookRepository.Extended.cs` |
|---|---|
| ![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uknbh7thozk83l1hgsvr.png) | ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8w1dgjkeckxs53sisjam.png) | 
| _defining a new method in the `IBookRepository` interface_ |  _implementing the method in the `EfCoreBookRepository` class_  |

As can be seen in the example above, if you write your custom code in the `*.Extended.cs` files, then in the next generation, all of the code written by you, will be preserved and not overridden. Thus, you have an option to customize the generated code, by overriding the related methods and also you can extend the generated codes according to your needs.

For the UI side, ABP Suite provides convenient comment placeholders within pages for MVC, Blazor, and Angular UIs. 

![ABP Suite - Fronend - UI Side Customizations](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0jjh79taprlc1ffkojzj.png)

For example, in the screenshot above, you can see the example placeholders (hook-points) for MVC/Razor Pages, where you can write your custom code and make customizations on the page. 

In addition to these hook points, you can also add new custom hook points and change their places. You can check [this documentation](https://docs.abp.io/en/commercial/latest/abp-suite/customizing-the-generated-code#adding-new-custom-hook-points-changing-their-places) to see how it can be done.

> For all of the customization tips and directives, please refer to the documentation: [https://docs.abp.io/en/commercial/latest/abp-suite/customizing-the-generated-code](https://docs.abp.io/en/commercial/latest/abp-suite/customizing-the-generated-code)

#### Creating Master-Detail (Master/Child) Relationship

ABP Suite allows you to create a master-detail relationship with a few clicks. It generates the necessary code for the master and detail tables, including the foreign key relationship between the two tables.

To establish a master-detail relationship, you can apply the following steps:

1. Creating the master entity
2. Creating the child entity and associating it with a master entity

For example, let's assume you want to establish a master/child relationship between the **Order** and **OrderDetail** entities, in that case, you first need to create the **Order** entity and then you can create the **OrderDetail** entity and specify its entity type as **Child** like in the following screenshot:

![ABP Suite - Generating Master/Child Relationship](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e2x2gydjdcqs95hu8qr8.png)

Then, after the code generation, if you run the application, you will see an output as follows:

![ABP Suite - Generating Master/Child Relationship - Order/OrderDetail](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9fsuoskzqy9vne4usp33.png)

As you can see, you have a parent data grid and child data-grids for each order record. You can create your orders from this page and add order lines for each order. So, you can manage all of the orders and order lines from a central point and filter them, or export all of the orders to an Excel file and more...

> If you want a quick overview of these features (customizable code support, establishing one-to-many and many-to-many relationships, creating master/detail relationships, and more), you can check the [ABP Suite Webinar 2024 Demo video from YouTube](https://www.youtube.com/watch?v=t0aWk5HMoDs).

> If you are looking for complete instructions and descriptions for ABP Suite, you can check the [ABP Suite docs](https://docs.abp.io/en/commercial/latest/abp-suite/index) and webinars organized by the core ABP Framework team: 
* ["Take a closer look at the code generation: ABP Suite"](https://www.youtube.com/watch?v=RFArBh60RSA)
* ["Explore the potential of code generation: ABP Suite"](https://www.youtube.com/watch?v=0CJxCfhAyiA).

### Other Features

ABP Suite's features are not limited to the features described in the previous sections. It provides so many features, that it makes it impossible to mention all of them, but here are some of the other features:

* [Updating NPM & NuGet Packages Automatically](https://docs.abp.io/en/commercial/latest/abp-suite/updating-packages)
* [Editing / Customizing Templates](https://docs.abp.io/en/commercial/latest/abp-suite/editing-templates)
* [Accessing the Source Code Of Modules](https://docs.abp.io/en/commercial/latest/abp-suite/source-code)
* ...

## Conclusion

In conclusion, ABP Suite is a game-changer in the realm of application development. Its modular design (comes from [ABP Framework](https://abp.io/)), powerful code generation, and support for modern frontend frameworks make it a go-to choice for developers looking to build scalable and feature-rich applications. Whether you are working on a small project or a large enterprise application, ABP Suite provides the tools you need to succeed in your development endeavors.