4
4
using System . Linq . Expressions ;
5
5
using System . Reflection ;
6
6
using Remotion . Linq ;
7
- using Remotion . Linq . Utilities ;
8
7
9
8
namespace NHibernate . Linq
10
9
{
@@ -13,8 +12,8 @@ public static class EagerFetchingExtensionMethods
13
12
public static INhFetchRequest < TOriginating , TRelated > Fetch < TOriginating , TRelated > (
14
13
this IQueryable < TOriginating > query , Expression < Func < TOriginating , TRelated > > relatedObjectSelector )
15
14
{
16
- ArgumentUtility . CheckNotNull ( " query" , query ) ;
17
- ArgumentUtility . CheckNotNull ( " relatedObjectSelector" , relatedObjectSelector ) ;
15
+ if ( query == null ) throw new ArgumentNullException ( nameof ( query ) ) ;
16
+ if ( relatedObjectSelector == null ) throw new ArgumentNullException ( nameof ( relatedObjectSelector ) ) ;
18
17
19
18
var methodInfo = ( ( MethodInfo ) MethodBase . GetCurrentMethod ( ) ) . MakeGenericMethod ( typeof ( TOriginating ) , typeof ( TRelated ) ) ;
20
19
return CreateFluentFetchRequest < TOriginating , TRelated > ( methodInfo , query , relatedObjectSelector ) ;
@@ -23,8 +22,8 @@ public static INhFetchRequest<TOriginating, TRelated> Fetch<TOriginating, TRelat
23
22
public static INhFetchRequest < TOriginating , TRelated > FetchMany < TOriginating , TRelated > (
24
23
this IQueryable < TOriginating > query , Expression < Func < TOriginating , IEnumerable < TRelated > > > relatedObjectSelector )
25
24
{
26
- ArgumentUtility . CheckNotNull ( " query" , query ) ;
27
- ArgumentUtility . CheckNotNull ( " relatedObjectSelector" , relatedObjectSelector ) ;
25
+ if ( query == null ) throw new ArgumentNullException ( nameof ( query ) ) ;
26
+ if ( relatedObjectSelector == null ) throw new ArgumentNullException ( nameof ( relatedObjectSelector ) ) ;
28
27
29
28
var methodInfo = ( ( MethodInfo ) MethodBase . GetCurrentMethod ( ) ) . MakeGenericMethod ( typeof ( TOriginating ) , typeof ( TRelated ) ) ;
30
29
return CreateFluentFetchRequest < TOriginating , TRelated > ( methodInfo , query , relatedObjectSelector ) ;
@@ -33,8 +32,8 @@ public static INhFetchRequest<TOriginating, TRelated> FetchMany<TOriginating, TR
33
32
public static INhFetchRequest < TQueried , TRelated > ThenFetch < TQueried , TFetch , TRelated > (
34
33
this INhFetchRequest < TQueried , TFetch > query , Expression < Func < TFetch , TRelated > > relatedObjectSelector )
35
34
{
36
- ArgumentUtility . CheckNotNull ( " query" , query ) ;
37
- ArgumentUtility . CheckNotNull ( " relatedObjectSelector" , relatedObjectSelector ) ;
35
+ if ( query == null ) throw new ArgumentNullException ( nameof ( query ) ) ;
36
+ if ( relatedObjectSelector == null ) throw new ArgumentNullException ( nameof ( relatedObjectSelector ) ) ;
38
37
39
38
var methodInfo = ( ( MethodInfo ) MethodBase . GetCurrentMethod ( ) ) . MakeGenericMethod ( typeof ( TQueried ) , typeof ( TFetch ) , typeof ( TRelated ) ) ;
40
39
return CreateFluentFetchRequest < TQueried , TRelated > ( methodInfo , query , relatedObjectSelector ) ;
@@ -43,8 +42,8 @@ public static INhFetchRequest<TQueried, TRelated> ThenFetch<TQueried, TFetch, TR
43
42
public static INhFetchRequest < TQueried , TRelated > ThenFetchMany < TQueried , TFetch , TRelated > (
44
43
this INhFetchRequest < TQueried , TFetch > query , Expression < Func < TFetch , IEnumerable < TRelated > > > relatedObjectSelector )
45
44
{
46
- ArgumentUtility . CheckNotNull ( " query" , query ) ;
47
- ArgumentUtility . CheckNotNull ( " relatedObjectSelector" , relatedObjectSelector ) ;
45
+ if ( query == null ) throw new ArgumentNullException ( nameof ( query ) ) ;
46
+ if ( relatedObjectSelector == null ) throw new ArgumentNullException ( nameof ( relatedObjectSelector ) ) ;
48
47
49
48
var methodInfo = ( ( MethodInfo ) MethodBase . GetCurrentMethod ( ) ) . MakeGenericMethod ( typeof ( TQueried ) , typeof ( TFetch ) , typeof ( TRelated ) ) ;
50
49
return CreateFluentFetchRequest < TQueried , TRelated > ( methodInfo , query , relatedObjectSelector ) ;
0 commit comments