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 13
13
using System . Linq ;
14
14
using NHibernate . DomainModel . NHSpecific ;
15
15
using NHibernate . DomainModel . Northwind . Entities ;
16
+ using NHibernate . Driver ;
16
17
using NHibernate . Exceptions ;
17
18
using NHibernate . Proxy ;
18
19
using NHibernate . Type ;
@@ -277,15 +278,21 @@ public async Task CanSelectWithAnySubQueryAsync()
277
278
[ Test ]
278
279
public async Task CanSelectConditionalAsync ( )
279
280
{
280
- using ( var sqlLog = new SqlLogSpy ( ) )
281
+ // SqlServerCeDriver and OdbcDriver have an issue matching the case statements inside select and order by statement,
282
+ // when having one or more parameters inside them. Throws with the following error:
283
+ // ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
284
+ if ( ! ( Sfi . ConnectionProvider . Driver is OdbcDriver ) && ! ( Sfi . ConnectionProvider . Driver is SqlServerCeDriver ) )
281
285
{
282
- var q = await ( db . Orders . Where ( o => o . Customer . CustomerId == "test" )
283
- . Select ( o => o . ShippedTo . Contains ( "test" ) ? o . ShippedTo : o . Customer . CompanyName )
284
- . OrderBy ( o => o )
285
- . Distinct ( )
286
- . ToListAsync ( ) ) ;
286
+ using ( var sqlLog = new SqlLogSpy ( ) )
287
+ {
288
+ var q = await ( db . Orders . Where ( o => o . Customer . CustomerId == "test" )
289
+ . Select ( o => o . ShippedTo . Contains ( "test" ) ? o . ShippedTo : o . Customer . CompanyName )
290
+ . OrderBy ( o => o )
291
+ . Distinct ( )
292
+ . ToListAsync ( ) ) ;
287
293
288
- Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
294
+ Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
295
+ }
289
296
}
290
297
291
298
using ( var sqlLog = new SqlLogSpy ( ) )
Original file line number Diff line number Diff line change 3
3
using System . Linq ;
4
4
using NHibernate . DomainModel . NHSpecific ;
5
5
using NHibernate . DomainModel . Northwind . Entities ;
6
+ using NHibernate . Driver ;
6
7
using NHibernate . Exceptions ;
7
8
using NHibernate . Proxy ;
8
9
using NHibernate . Type ;
@@ -306,15 +307,21 @@ public void CanSelectWithAggregateSubQuery()
306
307
[ Test ]
307
308
public void CanSelectConditional ( )
308
309
{
309
- using ( var sqlLog = new SqlLogSpy ( ) )
310
+ // SqlServerCeDriver and OdbcDriver have an issue matching the case statements inside select and order by statement,
311
+ // when having one or more parameters inside them. Throws with the following error:
312
+ // ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
313
+ if ( ! ( Sfi . ConnectionProvider . Driver is OdbcDriver ) && ! ( Sfi . ConnectionProvider . Driver is SqlServerCeDriver ) )
310
314
{
311
- var q = db . Orders . Where ( o => o . Customer . CustomerId == "test" )
312
- . Select ( o => o . ShippedTo . Contains ( "test" ) ? o . ShippedTo : o . Customer . CompanyName )
313
- . OrderBy ( o => o )
314
- . Distinct ( )
315
- . ToList ( ) ;
315
+ using ( var sqlLog = new SqlLogSpy ( ) )
316
+ {
317
+ var q = db . Orders . Where ( o => o . Customer . CustomerId == "test" )
318
+ . Select ( o => o . ShippedTo . Contains ( "test" ) ? o . ShippedTo : o . Customer . CompanyName )
319
+ . OrderBy ( o => o )
320
+ . Distinct ( )
321
+ . ToList ( ) ;
316
322
317
- Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
323
+ Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
324
+ }
318
325
}
319
326
320
327
using ( var sqlLog = new SqlLogSpy ( ) )
You can’t perform that action at this time.
0 commit comments