Blazor Code Generator

Blazor Code Generator Tool



Hello. Do you use Blazor for your projects? Do you have created many pages like create product, edit product or create table that lists your products? And you have many tasks like this. 

Do you ever feel you are doing repeated work and it takes your efforts. Do you ever find any tool to boost your work? If one of these answers is true, this post is for you.

I have a similar issue and don't find any tool on the internet. So I decided to create the tool that will help me save time and effort.

The idea is when opening the tool, we select page types (Create, update, list, detail, delete confirm), and select class (model) for each type. The tool will generate .razor files.

Now I will tell detail about the tool

You can download tool at here: 

Link Google Driver

Password: blazor

After extract the tool, you need to add the folder to system path to open tool at any location. The tool is using .NET 7 and feel free to install it if your Windows require.

Open project location then enter at cmd: 'blazortool' to open tool at exact location:



Tool will show like this:


    Note for tool:

    1. The tool will start and select the location where you opened it. You can browse to another code location.
    2. Press Parse to parse all classes. The tool will get all classes from .cs files in the code location and its subfolders.
    3. Browse to the location where the codes will be generated. This is usually the Pages folder.
    4. Enter the Model name. The tool will generate a new folder and Razor files based on the model name you enter.
    5. Select the pages that you want to generate. The tool will not generate any pages if you do not select any classes or uncheck Generate.
    6. Press Save to start generate

Note: The current version only supports basic public fields or properties of the following types: numeric (int,long,short,ushort, float, double, decimal), bool, string, and DateTime.

 Assume you have a model needs to generate (Example: Person):



 Razor files will be generated:



 Look at .razor file generated:



 Now, let's try the result











    • Note: I'm creating demo data, in your case, you need to get real data for all pages. I am using one model for all page types. In real project, each page type can be a different model

 Done, I hope this tool will help you. And feel free to contribute this tool better


Nhận xét

Bài đăng phổ biến từ blog này

Hello .NET Blog

Blazor Tri-State bool with checkbox