SaigonMio.Generata
1.1.36
dotnet tool install --global SaigonMio.Generata --version 1.1.36
dotnet new tool-manifest
dotnet tool install --local SaigonMio.Generata --version 1.1.36
#tool dotnet:?package=SaigonMio.Generata&version=1.1.36
nuke :add-package SaigonMio.Generata --version 1.1.36
Mio.Generata
A CLI tool to generate project structure including Areas, Controllers, Views, Models, ViewModels, Interfaces, Services, and basic CRUD operations πΌ.
Mio.Generata simplifies the process of scaffolding an ASP.NET Core MVC project by automating the creation of essential components with customizable options like AJAX-based CRUD and compatibility with older codebases. Built with love by Mr.Banh, it even comes with cute worm (π) and cat (π) animations to make your coding experience more enjoyable!
Features
- Full Project Structure: Generates Areas, Controllers, Views, Models, ViewModels, Interfaces, and Services.
- CRUD Operations: Automatically includes basic Create, Read, Update, Delete functionality.
- Single or Multiple Models: Supports generating structures for one or multiple models at once.
- AJAX Support: Optional modal-based create/update with AJAX.
- Backward Compatibility: Works with older projects missing
MioBaseController. - Fun Animations: Watch worms and cats dance across your terminal as files are created!
Installation
Install Mio.Generata as a global .NET tool using the following command: dotnet tool install -g Mio.Generata
To update to the latest version: dotnet tool update -g Mio.Generata
Usage
Command Syntax
Single Model
generata gen <area-name> <model-name> [<root-path>] [options]
Multiple Models
generata gen <area-name> <model-name1>:<model-name2>:<model-name3> [<root-path>] [options]
Arguments
<area-name>: The name of the Area (e.g.,Blog). Required.<model-name>: The name of the Model (e.g.,Blog). For multiple models, separate with:(e.g.,Blog:Post:Comment). Required.<root-path>: The root directory of your project containing the.csprojfile. Optional if you're already in the project directory.
Options
-a, --ajax: Enables AJAX-based create/update modals (default:false).-e, --enable-old: Enables compatibility with older projects lackingMioBaseController(default:false).--check: Checks for and installs the latest version of Mio.Generata.
Examples
Generate MVC CRUD
This creates a Blog area with a Blog model, including all necessary files for standard MVC CRUD. generata gen Blog Blog D:\0_Project\MioCenter_BE\MioCenter.CompanySite
Generate AJAX CRUD
Same as above, but with AJAX-enabled create/update modals. generata gen Blog Blog D:\0_Project\MioCenter_BE\MioCenter.CompanySite --ajax
Generate Multiple Models
Generates structures for Product, Category, and Order models within the Shop area.
Run in Current Directory
If you're already in the project folder: generata gen Blog Blog
Output
The tool creates a structured project with folders and files like this: MioCenter.CompanySite/ βββ Areas/ β βββ Blog/ β β βββ Controllers/ β β β βββ BlogController.cs β β βββ Views/ β β β βββ Blog/ β β β βββ Index.cshtml β β β βββ BlogForm.cshtml (if not using --ajax) β β βββ _ViewImports.cshtml β β βββ _ViewStart.cshtml βββ MioCenter.Core/ β βββ Models/ β β βββ Blogs/ β β βββ Blog.cs β βββ ViewModel/ β β βββ Blogs/ β β βββ BlogViewModel.cs βββ MioCenter.Services/ β βββ Interfaces/ β β βββ Blogs/ β β βββ IBlogService.cs β βββ Services/ β β βββ Blogs/ β β βββ BlogService.cs
Notes
- Migration: If you generate a new model, donβt forget to run
dotnet ef migrations add <MigrationName>in your project. - Rollback: If something goes wrong, the tool will attempt to delete created files. You can also use
git reset --hardto discard changes. - Requirements: Ensure your project is an ASP.NET Core MVC project and you're running .NET 6.0 or later.
Troubleshooting
- "Could not find CompanySite or AdminSite": Check your
<root-path>or ensure you're in the correct directory. - File already exists: The tool skips existing files and notifies you with a π symbol.
- Errors during generation: Check the console output for details and clean up with Git if needed.
Author
Mr.Banh (Cake) π
A developer who loves automation, cats (π).
Happy coding!πΊ
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.