Add equality members to fix key-ref merging.

This commit is contained in:
chadsowald
2014-09-18 12:51:30 -07:00
parent 1b01e4b245
commit 12ee34ca8f

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright <EFBFBD> 2002-2011 the original author or authors.
* Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -126,5 +126,28 @@ namespace Spring.Objects.Factory.Config
private bool _isToParent;
#endregion
#region Equality Members
protected bool Equals(RuntimeObjectReference other)
{
return string.Equals(_objectName, other._objectName) && _isToParent.Equals(other._isToParent);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((RuntimeObjectReference)obj);
}
public override int GetHashCode()
{
unchecked
{
return (_objectName.GetHashCode() * 397) ^ _isToParent.GetHashCode();
}
}
#endregion
}
}
}