The ABP's zero module implements the tenant management (multi-tenancy) in the ABP framework with the database as the data source, role management, user management, session, Authorization (permission management), setting management, language management, audit logging and other core functions. The implementation of these features in the ABP relies on the external persistence layer, so the ABP framework only defines the interfaces and some empty implementations. The real implementation of these features is given to modules such as zero.
The main code of the Zero module is also simple, that is, the implementation of domain logic for these functional modules, so it is nothing more than defining entities, entity relationships, and related crud operations.
Edition: Inherits from the Fullauditedentity entity class. Represents a version of a application. Represents a relationship to another two entity.
editionfeaturesetting: inherited from Featuresetting. Represents a feature associated with a specific edition
featuresetting: An entity class that inherits from Creationauditedentity<long>. Encapsulates the name and value of the featuresetting
abptenant: Inherits from the Fullauditedentity entity class. Represents tenant.
Abpeditionmanager: Handles neighborhood logic related to edition. It references two objects: Editionrepository and Editionfeaturerepository (irepository<edition> and irepository< Editionfeaturesetting, examples of long>, shown in red). Abpeditionmanager through the Editionrepository instance to complete the edition crud operation, through the editionfeaturerepository completes editionfeaturesetting The crud operation of the instance.
Note here that the Abpeditionmanager instance has two event handler interfaces to respond to edition and events that are triggered when the editionfeaturesetting changes. This side of the event handler function finishes removing edition and Editionfeaturesetting instances from the cache.
Editionfeaturecacheitem: This class instance is used for caching, and its dictionary collection featurevalues is used to hold featuresetting corresponding to a edition.
Abpfeaturevaluestore: This is an abstract base class. It provides a method getvalueornullasync the value of the specified feature based on tenant. This method is done internally by invoking an instance of Abptenantmanager. If feature and edition are related, you also need to call Abpeditionmanager's corresponding method to get the value of feature.
tenantfeaturesetting: inherited from Featuresetting. Represents a feature associated with a specific tenant
Tenantfeaturecacheitem: similar to Editionfeaturecacheitem. This class instance is used for caching, and its dictionary collection featurevalues is used to hold featuresetting corresponding to a tenant.
Tenantfeaturecacheiteminvalidator: Implements the Handleevent method in the Ieventhandler interface to change the corresponding Tenantfeaturesetting entity object, Remove it from the cache.
imusthavetenant: The interface identifies its entity associated with the tenant, but this association is a necessary relationship.
imayhavetenant : The interface identifies its entity associated with the tenant, but this association is not required.
Abptenantmanager: Handles neighborhood logic related to tenant. It references two objects: Tenantrepository and Tenantfeaturerepository (irepository<tenant> and irepository< Tenantfeaturesetting, examples of long>, shown in red). Abpeditionmanager through the Tenantrepository instance to complete the tenant crud operation, through the tenantfeaturerepository completes the tenantfeaturesetting instance the crud operation.
Note here that the Abptenantmanager instance has two event handler interfaces to respond to tenant and events that are triggered when the edition changes. This side of the event handler function finishes removing tenant and editionfeaturesetting instances from the cache.
Back to ABP source Analysis series Articles Directory
ABP Source Code Analysis 40: zero Application and Tenant