This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
src/ServiceStack.OrmLite/Expressions
tests/ServiceStack.OrmLite.Tests/Expression Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,10 @@ public string SelectInto<TModel>()
166
166
sbSelect . AppendFormat ( "{0}.{1}" ,
167
167
SqlTable ( tableDef ) ,
168
168
tableFieldDef . GetQuotedName ( DialectProvider ) ) ;
169
+
170
+ if ( tableFieldDef . Alias != null )
171
+ sbSelect . Append ( " AS " ) . Append ( fieldDef . Name ) ;
172
+
169
173
break ;
170
174
}
171
175
}
Original file line number Diff line number Diff line change @@ -63,29 +63,25 @@ internal class JoinResult
63
63
[ BelongTo ( typeof ( FooBar ) ) ]
64
64
public int Id { get ; set ; }
65
65
66
- [ Alias ( "fkBazId" ) ]
67
66
[ BelongTo ( typeof ( FooBarBaz ) ) ]
68
67
public int FooBarBazId { get ; set ; }
69
68
70
69
[ BelongTo ( typeof ( FooBarBaz ) ) ]
71
70
public decimal Amount { get ; set ; }
72
71
73
- [ Alias ( "fkBarId" ) ]
74
72
[ BelongTo ( typeof ( Bar ) ) ]
75
73
public Guid BarId { get ; set ; }
76
74
77
75
[ BelongTo ( typeof ( Bar ) ) ]
78
76
public string BarName { get ; set ; }
79
77
80
- [ Alias ( "fkBazId" ) ]
81
78
[ BelongTo ( typeof ( Baz ) ) ]
82
79
public int BazId { get ; set ; }
83
80
84
81
[ BelongTo ( typeof ( Baz ) ) ]
85
82
public string BazName { get ; set ; }
86
83
}
87
84
88
-
89
85
[ TestFixture ]
90
86
public class ComplexJoinTests : OrmLiteTestBase
91
87
{
@@ -166,10 +162,10 @@ public void ComplexJoin_with_SqlExpression()
166
162
. Join < Bar > ( ( dp , p ) => dp . BarId == p . Id )
167
163
. Join < FooBarBaz > ( ( dp , dpss ) => dp . Id == dpss . FooBarId )
168
164
. Join < FooBarBaz , Baz > ( ( dpss , ss ) => dpss . BazId == ss . Id ) ;
169
-
165
+
170
166
var results = db . Select < JoinResult > ( q ) ;
171
167
172
- db . GetLastSql ( ) . Replace ( "INNER" , "\n INNER" ) . Print ( ) ;
168
+ db . GetLastSql ( ) . Replace ( "INNER" , "\n INNER" ) . Print ( ) ;
173
169
174
170
results . PrintDump ( ) ;
175
171
You can’t perform that action at this time.
0 commit comments