forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRootEntityResultTransformer.cs
56 lines (49 loc) · 1.21 KB
/
RootEntityResultTransformer.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections;
using NHibernate.Util;
namespace NHibernate.Transform
{
[Serializable]
public class RootEntityResultTransformer : IResultTransformer, ITupleSubsetResultTransformer
{
internal static readonly RootEntityResultTransformer Instance = new RootEntityResultTransformer();
public object TransformTuple(object[] tuple, string[] aliases)
{
return tuple[tuple.Length - 1];
}
public IList TransformList(IList collection)
{
return collection;
}
public bool IsTransformedValueATupleElement(String[] aliases, int tupleLength)
{
return true;
}
public bool[] IncludeInTransform(String[] aliases, int tupleLength)
{
bool[] includeInTransform;
if (tupleLength == 1)
{
includeInTransform = ArrayHelper.True;
}
else
{
includeInTransform = new bool[tupleLength];
includeInTransform[tupleLength - 1] = true;
}
return includeInTransform;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(obj, this))
return true;
if (obj == null)
return false;
return obj.GetType() == GetType();
}
public override int GetHashCode()
{
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(Instance);
}
}
}