Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the ABP startup template in ABP vNext

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about what the ABP startup template in ABP vNext is, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Preface

The startup template for ABP is described below. You can get this startup template using the ABP CLI command, which contains some basic functional modules, which you can quickly develop based on this template.

Start

First of all, the installation of ABP CLI and the basic instructions do not say these, the official website is very clear. Currently, the front-end part of ABP only supports ASP.NET Core MVC / Razor Pages and Angular, while the mobile terminal supports React Native.

Beginners suggest following the guidelines of the official website https://docs.abp.io/zh-Hans/abp/latest/Tutorials/Part-1?UI=MVC to experience the basic process of ABP development. Although the ABP development process is almost standardized, writing code according to the process of the official website can complete the development of a function, but this process is somewhat tedious and error-prone.

AbpHelper

Using AbpHelper to complete the example of the official website is very easy. First, create a project solution:

AbpHelper provides graphical configuration to automatically help us execute ABP CLI instructions:

When the execution is complete, open the solution and start the Acme.BookStore.DbMigrator project to initialize the database:

You can then start the Acme.BookStore.Web project, which is the default interface for the APB startup template:

Next, I create a Book entity in the Acme.BookStore.Domain project, and I copy the code directly from the official website.

Public class Book: AuditedAggregateRoot

{

Public string Name {get; set;}

Public BookType Type {get; set;}

Public DateTime PublishDate {get; set;}

Public float Price {get; set;}

Protected Book ()

{

}

Public Book (Guid id, string name, BookType type, DateTime publishDate, float price)

: base (id)

{

Name = name

Type = type

PublishDate = publishDate

Price = price

}

}

Add the enumeration class BookType to the Acme.BookStore.Domain.Shared project:

Public enum BookType

{

Undefined

Adventure

Biography

Dystopia

Fantastic

Horror

Science

ScienceFiction

Poetry

}

You need to install AbpHelper CLI for the first time:

Select Generate CRUD, enter the entity name and solution path, and then Execute:

This error may be reported when generating code (if ef tools is not installed):

Just install ef tools at this time, dotnet tool install-g dotnet-ef

After the code is generated, run the Acme.BookStore.Web project:

Log in to the system using the default user admin/1q2w3E* and assign BookStore-related permissions to the admin role:

Then you can see the book menu, including the basic add, delete, modify and query interface:

This completes the development of a basic function, AbpHelper is indeed very convenient, he also has the CLI version, direct command line operation.

Module installation

ABP modularization can achieve plug-in development, you can build some general modules in advance, such as log module, user module, etc., when you need it later, you can install it directly into the project. There are some open source free application modules developed and maintained by the ABP community that we can use directly; for example, I'm going to use the official Blogging module, and Blogging is used to create beautiful blogs.

Also use AbpHelper to install:

There was a slight problem with the installation process, indicating that DbContext could not be found. But it doesn't matter, just execute the migration command yourself.

The Acme.BookStore.Web project is set as the startup item, and the default project is Acme.BookStore.EntityFrameworkCore.DbMigrations, and then execute:

Add-Migration AddedBlogging

Update-DataBase

Next, run the Acme.BookStore.Web project again to configure blog-related permissions for the admin role:

Then you can see the relevant functions of the blog:

Swagger:

Of course, these modules may not fully meet your requirements, you may need to make minor changes, ABP also allows you to extend the entity, rewriting services include rewriting the user interface, you can easily modify.

After reading the above, do you have any further understanding of what the ABP startup template is in ABP vNext? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report