File tree Expand file tree Collapse file tree 2 files changed +28
-14
lines changed
Expand file tree Collapse file tree 2 files changed +28
-14
lines changed Original file line number Diff line number Diff line change 1212using System . Collections . Generic ;
1313using System . Linq ;
1414using NHibernate . DomainModel . Northwind . Entities ;
15+ using NHibernate . Driver ;
1516using NHibernate . Exceptions ;
1617using NHibernate . Proxy ;
1718using NUnit . Framework ;
@@ -275,15 +276,21 @@ public async Task CanSelectWithAnySubQueryAsync()
275276 [ Test ]
276277 public async Task CanSelectConditionalAsync ( )
277278 {
278- using ( var sqlLog = new SqlLogSpy ( ) )
279+ // SqlServerCeDriver and OdbcDriver have an issue matching the case statements inside select and order by statement,
280+ // when having one or more parameters inside them. Throws with the following error:
281+ // ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
282+ if ( ! ( Sfi . ConnectionProvider . Driver is OdbcDriver ) && ! ( Sfi . ConnectionProvider . Driver is SqlServerCeDriver ) )
279283 {
280- var q = await ( db . Orders . Where ( o => o . Customer . CustomerId == "test" )
281- . Select ( o => o . ShippedTo . Contains ( "test" ) ? o . ShippedTo : o . Customer . CompanyName )
282- . OrderBy ( o => o )
283- . Distinct ( )
284- . ToListAsync ( ) ) ;
284+ using ( var sqlLog = new SqlLogSpy ( ) )
285+ {
286+ var q = await ( db . Orders . Where ( o => o . Customer . CustomerId == "test" )
287+ . Select ( o => o . ShippedTo . Contains ( "test" ) ? o . ShippedTo : o . Customer . CompanyName )
288+ . OrderBy ( o => o )
289+ . Distinct ( )
290+ . ToListAsync ( ) ) ;
285291
286- Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
292+ Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
293+ }
287294 }
288295
289296 using ( var sqlLog = new SqlLogSpy ( ) )
Original file line number Diff line number Diff line change 22using System . Collections . Generic ;
33using System . Linq ;
44using NHibernate . DomainModel . Northwind . Entities ;
5+ using NHibernate . Driver ;
56using NHibernate . Exceptions ;
67using NHibernate . Proxy ;
78using NUnit . Framework ;
@@ -304,15 +305,21 @@ public void CanSelectWithAggregateSubQuery()
304305 [ Test ]
305306 public void CanSelectConditional ( )
306307 {
307- using ( var sqlLog = new SqlLogSpy ( ) )
308+ // SqlServerCeDriver and OdbcDriver have an issue matching the case statements inside select and order by statement,
309+ // when having one or more parameters inside them. Throws with the following error:
310+ // ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
311+ if ( ! ( Sfi . ConnectionProvider . Driver is OdbcDriver ) && ! ( Sfi . ConnectionProvider . Driver is SqlServerCeDriver ) )
308312 {
309- var q = db . Orders . Where ( o => o . Customer . CustomerId == "test" )
310- . Select ( o => o . ShippedTo . Contains ( "test" ) ? o . ShippedTo : o . Customer . CompanyName )
311- . OrderBy ( o => o )
312- . Distinct ( )
313- . ToList ( ) ;
313+ using ( var sqlLog = new SqlLogSpy ( ) )
314+ {
315+ var q = db . Orders . Where ( o => o . Customer . CustomerId == "test" )
316+ . Select ( o => o . ShippedTo . Contains ( "test" ) ? o . ShippedTo : o . Customer . CompanyName )
317+ . OrderBy ( o => o )
318+ . Distinct ( )
319+ . ToList ( ) ;
314320
315- Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
321+ Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
322+ }
316323 }
317324
318325 using ( var sqlLog = new SqlLogSpy ( ) )
You can’t perform that action at this time.
0 commit comments