forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssociationKey.cs
36 lines (31 loc) · 905 Bytes
/
AssociationKey.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
namespace NHibernate.Engine
{
/// <summary>
/// Identifies a named association belonging to a particular
/// entity instance. Used to record the fact that an association
/// is null during loading.
/// </summary>
[Serializable]
internal sealed class AssociationKey
{
private readonly EntityKey ownerKey;
private readonly string propertyName;
public AssociationKey(EntityKey ownerKey, string propertyName)
{
this.ownerKey = ownerKey;
this.propertyName = propertyName;
}
public override bool Equals(object that)
{
if(this==that) return true;
AssociationKey key = that as AssociationKey;
if(key==null) return false;
return key.propertyName.Equals(propertyName) && key.ownerKey.Equals(ownerKey);
}
public override int GetHashCode()
{
return ownerKey.GetHashCode() ^ propertyName.GetHashCode();
}
}
}