Why use "RootEntityName" compare, not use "EntityName" in NHibernate/Engine /EntityKey.Equals0 #3478
-
NHibernate.Engine.EntityKey.cs public bool Equals(EntityKey other)
{
if (other == null)
{
return false;
}
return
other.RootEntityName.Equals(RootEntityName)
&& _persister.IdentifierType.IsEqual(other.Identifier, Identifier, _persister.Factory);
} |
Beta Was this translation helpful? Give feedback.
Answered by
fredericDelaporte
Jan 21, 2024
Replies: 1 comment
-
Because that is the right thing to do. nhibernate-core/src/NHibernate/Persister/Entity/IEntityPersister.cs Lines 36 to 40 in 07c367f Why should we use the |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hazzik
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Because that is the right thing to do.
nhibernate-core/src/NHibernate/Persister/Entity/IEntityPersister.cs
Lines 36 to 40 in 07c367f
Why should we use the
EntityName
? In case we have a key from a proxy of a base class, we would no more be able to infer that the key points the same entity than a key of the entity loaded from its concrete type.