From 30aec8b9fc3ca5846abe437c93381785e89b7275 Mon Sep 17 00:00:00 2001 From: malik masis Date: Tue, 20 Dec 2022 11:35:30 +0300 Subject: [PATCH] Added IHasEntityVersion to related classes and etos --- .../Volo/Abp/Identity/IdentityUserDto.cs | 5 ++++- .../Volo.Abp.Identity.Domain.Shared.csproj | 1 + .../Volo/Abp/Identity/IdentityRoleEto.cs | 5 ++++- .../Volo/Abp/Identity/OrganizationUnitEto.cs | 5 ++++- .../Volo/Abp/Identity/IdentityRole.cs | 7 ++++++- .../Volo/Abp/Identity/IdentityUser.cs | 7 ++++++- .../Volo/Abp/Identity/OrganizationUnit.cs | 8 +++++++- 7 files changed, 32 insertions(+), 6 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs index e20b8d715b..014b372d19 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs @@ -1,11 +1,12 @@ using System; using Volo.Abp.Application.Dtos; +using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities; using Volo.Abp.MultiTenancy; namespace Volo.Abp.Identity; -public class IdentityUserDto : ExtensibleFullAuditedEntityDto, IMultiTenant, IHasConcurrencyStamp +public class IdentityUserDto : ExtensibleFullAuditedEntityDto, IMultiTenant, IHasConcurrencyStamp, IHasEntityVersion { public Guid? TenantId { get; set; } @@ -30,4 +31,6 @@ public class IdentityUserDto : ExtensibleFullAuditedEntityDto, IMultiTenan public DateTimeOffset? LockoutEnd { get; set; } public string ConcurrencyStamp { get; set; } + + public int EntityVersion { get; set; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj index ddd23ab870..104b1dfb58 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj @@ -24,6 +24,7 @@ + diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleEto.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleEto.cs index 2956a57238..13cc1b699c 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleEto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleEto.cs @@ -1,10 +1,11 @@ using System; +using Volo.Abp.Auditing; using Volo.Abp.MultiTenancy; namespace Volo.Abp.Identity; [Serializable] -public class IdentityRoleEto : IMultiTenant +public class IdentityRoleEto : IMultiTenant, IHasEntityVersion { public Guid Id { get; set; } @@ -17,4 +18,6 @@ public class IdentityRoleEto : IMultiTenant public bool IsStatic { get; set; } public bool IsPublic { get; set; } + + public int EntityVersion { get; set; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/OrganizationUnitEto.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/OrganizationUnitEto.cs index 83ece813d1..ef49ac60bd 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/OrganizationUnitEto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/OrganizationUnitEto.cs @@ -1,10 +1,11 @@ using System; +using Volo.Abp.Auditing; using Volo.Abp.MultiTenancy; namespace Volo.Abp.Identity; [Serializable] -public class OrganizationUnitEto : IMultiTenant +public class OrganizationUnitEto : IMultiTenant, IHasEntityVersion { public Guid Id { get; set; } @@ -13,4 +14,6 @@ public class OrganizationUnitEto : IMultiTenant public string Code { get; set; } public string DisplayName { get; set; } + + public int EntityVersion { get; set; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs index 0e86e4e526..1d4f60f0f6 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.Identity; /// /// Represents a role in the identity system /// -public class IdentityRole : AggregateRoot, IMultiTenant +public class IdentityRole : AggregateRoot, IMultiTenant, IHasEntityVersion { public virtual Guid? TenantId { get; protected set; } @@ -49,6 +49,11 @@ public class IdentityRole : AggregateRoot, IMultiTenant /// public virtual bool IsPublic { get; set; } + /// + /// An entity version property that auto-increments when the entity changes. + /// + public virtual int EntityVersion { get; protected set; } + /// /// Initializes a new instance of . /// diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs index eec620395c..829b6dfe1e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs @@ -12,7 +12,7 @@ using Volo.Abp.Users; namespace Volo.Abp.Identity; -public class IdentityUser : FullAuditedAggregateRoot, IUser +public class IdentityUser : FullAuditedAggregateRoot, IUser, IHasEntityVersion { public virtual Guid? TenantId { get; protected set; } @@ -112,6 +112,11 @@ public class IdentityUser : FullAuditedAggregateRoot, IUser /// public virtual int AccessFailedCount { get; protected internal set; } + /// + /// An entity version property that auto-increments when the entity changes. + /// + public virtual int EntityVersion { get; protected set; } + //TODO: Can we make collections readonly collection, which will provide encapsulation. But... can work for all ORMs? /// diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnit.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnit.cs index 6bcf49ab55..9cd318d903 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnit.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnit.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; @@ -10,7 +11,7 @@ namespace Volo.Abp.Identity; /// /// Represents an organization unit (OU). /// -public class OrganizationUnit : FullAuditedAggregateRoot, IMultiTenant +public class OrganizationUnit : FullAuditedAggregateRoot, IMultiTenant, IHasEntityVersion { public virtual Guid? TenantId { get; protected set; } @@ -33,6 +34,11 @@ public class OrganizationUnit : FullAuditedAggregateRoot, IMultiTenant /// public virtual string DisplayName { get; set; } + /// + /// An entity version property that auto-increments when the entity changes. + /// + public virtual int EntityVersion { get; set; } + /// /// Roles of this OU. ///