ABP development framework front and back end development series — experience summary of the latest version of (16) ABP framework upgrade


There has been no continuous upgrade of the ABP framework for a short time. Recently, the ABP framework has been comprehensively updated in response to the needs of customers. As the ABP framework we applied, the official content will still be used in the basic part. Therefore, when upgrading, we need to comprehensively update the official basic ABP DLL and the corresponding reference DLL synchronously. However, there are still many strange problems in the upgrade process. This essay makes a series of summary for the situation, so as to have a reference later.

1. Latest case source code and nugget package update

The update speed of ABP’s official basic modules is still very fast. After a period of time, several version numbers have been skipped. I update nugget manually based on the old version, but nugget based on vs always updates the button, which unconsciously has no response, seriously affecting the development efficiency. Therefore, first update the source code of relevant parts from the official download demo case.

The official case source code download address is: https://aspnetboilerplate.com/templates

1) Source code structure and content adjustment of the latest case

We download the corresponding source code from it, and then use the beyond compare comparison file to compare the files one by one according to the corresponding source code file in the project structure. In principle, except for the part of personal expansion, the official source code practice is the standard.

At present, the latest official DLL version of ABP is 5.3.0, and the demo version that can be downloaded is 5.2.0. They should have little difference. The source structure of the downloaded aspnet core section is shown below.

On this basis, our ABP framework optimizes the structure to make the development more convenient and fast, and uses the code generation tools quickly.

Our vs project structure is as follows.

The above is the project structure of solutions in vs. according to the relationship between projects, I collated an architecture diagram, as shown below.

In the above figure, the orange part is the class or interface we added for each layer, and the sequence number on the layer is the content we need to deal with step by step.

The application service layer is the soul of the whole ABP framework. It can process the data of internal collaborative storage objects and provide the web for external cooperation with web.core and web.host projects API services, while web.core and web.host projects hardly need to be modified, so the application service layer is a very critical part, which needs to consider the authentication of user login, the authentication of interface authority, the record processing of audit log, as well as the tracking and transmission of exceptions. Basically, the application service layer is a role of the general manager, and its importance is self-evident.

After reviewing the structure of our modified ABP development framework, we return to the main body of version upgrade.

At present, I upgrade the version of VS to the latest. The. Net framework supports 4.8, and the latest version of dotnetcore 3.1 is installed separately, so the environment is the latest, and the basic ABP 5.3.0 also uses. Net core 3.1.

Compared with the source code, we can find that there are some differences between web.host and web.core projects. The ihosting environment has been abandoned and replaced by the latest object iwebhostenvironment of dotnetcore.

Replace the latest source code as

So the module class in the web. Host project is also adjusted.

The module in the corresponding web.core project has also been adjusted.


2) Nugget package update

In principle, you can select a single project to update nugget package or the whole solution to update the package. The former may be faster, while the latter may be slower due to the number of solution projects.

My early basic ABP version was 4.9, so I wanted to update the package of the whole solution at one time. However, I tried many times and spent several hours, but I couldn’t update all the projects smoothly, so the update of a single project was very slow.

Therefore, it is also recommended to use nugget’s latest address for update, and the update source is set as follows.

Add to the package source: https://api.nuget.org/v3/index.json


The response speed is relatively fast, and there is no problem not often.

If we need to update the package of a project separately, we need to select the project and select [manage nugget package] to enter the interface update. As shown in the following interface.

In general, we recommend a comprehensive package update for the whole solution. Select the solution as follows, and then enter the corresponding nugget package management interface to update.

If the package of such a complete update solution can be successfully completed, it will be very happy, but it may be a little slower. If not, update the packages one by one.

When I chose to update in this way, there were always one or two package update errors, so I only used NPM console to upgrade separately.


2. ABP framework base class encapsulation interface name adjustment

When updating the ABP basic module, it is found that all the basic interfaces of ABP have been renamed. For example, the original get changes to getasync, getall changes to getallasync, delete changes to deleteasync, update changes to updateasync, and create changes to createasync.

In other words, they all adopt the naming rules of asynchronous names, and all asynchronous methods are marked with async.

I introduced the basic interface of ABP framework in the previous module. Iasynccrudappse defines several general interfaces for creating, updating, deleting, getting a single object and getting a list of all objects, as shown below.

namespace Abp.Application.Services
    public interface IAsyncCrudAppService : IApplicationService, ITransientDependency
        where TEntityDto : IEntityDto
        where TUpdateInput : IEntityDto
        where TGetInput : IEntityDto
        where TDeleteInput : IEntityDto
        Task Create(TCreateInput input);
        Task Delete(TDeleteInput input);
        Task Get(TGetInput input);
        Task> GetAll(TGetAllInput input);
        Task Update(TUpdateInput input);

Now these interfaces are all adjusted as shown below.

namespace Abp.Application.Services
    public interface IAsyncCrudAppService : IApplicationService, ITransientDependency
        where TEntityDto : IEntityDto
        where TUpdateInput : IEntityDto
        where TGetInput : IEntityDto
        where TDeleteInput : IEntityDto
        Task CreateAsync(TCreateInput input);
        Task DeleteAsync(TDeleteInput input);
        Task> GetAllAsync(TGetAllInput input);
        Task GetAsync(TGetInput input);
        Task UpdateAsync(TUpdateInput input);

Then we must adjust the interface and corresponding class implementation with the adjustment of ABP framework.

For example, for the base class encapsulation of the corresponding asynchronous Applicationservice service, we also need to adjust the corresponding asynchronous interface implementation.

For the API caller interface and implementation of remote call, we also need to make unified adjustment in terms of naming, so as to smoothly call the asynchronous interface

I explained the simplified processing of API call layer in my previous essay “series of front and back development of ABP development framework — (10) simplified processing of Web API call classes”. All our API calls are basically called through a unified function.

The method name of the unified call processing is doactionasync.

Although the suffix character of async is added to many interfaces of the application service layer as described above, the client calls through the URL, which is unnecessary, that is to say, it needs to be removed. The URL address we assembled before is based on the function name, so the suffix of async should be removed from the function name.

So the system will run smoothly. The server interface is as follows.



We start the WinForm client with the following interface.


After login and startup, the main interface is as follows