Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Why use "RootEntityName" compare, not use "EntityName" in NHibernate/Engine /EntityKey.Equals0 #3478

Discussion options

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);
		}
You must be logged in to vote

Because that is the right thing to do.

/// <summary>
/// Returns an object that identifies the space in which identifiers of
/// this entity hierarchy are unique.
/// </summary>
string RootEntityName { get; }

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.

Replies: 1 comment

Comment options

Because that is the right thing to do.

/// <summary>
/// Returns an object that identifies the space in which identifiers of
/// this entity hierarchy are unique.
/// </summary>
string RootEntityName { get; }

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.

You must be logged in to vote
0 replies
Answer selected by hazzik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Converted from issue

This discussion was converted from issue #3471 on February 02, 2024 02:26.

AltStyle によって変換されたページ (->オリジナル) /