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 +11
-2
lines changed
src/ServiceStack.OrmLite.SqlServer
tests/ServiceStack.OrmLite.Tests Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -463,7 +463,7 @@ public static string UseAliasesOrStripTablePrefixes(string selectExpression)
463463
464464 public override string GetLoadChildrenSubSelect < From > ( ModelDefinition modelDef , SqlExpression < From > expr )
465465 {
466- if ( ! expr . OrderByExpression . IsNullOrEmpty ( ) )
466+ if ( ! expr . OrderByExpression . IsNullOrEmpty ( ) && expr . Rows == null )
467467 {
468468 expr . Select ( this . GetQuotedColumnName ( modelDef , modelDef . PrimaryKey ) )
469469 . ClearLimits ( )
Original file line number Diff line number Diff line change @@ -618,7 +618,7 @@ public void Can_load_references_with_OrderBy_and_Paging()
618618
619619 // Select the Parent.Id == 2. LoadSelect should populate the child, but doesn't.
620620 var q = db . From < Parent > ( )
621- . Limit ( 0 , 1 )
621+ . Take ( 1 )
622622 . OrderByDescending < Parent > ( p => p . Id ) ;
623623
624624 var results = db . LoadSelect ( q ) ;
@@ -627,6 +627,15 @@ public void Can_load_references_with_OrderBy_and_Paging()
627627 Assert . That ( results [ 0 ] . Child , Is . Not . Null ) ;
628628 Assert . That ( results [ 0 ] . Child . Value , Is . EqualTo ( "Lolz" ) ) ;
629629
630+ q = db . From < Parent > ( )
631+ . Skip ( 1 )
632+ . OrderBy < Parent > ( p => p . Id ) ;
633+
634+ results = db . LoadSelect ( q ) ;
635+
636+ Assert . That ( results . Count , Is . EqualTo ( 1 ) ) ;
637+ Assert . That ( results [ 0 ] . Child , Is . Not . Null ) ;
638+ Assert . That ( results [ 0 ] . Child . Value , Is . EqualTo ( "Lolz" ) ) ;
630639 results . PrintDump ( ) ;
631640 }
632641 }
You can’t perform that action at this time.
0 commit comments