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 basic knowledge of ABP vNext

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

Share

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

ABP vNext is the basic knowledge of what, I believe that many inexperienced people do not know what to do about this, this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

preface

ABP vNext (ABP), formerly known as ASP.NET boilerplate (old version abp), is not a simple version update, but a complete rewrite based on. NET Core.

began

ABP was developed based on DDD:Domain-Driven Design, and of course the framework itself doesn't force you to use DDD, but it recommends DDD as a best practice. If you understand DDD and use the old version of abp, it may be easier to read the official documentation, otherwise it will be more difficult. First of all, DDD theory is very abstract and complex, and it is not easy to understand it deeply. Secondly, ABP uses many open source components, such as EF Core, IdentityServer4, Autofac, AutoMapper, Swagger, etc., so you need to understand these components.

The following is a brief introduction to some important keywords in ABP official documents. To understand these keywords first, we can learn them better.

Audit

Auditing is the process used to track changes in data. In normal development, you must often see attributes such as creation time, creator, modification time, modifier, etc. These attributes are used for data auditing. ABP framework provides interfaces and base classes to standardize these attributes and set their values automatically; ABP provides an extensible audit logging system that automates audit logging according to conventions and provides configuration to control audit log levels. Auditing related base classes/interfaces in ABP include: IAudittedObject, AudittedEntity, AudittedAggregateRoot, etc.

localization

Make your application multilingual. ABP's localization system is compatible with ASP.NET Core's localization.

Event Bus

An event bus is an implementation of the Observer (publish-subscribe) pattern. It is a centralized event handling mechanism that allows different components to communicate with each other without requiring interdependence, achieving a decoupling goal.

If you haven't been exposed to Event Bus, it may not be easy to understand. An inappropriate example: A needs to rent a house, B needs to rent out the house, A wants to find B directly is more difficult, A also does not want to know B, so there is a real estate agent C, C is Event Bus;B tells C in advance that my house needs to be rented, A tells C that I will give you money to rent a house for me, then C can easily help A find B to complete the rental, A does not even need to know who B is, where A is the publisher of the event, B is the subscriber of the event. ABP supports local Event Bus and distributed Event Bus.

Multi-tenancy technology

Multi-tenancy is a software architecture technology that allows multiple tenants to share the same system and ensures data isolation between tenants. I believe many people have encountered similar requirements, the same system according to different customers to distinguish data; usually we will add a customer Id in the database table as an identifier, or according to different customers to read different databases, this is the implementation of multi-tenant data isolation, want to achieve their own good multi-tenant or very cumbersome. ABP's multitenant module provides the basic functionality for creating multitenant applications and makes it easy to implement multitenant.

DDD Layered Presentation Layer: Provides interfaces for users and uses application layers to interact with users. Application layer: An intermediary between the presentation layer and the domain layer, orchestrating business objects to perform specific application tasks and implementing use cases using application logic. Domain layer: contains business objects and business rules, and is the core of the application. Infrastructure layer: provides common technical functionality, supports higher layers, and primarily uses third-party libraries. Entity

An object that is defined not by its attributes, but by clues of continuity and identity.

This sentence is very difficult to understand in official documents...

Simply put, an object is called an entity when it can be distinguished only by its ID and not by other attributes. For example, there are many men named "Zhang San." You can't distinguish which Zhang San is by name and gender, only by Id. Entities can change continuously. We can modify entities many times, but no matter how we modify them, entities always have their unique identities. The entities in DDD are usually hyperemia models, which means that the entities not only have attributes, but also include behaviors (methods). Conversely, DTO, ViewModel, is a typical anemia model. Entities are usually mapped to tables in relational databases. The entity-related base classes/interfaces in ABP include Entity, IEntity, AudittedEntity, etc.

Value Object

A value object is the opposite of an entity in that it does not require a unique identifier and cannot be changed. Value objects are usually used to measure and describe things. When you focus only on the attributes of an object, the object can be a value object. For example,"Beijing" is "Beijing", and there is no such thing as Beijing with Id=1 or Id=2. Of course, although the value object does not have a unique ID, it does not mean that it does not have an Id primary key in the database.

Aggregate Root

Aggregation is a combination of entities and value objects closely associated with business logic. Aggregation is the basic unit of data modification and persistence. The root entity generated after aggregation is called aggregation root. If an aggregation has only one entity, that entity is the root of the aggregation. The aggregate root is treated as a unit, and you cannot modify the sub-entities in the aggregate root alone. For example, in a certain business process, four objects A, B, C, and D will be operated (simply understood as database tables), then the ABCD will be aggregated to generate an aggregation root E. For the outside, only E needs to be operated, and the ABCD will be handled well within the domain. On the one hand, this avoids the chaos of multiple objects, on the other hand, it also ensures the integrity of the data, and there will be no AB operation success, CD operation failure, resulting in dirty data in the database.

Aggregate Root Reference Aggregate Root: Pass ID.

Aggregate root reference entity: through object (navigation attribute).

Aggregate root reference value object: through object (navigation attribute).

Storage (Repository)

Warehouses are used to operate on domain objects (actually operating databases), usually creating a corresponding repository for each aggregation root or different entity. ABP also provides a generic repository: IRepository, built-in basic functions for adding, deleting and searching, which can be used directly by injection.

Application Services

The application layer lies between the presentation layer and the domain layer. The presentation layer usually invokes application services, which invoke domains and then return data to the presentation layer. The presentation layer can also call domains directly. Base classes/interfaces related to application services in APB include: IApplicationService, ApplicationService, ICrudAppService, CrudAppService, etc.

Data Transfer Objects (DTOs)

Usually domain objects are not suitable for direct transfer between the application layer and the presentation layer, such as the Passwod field in User, when DTO is needed, DTO is similar to ViewModel. ABP provides a number of DTO base classes/interfaces: IEntityDto, EntityDto, AudittedEntityDto, etc.

Unit Of Work

UOW mode is to ensure the integrity of data in a business operation. The UOW implementation of ABP framework provides abstraction and control over database connections and transaction scopes in applications, and with ABP you usually don't have to write database transaction related code yourself. Units of work don't actually have to create database transactions, for example HTTP GET requests don't start transactional UOWs, they still start UOWs but don't create database transactions. All this is done automatically by ABP framework.

After reading the above content, do you have the basic knowledge of ABP vNext? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!

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