diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs
index adf991ab4e..c96e305d45 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Reflection;
using Volo.Abp.MultiTenancy;
@@ -11,8 +12,10 @@ namespace Volo.Abp.Domain.Entities
///
public override string ToString()
{
- return $"[ENTITY: {GetType().Name}]";
+ return $"[ENTITY: {GetType().Name}] Keys = {GetKeys().JoinAsString(", ")}";
}
+
+ public abstract object[] GetKeys();
}
///
@@ -97,6 +100,11 @@ namespace Volo.Abp.Domain.Entities
return !(left == right);
}
+ public override object[] GetKeys()
+ {
+ return new object[] {Id};
+ }
+
///
public override string ToString()
{
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs
index f0d3410eb7..8afbabb26e 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs
@@ -6,7 +6,7 @@
///
public interface IEntity
{
-
+ object[] GetKeys();
}
///
diff --git a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
index 8f28c9da67..0e9cb4f8b5 100644
--- a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
+++ b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
@@ -230,6 +230,10 @@ namespace Volo.Abp.Domain.Repositories
public class MyTestAggregateRootWithoutPk : AggregateRoot
{
public string MyId { get; set; }
+ public override object[] GetKeys()
+ {
+ return new object[] {MyId};
+ }
}
public class MyTestDefaultRepository : RepositoryBase
diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/PhoneInSecondDbContext.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/PhoneInSecondDbContext.cs
index 568c8b6ba2..aadfe3d1e7 100644
--- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/PhoneInSecondDbContext.cs
+++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/PhoneInSecondDbContext.cs
@@ -10,5 +10,10 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
public virtual Guid PersonId { get; set; }
public virtual string Number { get; set; }
+
+ public override object[] GetKeys()
+ {
+ return new object[] {PersonId, Number};
+ }
}
}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/EventBus_MultipleHandle_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/EventBus_MultipleHandle_Test.cs
index 78df6a6b40..6892891f90 100644
--- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/EventBus_MultipleHandle_Test.cs
+++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/EventBus_MultipleHandle_Test.cs
@@ -24,7 +24,10 @@ namespace Volo.Abp.EventBus
public class MyEntity : Entity
{
-
+ public override object[] GetKeys()
+ {
+ return new object[0];
+ }
}
public class MyEventHandler :
diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Domain/Phone.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Domain/Phone.cs
index 142e97463e..e53f2bc2e3 100644
--- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Domain/Phone.cs
+++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Domain/Phone.cs
@@ -26,6 +26,11 @@ namespace Volo.Abp.TestApp.Domain
Number = number;
Type = type;
}
+
+ public override object[] GetKeys()
+ {
+ return new object[] {PersonId, Number};
+ }
}
public class Order : AggregateRoot
@@ -96,5 +101,10 @@ namespace Volo.Abp.TestApp.Domain
{
Count = newCount;
}
+
+ public override object[] GetKeys()
+ {
+ return new object[] {OrderId, ProductId};
+ }
}
}
\ No newline at end of file
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserLogin.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserLogin.cs
index f0747708e6..c9e76ff97d 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserLogin.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserLogin.cs
@@ -72,5 +72,10 @@ namespace Volo.Abp.Identity
{
return new UserLoginInfo(LoginProvider, ProviderKey, ProviderDisplayName);
}
+
+ public override object[] GetKeys()
+ {
+ return new object[] {UserId, LoginProvider};
+ }
}
}
\ No newline at end of file
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRole.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRole.cs
index d684bded4e..88fe6a594f 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRole.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRole.cs
@@ -32,5 +32,10 @@ namespace Volo.Abp.Identity
RoleId = roleId;
TenantId = tenantId;
}
+
+ public override object[] GetKeys()
+ {
+ return new object[] { UserId, RoleId };
+ }
}
}
\ No newline at end of file
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserToken.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserToken.cs
index 8950d47e28..0431a533b4 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserToken.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserToken.cs
@@ -53,5 +53,10 @@ namespace Volo.Abp.Identity
Value = value;
TenantId = tenantId;
}
+
+ public override object[] GetKeys()
+ {
+ return new object[] { UserId, LoginProvider, Name };
+ }
}
}
\ No newline at end of file