Skip to content

An VS 2022 extension to generate all files (Consts, Interface, Repository, Dto, AppService, Permission, Menu, Pages...) for an Entity of ABP vNext framework.

Notifications You must be signed in to change notification settings

Kenjiang110/abpGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Using GitHub to maintain an open source project, I am a beginner, so any advice is welcome.

This project is a tool I developed myself while using the abp vNext framework to build applications, and it serves as a plugin for VS2022. I use Vue templates to generate code, so you can easily change it to generate any code you want.

To get started, please download the source code and build it.

To build it, you will need to add the VS Extension and WPF development support for VS.

Then, locate the Bob.Abp.AppGen.vsix file and double-click to install the plugin.

Next, create an Entity class in the Domain project.

Currently, I can only support AggregateRoot and Entity, but you can easily modify the generated source code.

After creating the class file (e.g. Country.cs), right-click it and find the "Bob Abp Assistant" menu:

right click domain file and choose 'Bob ABP assistant'

  • Extract Information File: This will create a file with the name *.json (e.g. Country.cs.json)
  • Edit Information File: Use the UI to modify the JSON file. You can also directly modify this file as it is easy to understand.

edit ui - basic edit ui - properties edit ui - groups edit ui - generations

  • Generate Codes: This will generate multiple code files for the entity, but you can choose which files to generate:
    • Contracts_Dtos:
      • xxxxDto.cs (Application.Contracts)
      • xxxxRequestDto.cs (Application.Contracts)
      • xxxxCreateOrUpdateDtoBase.cs (Application.Contracts)
      • xxxxCreateDto.cs (Application.Contracts)
      • xxxxUpdateDto.cs (Application.Contracts)
    • Contracts_RemoteServiceConsts
      • RemoteServiceConsts.cs (Application.Contracts)
    • MongoDB_Repository
      • xxxxConsts.cs (Domain.Shared, string properties' max length)
      • IxxxxRepository.cs (Domain, entity's IRepository interface )
      • I****MongoDbContext.cs (MongoDB, add DbSet in DbContext interface)
      • ****MongoDbContext.cs (MongoDB, add DbSet in DbContext class)
    • EntityFrameworkCore_Repository
      • xxxxConsts.cs (Domain.Shared, string properties' max length)
      • IxxxxRepository.cs (Domain, entity's IRepository interface )
      • xxxxRepository.cs (EntityFrameworkCore, Repository class)
      • I****DbContext.cs (EntityFrameworkCore, add DbSet in DbContext interface)
      • ****DbContext.cs (EntityFrameworkCore, add DbSet in DbContext class)
      • ****DbContext.cs (EntityFrameworkCore, add builder.Configure() to OnModelCreateing())
      • ****DbContextModelCreatingExtensions.cs"(EntityFrameworkCore, add ConfigureXxxx() to OnModelCreateing())
    • Permission
      • ****Permissions.cs (Application.Contracts, Permission consts for entity)
      • ****PermissionDefinitionProvider.cs (Application.Contracts, Permission Definition for entity)
    • AppService
      • IxxxxAppService.cs (Application.Contracts, entity's IAppService interface)
      • ****ApplicationAutoMapperProfile.cs (Application, Dto-Entity AutoMapper define)
      • xxxxAppService.cs (Application, entity's AppService class)
    • Web_ViewModel
      • ****WebAutoMapperProfile.cs (Web, Dto-ViewModel AutoMapper define)
      • xxxxInfoModel.cs (Web, entity's base ViewModel)
    • HttpApi_Controller
      • xxxxController.cs" (HttpApi, entity's api Controller)
    • Web_Menu
      • MenuItemInfo.cs (Web, base menu item info class)
      • ****Menus.cs (Web, entity's menu consts)
      • ****MenuContributor.cs (Web, add entity's menu item)
    • Web_Pages
      • ****WebModuleConfigureExtensions.cs (Web, entity index page's toolbar definition)
      • ****WebModuleConfigureExtensions.cs (Web, entity pages' authorization)
      • xxxx/Index.cshtml
      • xxxx/Index.cshtml.cs
      • xxxx/Index.js
      • xxxx/CreateModal.cshtml
      • xxxx/CreateModal.cshtml.cs
      • xxxx/EditModal.cshtml
      • xxxx/EditModal.cshtml.cs
    • Web_Page_ExtraJs,
      • xxxx/CreateModal.js ( Js file to support Extra create Tab)
      • xxxx/EditModal.js ( Js file to support Extra edit Tab)

It can add language resource, but you need to edit the information file directly:

language resource

I recommended using safe mode: you can remove or back up the files yourself to avoid overwriting.

generate prompt

About

An VS 2022 extension to generate all files (Consts, Interface, Repository, Dto, AppService, Permission, Menu, Pages...) for an Entity of ABP vNext framework.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published