Browse Source

Rename EntityHelper.IsTransient to EntityHelper.HasDefaultId

pull/272/head
Halil İbrahim Kalkan 8 years ago
parent
commit
f646ecb32e
  1. 2
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/Entity.cs
  2. 2
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/EntityHelper.cs
  3. 2
      src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs

2
src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/Entity.cs

@ -36,7 +36,7 @@ namespace Volo.Abp.Domain.Entities
//Transient objects are not considered as equal //Transient objects are not considered as equal
var other = (Entity<TKey>)obj; var other = (Entity<TKey>)obj;
if (EntityHelper.IsTransient(this) && EntityHelper.IsTransient(other)) if (EntityHelper.HasDefaultId(this) && EntityHelper.HasDefaultId(other))
{ {
return false; return false;
} }

2
src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/EntityHelper.cs

@ -16,7 +16,7 @@ namespace Volo.Abp.Domain.Entities
return typeof(IEntity).IsAssignableFrom(type); return typeof(IEntity).IsAssignableFrom(type);
} }
public static bool IsTransient<TKey>(IEntity<TKey> entity) // TODO: Completely remove IsTransient public static bool HasDefaultId<TKey>(IEntity<TKey> entity)
{ {
if (EqualityComparer<TKey>.Default.Equals(entity.Id, default)) if (EqualityComparer<TKey>.Default.Equals(entity.Id, default))
{ {

2
src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs

@ -64,7 +64,7 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
{ {
if (typeof(TKey) == typeof(int) || typeof(TKey) == typeof(long) || typeof(TKey) == typeof(Guid)) if (typeof(TKey) == typeof(int) || typeof(TKey) == typeof(long) || typeof(TKey) == typeof(Guid))
{ {
if (EntityHelper.IsTransient(entity)) if (EntityHelper.HasDefaultId(entity))
{ {
entity.Id = Database.GenerateNextId<TEntity, TKey>(); entity.Id = Database.GenerateNextId<TEntity, TKey>();
} }

Loading…
Cancel
Save