diff --git a/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/Entity.cs b/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/Entity.cs index 33e7220166..7b09c60baa 100644 --- a/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/Entity.cs +++ b/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/Entity.cs @@ -22,12 +22,6 @@ namespace Volo.Abp.Domain.Entities /// public virtual TPrimaryKey Id { get; set; } - /// - public virtual bool IsTransient() - { - return EntityHelper.IsTransient(this); - } - /// public override bool Equals(object obj) { @@ -44,7 +38,7 @@ namespace Volo.Abp.Domain.Entities //Transient objects are not considered as equal var other = (Entity)obj; - if (IsTransient() && other.IsTransient()) + if (EntityHelper.IsTransient(this) && EntityHelper.IsTransient(other)) { return false; } diff --git a/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/EntityHelper.cs b/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/EntityHelper.cs index 304d664850..2dd23b4a08 100644 --- a/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/EntityHelper.cs +++ b/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/EntityHelper.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Domain.Entities /// This method is exists to help developers who want to directly implement /// but want to use default IsTransient implementation as a shortcut. /// - public static bool IsTransient(IEntity entity) + public static bool IsTransient(IEntity entity) // TODO: Completely remove IsTransient { if (EqualityComparer.Default.Equals(entity.Id, default)) { diff --git a/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/IEntity.cs b/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/IEntity.cs index 2d48ee20e7..9534c6c38d 100644 --- a/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/IEntity.cs +++ b/src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/IEntity.cs @@ -20,11 +20,5 @@ namespace Volo.Abp.Domain.Entities /// Unique identifier for this entity. /// TPrimaryKey Id { get; set; } - - /// - /// Checks if this entity is transient (not persisted to database and it has not an ). - /// - /// True, if this entity is transient - bool IsTransient(); } } diff --git a/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs b/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs index 01568ff066..dcccdd6b07 100644 --- a/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs +++ b/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs @@ -42,7 +42,7 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb { if (typeof(TPrimaryKey) == typeof(int) || typeof(TPrimaryKey) == typeof(long) || typeof(TPrimaryKey) == typeof(Guid)) { - if (entity.IsTransient()) + if (EntityHelper.IsTransient(entity)) { entity.Id = Database.GenerateNextId(); }