| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | |
| | | 3 | | namespace ArturRios.Data.Relational.Core.Entities; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Base class for entities that participate in optimistic concurrency checks. |
| | | 7 | | /// The <see cref="ConcurrencyStamp" /> is regenerated on every update by the context, |
| | | 8 | | /// so a stale value causes the update to fail with a concurrency conflict. |
| | | 9 | | /// </summary> |
| | | 10 | | public abstract class VersionedEntity : Entity |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Optimistic concurrency token. Regenerated whenever the entity is updated. |
| | | 14 | | /// </summary> |
| | | 15 | | [ConcurrencyCheck] |
| | 15 | 16 | | public Guid ConcurrencyStamp { get; set; } = Guid.NewGuid(); |
| | | 17 | | } |