File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ namespace NHibernate.Engine
12
12
/// and the identifier space (eg. tablename)
13
13
/// </summary>
14
14
[ Serializable ]
15
- public sealed class EntityKey : IDeserializationCallback , ISerializable
15
+ public sealed class EntityKey : IDeserializationCallback , ISerializable , IEquatable < EntityKey >
16
16
{
17
17
private readonly object identifier ;
18
18
private readonly IEntityPersister _persister ;
@@ -49,12 +49,19 @@ public object Identifier
49
49
50
50
public override bool Equals ( object other )
51
51
{
52
- var otherKey = other as EntityKey ;
53
- if ( otherKey == null ) return false ;
52
+ return other is EntityKey otherKey && Equals ( otherKey ) ;
53
+ }
54
+
55
+ public bool Equals ( EntityKey other )
56
+ {
57
+ if ( other == null )
58
+ {
59
+ return false ;
60
+ }
54
61
55
62
return
56
- otherKey . RootEntityName . Equals ( RootEntityName )
57
- && _persister . IdentifierType . IsEqual ( otherKey . Identifier , Identifier , _persister . Factory ) ;
63
+ other . RootEntityName . Equals ( RootEntityName )
64
+ && _persister . IdentifierType . IsEqual ( other . Identifier , Identifier , _persister . Factory ) ;
58
65
}
59
66
60
67
public override int GetHashCode ( )
You can’t perform that action at this time.
0 commit comments