5
5
6
6
namespace MvcInterception
7
7
{
8
- public static class CallInterceptorRegistryExtensions
8
+ public static class CallInterceptorRegistryExpressionExtensions
9
9
{
10
10
public static ICallInterceptorRegistry Register < TObj > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action , params ICallInterceptor [ ] objs )
11
11
{
12
- return Register ( @this , action , ( IEnumerable < ICallInterceptor > ) objs ) ;
12
+ return @this . Register ( action , ( IEnumerable < ICallInterceptor > ) objs ) ;
13
13
}
14
14
15
15
public static ICallInterceptorRegistry Register < TObj > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action , IEnumerable < ICallInterceptor > objs )
16
16
{
17
- return @this . RegisterObjects ( action , objs . Cast < object > ( ) . ToArray ( ) ) ;
17
+ return @this . RegisterInterceptors ( action , objs . Cast < object > ( ) . ToArray ( ) ) ;
18
18
}
19
19
20
20
public static ICallInterceptorRegistry Register < TObj , T1 > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action )
21
21
where T1 : ICallInterceptor , new ( )
22
22
{
23
- return @this . RegisterObjects ( action , typeof ( T1 ) ) ;
23
+ return @this . RegisterInterceptors ( action , typeof ( T1 ) ) ;
24
24
}
25
25
26
26
public static ICallInterceptorRegistry Register < TObj , T1 , T2 > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action )
27
27
where T1 : ICallInterceptor , new ( )
28
28
where T2 : ICallInterceptor , new ( )
29
29
{
30
- return @this . RegisterObjects ( action , typeof ( T1 ) , typeof ( T2 ) ) ;
30
+ return @this . RegisterInterceptors ( action , typeof ( T1 ) , typeof ( T2 ) ) ;
31
31
}
32
32
33
33
public static ICallInterceptorRegistry Register < TObj , T1 , T2 , T3 > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action )
34
34
where T1 : ICallInterceptor , new ( )
35
35
where T2 : ICallInterceptor , new ( )
36
36
where T3 : ICallInterceptor , new ( )
37
37
{
38
- return @this . RegisterObjects ( action , typeof ( T1 ) , typeof ( T2 ) , typeof ( T3 ) ) ;
38
+ return @this . RegisterInterceptors ( action , typeof ( T1 ) , typeof ( T2 ) , typeof ( T3 ) ) ;
39
39
}
40
40
41
41
public static ICallInterceptorRegistry Register < TObj , T1 , T2 , T3 , T4 > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action )
@@ -44,42 +44,27 @@ public static ICallInterceptorRegistry Register<TObj, T1, T2, T3, T4>(this ICall
44
44
where T3 : ICallInterceptor , new ( )
45
45
where T4 : ICallInterceptor , new ( )
46
46
{
47
- return @this . RegisterObjects ( action , typeof ( T1 ) , typeof ( T2 ) , typeof ( T3 ) , typeof ( T4 ) ) ;
47
+ return @this . RegisterInterceptors ( action , typeof ( T1 ) , typeof ( T2 ) , typeof ( T3 ) , typeof ( T4 ) ) ;
48
48
}
49
49
50
50
public static ICallInterceptorRegistry Register < TObj > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action , Predicate < IActionInvocation > before , Action < IActionReturn > after )
51
51
{
52
- return @this . RegisterObjects ( action , new DelegatedCallInterceptor ( before , after ) ) ;
53
- }
54
-
55
- public static ICallInterceptorRegistry Register < TObj > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action , Action < IActionInvocation > before )
56
- {
57
- return Register ( @this , action , x => { before ( x ) ; return true ; } , null ) ;
58
- }
59
-
60
- public static ICallInterceptorRegistry Register < TObj > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action , Predicate < IActionInvocation > before )
61
- {
62
- return Register ( @this , action , before , null ) ;
63
- }
64
-
65
- public static ICallInterceptorRegistry Register < TObj > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action , Action < IActionReturn > after )
66
- {
67
- return Register ( @this , action , null , after ) ;
52
+ return @this . RegisterInterceptors ( action , new DelegatedCallInterceptor ( before , after ) ) ;
68
53
}
69
54
70
55
public static ICallInterceptorRegistry RegisterBefore < TObj > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action , Action < IActionInvocation > before )
71
56
{
72
- return Register ( @this , action , x => { before ( x ) ; return true ; } , null ) ;
57
+ return @this . Register ( action , x => { before ( x ) ; return true ; } , null ) ;
73
58
}
74
59
75
60
public static ICallInterceptorRegistry RegisterBeforeCancellable < TObj > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action , Predicate < IActionInvocation > before )
76
61
{
77
- return Register ( @this , action , before , null ) ;
62
+ return @this . Register ( action , before , null ) ;
78
63
}
79
64
80
65
public static ICallInterceptorRegistry RegisterAfter < TObj > ( this ICallInterceptorRegistry @this , Expression < Action < TObj > > action , Action < IActionReturn > after )
81
66
{
82
- return Register ( @this , action , null , after ) ;
67
+ return @this . Register ( action , null , after ) ;
83
68
}
84
69
}
85
70
}
0 commit comments