This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
tests/ServiceStack.OrmLite.Tests/UseCase Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,24 @@ public class Foo
15
15
public string Bar { get ; set ; }
16
16
}
17
17
18
+ public class Bar
19
+ {
20
+ [ AutoIncrement ]
21
+ public int Id { get ; set ; }
22
+
23
+ public string Baz { get ; set ; }
24
+ }
25
+
26
+ public class User
27
+ {
28
+ [ AutoIncrement ]
29
+ [ Alias ( "User ID" ) ]
30
+ public int Id { get ; set ; }
31
+
32
+ [ StringLength ( 100 ) ]
33
+ public string UserName { get ; set ; }
34
+ }
35
+
18
36
[ Test ]
19
37
public void CanResolveAliasedFieldNameInAnonymousType ( )
20
38
{
@@ -38,5 +56,31 @@ public void CanResolveAliasedFieldNameInAnonymousType()
38
56
}
39
57
}
40
58
59
+ [ Test ]
60
+ public void CanResolveAliasedFieldNameInJoinedTable ( )
61
+ {
62
+ using ( IDbConnection db = OpenDbConnection ( ) )
63
+ {
64
+ db . DropAndCreateTable < Bar > ( ) ;
65
+ db . DropAndCreateTable < User > ( ) ;
66
+
67
+ db . Insert ( new User { UserName = "Peter" } ) ;
68
+ db . Insert ( new Bar { Baz = "Peter" } ) ;
69
+
70
+ var ev = db . From < Bar > ( )
71
+ . Join < User > ( ( x , y ) => x . Id == y . Id ) ;
72
+
73
+ var foos = db . Select < Foo > ( ev ) ;
74
+
75
+ ev = db . From < Bar > ( )
76
+ . Join < User > ( ( x , y ) => x . Baz == y . UserName )
77
+ . Where < User > ( x => x . Id > 0 ) ;
78
+
79
+ foos = db . Select < Foo > ( ev ) ;
80
+
81
+ Assert . That ( foos , Has . Count . EqualTo ( 1 ) ) ;
82
+ }
83
+ }
84
+
41
85
}
42
86
}
You can’t perform that action at this time.
0 commit comments