Abp.VNext-聚合根类

聚合根类(AggregateRoot)

聚合一般包括多个实体或者值对象,聚合根可以理解为根实体或者叫主实体。

BasicAggregateRoot

AggregateRoot类继承自Entity类,TKey可以是GUID、Int、String类型等。

AggregateRoot

有其他属性来支持乐观并发和对象扩展特性

CreationAuditedAggregateRoot

继承自 AggregateRoot类,并添加CreationTime (DateTime) 和 CreatorId (Guid) 属性来存储创建审核信息。

AuditedAggregateRoot

继承* CreationAuditedAggregateRoot类,并添加 LastModificationTime (DateTime) 和LastModifierId (Guid)属性来存储修改审核信息。

FullAuditedAggregateRoot

继承自AuditedAggregateRoot类,并添加 DeletionTime (DateTime) 和 DeleterId (Guid) 属性来存储删除审核信息。它还通过实现ISoftDelete接口添加了IsDeleted (bool),实现实体软删除。

实体可以继承以下对象,FullAuditedAggregateRoot实现了ISoftDelete接口,用于实体的软删除。即它永远不会从数据库中做物理删除,而只是标记为已删除。ABP 会自动处理所有的软删除逻辑。包括下次查询时,已删除的实体会被自动过滤,除非您有意请求它们,否则它不会在查询结果中显示。

注意事项

  1. 映射到数据库表后,表里面会有以下9个公共字段+1个自增主键Id(是Id还是GuId取决于FullAuditedAggregateRoot传的是Id还是Guid

posted @ 2024-11-19 17:58  相遇就是有缘  阅读(119)  评论(0)    收藏  举报