Skip to content

Remove persistent collections Equals/GetHashCode overrides #2461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/NHibernate/Collection/Generic/PersistentGenericList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,23 +238,6 @@ public override bool EntryExists(object entry, int i)
return entry != null;
}

public override bool Equals(object obj)
{
var that = obj as ICollection<T>;
if (that == null)
{
return false;
}
Read();
return CollectionHelper.SequenceEquals(WrappedList, that);
}

public override int GetHashCode()
{
Read();
return WrappedList.GetHashCode();
}

#region IList Members

int IList.Add(object value)
Expand Down
17 changes: 0 additions & 17 deletions src/NHibernate/Collection/Generic/PersistentGenericMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,23 +230,6 @@ public override object GetSnapshotElement(object entry, int i)
return sn[((KeyValuePair<TKey, TValue>)entry).Key];
}

public override bool Equals(object other)
{
var that = other as IDictionary<TKey, TValue>;
if (that == null)
{
return false;
}
Read();
return CollectionHelper.DictionaryEquals(WrappedMap, that);
}

public override int GetHashCode()
{
Read();
return WrappedMap.GetHashCode();
}

public override bool EntryExists(object entry, int i)
{
return WrappedMap.ContainsKey(((KeyValuePair<TKey, TValue>)entry).Key);
Expand Down
17 changes: 0 additions & 17 deletions src/NHibernate/Collection/Generic/PersistentGenericSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,23 +277,6 @@ public override object GetSnapshotElement(object entry, int i)
throw new NotSupportedException("Sets don't support updating by element");
}

public override bool Equals(object other)
{
var that = other as ISet<T>;
if (that == null)
{
return false;
}
Read();
return WrappedSet.SequenceEqual(that);
}

public override int GetHashCode()
{
Read();
return WrappedSet.GetHashCode();
}

public override bool EntryExists(object entry, int i)
{
return true;
Expand Down