From e365c0f9b0f68cd5c130d8ab886e701b513dbf4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 15 Dec 2022 17:27:02 +0300 Subject: [PATCH] Document IHasEntityVersion --- docs/en/Entities.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/en/Entities.md b/docs/en/Entities.md index a1558a73ae..e13b297f4f 100644 --- a/docs/en/Entities.md +++ b/docs/en/Entities.md @@ -324,6 +324,19 @@ It's designed as read-only and automatically invalidates a cached entity if the > See the [Entity Cache](Entity-Cache.md) documentation for more information. +## Versioning Entities + +ABP defines the `IHasEntityVersion` interface for automatic versioning of your entities. It only provides a single `EntityVersion` properties, as shown in the following code block: + +````csharp +public interface IHasEntityVersion +{ + int EntityVersion { get; } +} +```` + +If you implement the `IHasEntityVersion` interface, ABP automatically increases the `EntityVersion` value whenever you update your entity. The initial value will be `0`, when you first create the entity and save to the database. + ## Extra Properties ABP defines the `IHasExtraProperties` interface that can be implemented by an entity to be able to dynamically set and get properties for the entity. `AggregateRoot` base class already implements the `IHasExtraProperties` interface. If you've derived from this class (or one of the related audit class defined above), you can directly use the API.