@@ -12,7 +12,7 @@ public class UnitOfWorkParameterExpressionBuilder : IParameterExpressionBuilder
12
12
private static readonly MethodInfo GetOrSetGlobalStateUnitOfWorkMethod =
13
13
typeof ( ResolverContextExtensions ) . GetMethods ( )
14
14
. First ( m => m . Name == nameof ( ResolverContextExtensions . GetOrSetGlobalState ) )
15
- . MakeGenericMethod ( typeof ( UnitOfWork ) ) ;
15
+ . MakeGenericMethod ( typeof ( IUnitOfWork ) ) ;
16
16
17
17
private static readonly MethodInfo GetGlobalStateOrDefaultLongMethod =
18
18
typeof ( ResolverContextExtensions ) . GetMethods ( )
@@ -21,22 +21,22 @@ public class UnitOfWorkParameterExpressionBuilder : IParameterExpressionBuilder
21
21
22
22
private static readonly MethodInfo ServiceUnitOfWorkMethod =
23
23
typeof ( IPureResolverContext ) . GetMethods ( ) . First (
24
- method => method is { Name : nameof ( IPureResolverContext . Service ) , IsGenericMethod : true } )
25
- . MakeGenericMethod ( typeof ( UnitOfWork ) ) ;
24
+ method => method is { Name : nameof ( IPureResolverContext . Service ) , IsGenericMethod : true } )
25
+ . MakeGenericMethod ( typeof ( IUnitOfWork ) ) ;
26
26
27
27
private static readonly MethodInfo WithPrefilledVersionMethod =
28
- typeof ( UnitOfWork ) . GetMethods ( BindingFlags . Instance | BindingFlags . Public )
29
- . First ( m => m . Name == nameof ( UnitOfWork . WithPrefilledVersion ) ) ;
28
+ typeof ( IUnitOfWork ) . GetMethods ( BindingFlags . Instance | BindingFlags . Public )
29
+ . First ( m => m . Name == nameof ( IUnitOfWork . WithPrefilledVersion ) ) ;
30
30
31
- public bool CanHandle ( ParameterInfo parameter ) => typeof ( UnitOfWork ) == parameter . ParameterType
32
- || typeof ( IUnitOfWork ) == parameter . ParameterType ;
31
+ public bool CanHandle ( ParameterInfo parameter ) =>
32
+ typeof ( IUnitOfWork ) == parameter . ParameterType ;
33
33
34
34
/*
35
35
* Produces something like this: context.GetOrSetGlobalState(
36
- * nameof(UnitOfWork.UnitOfWork ),
36
+ * nameof(IUnitOfWork ),
37
37
* _ =>
38
38
* context
39
- * .Service<UnitOfWork.UnitOfWork >()
39
+ * .Service<IUnitOfWork >()
40
40
* .WithPrefilledVersion(
41
41
* context.GetGlobalState<long>(PrefillUnitOfWorkVersion)
42
42
* ))!;
@@ -53,13 +53,14 @@ public Expression Build(ParameterExpressionBuilderContext builderContext)
53
53
context ,
54
54
Expression . Constant ( PrefillUnitOfWorkVersion ) ) ) ;
55
55
56
- return Expression . Call ( null , GetOrSetGlobalStateUnitOfWorkMethod , context , Expression . Constant ( nameof ( UnitOfWork ) ) ,
57
- Expression . Lambda < Func < string , UnitOfWork > > (
56
+ return Expression . Call ( null , GetOrSetGlobalStateUnitOfWorkMethod , context ,
57
+ Expression . Constant ( nameof ( IUnitOfWork ) ) ,
58
+ Expression . Lambda < Func < string , IUnitOfWork > > (
58
59
getNewUnitOfWork ,
59
60
Expression . Parameter ( typeof ( string ) ) ) ) ;
60
61
}
61
62
62
63
public ArgumentKind Kind => ArgumentKind . Custom ;
63
- public bool IsPure => true ;
64
+ public bool IsPure => false ;
64
65
public bool IsDefaultHandler => false ;
65
- }
66
+ }
0 commit comments