Skip to content

Commit 419aa60

Browse files
committed
Remove mostly unused Util/ObjectUtils.cs. The only code that was still in use was submitted by ramonsmiths in bb35733, and now moved to ObjectHelpers.cs.
1 parent c0b102b commit 419aa60

File tree

4 files changed

+35
-129
lines changed

4 files changed

+35
-129
lines changed

src/NHibernate/Criterion/SimpleExpression.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ string ValueToStrings()
179179
{
180180
return value.ToString();
181181
}
182-
return ObjectUtils.IdentityToString(value);
182+
return ObjectHelpers.IdentityToString(value);
183183
}
184184
}
185185
}

src/NHibernate/NHibernate.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@
709709
<Compile Include="Util\EnumeratorAdapter.cs" />
710710
<Compile Include="Util\IdentityMap.cs" />
711711
<Compile Include="Util\JoinedEnumerable.cs" />
712-
<Compile Include="Util\ObjectUtils.cs" />
712+
<Compile Include="Util\ObjectHelpers.cs" />
713713
<Compile Include="Util\PropertiesHelper.cs" />
714714
<Compile Include="Util\ReflectHelper.cs" />
715715
<Compile Include="Util\SequencedHashMap.cs" />

src/NHibernate/Util/ObjectHelpers.cs

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
namespace NHibernate.Util
3+
{
4+
/// <summary>
5+
/// Various small helper methods.
6+
/// </summary>
7+
public static class ObjectHelpers
8+
{
9+
/// <summary>
10+
/// Return an identifying string representation for the object, taking
11+
/// NHibernate proxies into account. The returned string will be "null",
12+
/// "classname@hashcode(hash)", or "entityname#identifier". If the object
13+
/// is an uninitialized NHibernate proxy, take care not to initialize it.
14+
/// </summary>
15+
public static string IdentityToString(object obj)
16+
{
17+
if (obj == null)
18+
{
19+
return "null";
20+
}
21+
22+
var proxy = obj as Proxy.INHibernateProxy;
23+
24+
if (null != proxy)
25+
{
26+
var init = proxy.HibernateLazyInitializer;
27+
return StringHelper.Unqualify(init.EntityName) + "#" + init.Identifier;
28+
}
29+
30+
return StringHelper.Unqualify(obj.GetType().FullName) + "@" + obj.GetHashCode() + "(hash)";
31+
}
32+
}
33+
}

src/NHibernate/Util/ObjectUtils.cs

-127
This file was deleted.

0 commit comments

Comments
 (0)