Skip to content

Commit f2969d0

Browse files
bahusoidhazzik
authored andcommitted
Ability to select entities in Criteria projections (#1471)
Fixes #948 (NH-3435)
1 parent 699db48 commit f2969d0

14 files changed

+1332
-18
lines changed

src/NHibernate.Test/Async/Criteria/EntityProjectionsTest.cs

Lines changed: 463 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace NHibernate.Test.Criteria
5+
{
6+
public class EntitySimpleChild
7+
{
8+
public virtual Guid Id { get; set; }
9+
public virtual string Name { get; set; }
10+
}
11+
12+
public class EntityComplex
13+
{
14+
public virtual Guid Id { get; set; }
15+
16+
public virtual int Version { get; set; }
17+
18+
public virtual string Name { get; set; }
19+
20+
public virtual string LazyProp { get; set; }
21+
22+
public virtual EntitySimpleChild Child1 { get; set; }
23+
public virtual EntitySimpleChild Child2 { get; set; }
24+
public virtual EntityComplex SameTypeChild { get; set; }
25+
26+
public virtual IList<EntitySimpleChild> ChildrenList { get; set; }
27+
}
28+
29+
public class CompositeKey
30+
{
31+
public int Id1 { get; set; }
32+
public int Id2 { get; set; }
33+
34+
public override bool Equals(object obj)
35+
{
36+
var key = obj as CompositeKey;
37+
return key != null
38+
&& Id1 == key.Id1
39+
&& Id2 == key.Id2;
40+
}
41+
42+
public override int GetHashCode()
43+
{
44+
var hashCode = -1596524975;
45+
hashCode = hashCode * -1521134295 + Id1.GetHashCode();
46+
hashCode = hashCode * -1521134295 + Id2.GetHashCode();
47+
return hashCode;
48+
}
49+
}
50+
51+
public class EntityWithCompositeId
52+
{
53+
public virtual CompositeKey Key { get; set; }
54+
public virtual string Name { get; set; }
55+
}
56+
}

0 commit comments

Comments
 (0)