File tree 2 files changed +28
-14
lines changed
2 files changed +28
-14
lines changed Original file line number Diff line number Diff line change 12
12
using System . Collections . Generic ;
13
13
using System . Linq ;
14
14
using NHibernate . DomainModel . Northwind . Entities ;
15
+ using NHibernate . Driver ;
15
16
using NHibernate . Exceptions ;
16
17
using NHibernate . Proxy ;
17
18
using NUnit . Framework ;
@@ -275,15 +276,21 @@ public async Task CanSelectWithAnySubQueryAsync()
275
276
[ Test ]
276
277
public async Task CanSelectConditionalAsync ( )
277
278
{
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 ) )
279
283
{
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 ( ) ) ;
285
291
286
- Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
292
+ Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
293
+ }
287
294
}
288
295
289
296
using ( var sqlLog = new SqlLogSpy ( ) )
Original file line number Diff line number Diff line change 2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
4
using NHibernate . DomainModel . Northwind . Entities ;
5
+ using NHibernate . Driver ;
5
6
using NHibernate . Exceptions ;
6
7
using NHibernate . Proxy ;
7
8
using NUnit . Framework ;
@@ -304,15 +305,21 @@ public void CanSelectWithAggregateSubQuery()
304
305
[ Test ]
305
306
public void CanSelectConditional ( )
306
307
{
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 ) )
308
312
{
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 ( ) ;
314
320
315
- Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
321
+ Assert . That ( FindAllOccurrences ( sqlLog . GetWholeLog ( ) , "case" ) , Is . EqualTo ( 2 ) ) ;
322
+ }
316
323
}
317
324
318
325
using ( var sqlLog = new SqlLogSpy ( ) )
You can’t perform that action at this time.
0 commit comments