22
33using System ;
44using System . Globalization ;
5- using Microsoft . Practices . ObjectBuilder2 ;
6- using Unity . Interception . Properties ;
7- using Unity ;
85using Unity . Builder ;
96using Unity . Extension ;
7+ using Unity . Interception . ContainerIntegration . ObjectBuilder ;
8+ using Unity . Interception . Interceptors ;
9+ using Unity . Interception . Interceptors . InstanceInterceptors ;
10+ using Unity . Interception . Interceptors . TypeInterceptors ;
11+ using Unity . Interception . PolicyInjection ;
12+ using Unity . Interception . PolicyInjection . Policies ;
13+ using Unity . Interception . Properties ;
14+ using Unity . Interception . Utilities ;
1015using Unity . Policy ;
11- using Guard = Microsoft . Practices . Unity . Utility . Guard ;
1216using Unity . Strategy ;
1317
14- namespace Microsoft . Practices . Unity . InterceptionExtension
18+ namespace Unity . Interception . ContainerIntegration
1519{
1620 /// <summary>
1721 /// A Unity container extension that allows you to configure
@@ -36,10 +40,8 @@ protected override void Initialize()
3640 // have taken place.
3741 Context . Strategies . AddNew < InstanceInterceptionStrategy > ( UnityBuildStage . Setup ) ;
3842 Context . Strategies . AddNew < TypeInterceptionStrategy > ( UnityBuildStage . PreCreation ) ;
39- Context . Container
40- . RegisterInstance < InjectionPolicy > (
41- typeof ( AttributeDrivenPolicy ) . AssemblyQualifiedName ,
42- new AttributeDrivenPolicy ( ) ) ;
43+ Context . Container . RegisterInstance < InjectionPolicy > ( typeof ( AttributeDrivenPolicy ) . AssemblyQualifiedName ,
44+ new AttributeDrivenPolicy ( ) ) ;
4345 }
4446
4547 /// <summary>
@@ -76,7 +78,7 @@ public Interception SetInterceptorFor(Type typeToIntercept, string name, ITypeIn
7678 /// <returns>This extension object.</returns>
7779 public Interception SetInterceptorFor ( Type typeToIntercept , ITypeInterceptor interceptor )
7880 {
79- return this . SetInterceptorFor ( typeToIntercept , null , interceptor ) ;
81+ return SetInterceptorFor ( typeToIntercept , null , interceptor ) ;
8082 }
8183
8284 /// <summary>
@@ -86,10 +88,9 @@ public Interception SetInterceptorFor(Type typeToIntercept, ITypeInterceptor int
8688 /// <param name="name">Name type is registered under.</param>
8789 /// <param name="interceptor">Interceptor object to use.</param>
8890 /// <returns>This extension object.</returns>
89- [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Design" , "CA1004:GenericMethodsShouldProvideTypeParameter" , Justification = "As designed" ) ]
9091 public Interception SetInterceptorFor < T > ( string name , ITypeInterceptor interceptor )
9192 {
92- return this . SetInterceptorFor ( typeof ( T ) , name , interceptor ) ;
93+ return SetInterceptorFor ( typeof ( T ) , name , interceptor ) ;
9394 }
9495
9596 /// <summary>
@@ -98,10 +99,9 @@ public Interception SetInterceptorFor<T>(string name, ITypeInterceptor intercept
9899 /// <typeparam name="T">Type to intercept</typeparam>
99100 /// <param name="interceptor">Interceptor object to use.</param>
100101 /// <returns>This extension object.</returns>
101- [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Design" , "CA1004:GenericMethodsShouldProvideTypeParameter" , Justification = "As designed" ) ]
102102 public Interception SetInterceptorFor < T > ( ITypeInterceptor interceptor )
103103 {
104- return this . SetInterceptorFor ( typeof ( T ) , null , interceptor ) ;
104+ return SetInterceptorFor ( typeof ( T ) , null , interceptor ) ;
105105 }
106106
107107 /// <summary>
@@ -158,10 +158,9 @@ public Interception SetDefaultInterceptorFor(Type typeToIntercept, ITypeIntercep
158158 /// <typeparam name="TTypeToIntercept">Type to intercept</typeparam>
159159 /// <param name="interceptor">Interceptor instance.</param>
160160 /// <returns>This extension object.</returns>
161- [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Design" , "CA1004:GenericMethodsShouldProvideTypeParameter" , Justification = "As designed" ) ]
162161 public Interception SetDefaultInterceptorFor < TTypeToIntercept > ( ITypeInterceptor interceptor )
163162 {
164- return this . SetDefaultInterceptorFor ( typeof ( TTypeToIntercept ) , interceptor ) ;
163+ return SetDefaultInterceptorFor ( typeof ( TTypeToIntercept ) , interceptor ) ;
165164 }
166165
167166 /// <summary>
@@ -172,7 +171,7 @@ public Interception SetDefaultInterceptorFor<TTypeToIntercept>(ITypeInterceptor
172171 /// <returns>This extension object.</returns>
173172 public Interception SetInterceptorFor ( Type typeToIntercept , IInstanceInterceptor interceptor )
174173 {
175- return this . SetInterceptorFor ( typeToIntercept , null , interceptor ) ;
174+ return SetInterceptorFor ( typeToIntercept , null , interceptor ) ;
176175 }
177176
178177 /// <summary>
@@ -182,10 +181,9 @@ public Interception SetInterceptorFor(Type typeToIntercept, IInstanceInterceptor
182181 /// <param name="name">Name type is registered under.</param>
183182 /// <param name="interceptor">Instance interceptor to use.</param>
184183 /// <returns>This extension object.</returns>
185- [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Design" , "CA1004:GenericMethodsShouldProvideTypeParameter" , Justification = "As designed" ) ]
186184 public Interception SetInterceptorFor < T > ( string name , IInstanceInterceptor interceptor )
187185 {
188- return this . SetInterceptorFor ( typeof ( T ) , name , interceptor ) ;
186+ return SetInterceptorFor ( typeof ( T ) , name , interceptor ) ;
189187 }
190188
191189 /// <summary>
@@ -194,10 +192,9 @@ public Interception SetInterceptorFor<T>(string name, IInstanceInterceptor inter
194192 /// <typeparam name="T">Type to intercept.</typeparam>
195193 /// <param name="interceptor">Instance interceptor to use.</param>
196194 /// <returns>This extension object.</returns>
197- [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Design" , "CA1004:GenericMethodsShouldProvideTypeParameter" , Justification = "As designed" ) ]
198195 public Interception SetInterceptorFor < T > ( IInstanceInterceptor interceptor )
199196 {
200- return this . SetInterceptorFor ( typeof ( T ) , null , interceptor ) ;
197+ return SetInterceptorFor ( typeof ( T ) , null , interceptor ) ;
201198 }
202199
203200 /// <summary>
@@ -228,10 +225,9 @@ public Interception SetDefaultInterceptorFor(Type typeToIntercept, IInstanceInte
228225 /// <typeparam name="TTypeToIntercept">Type the interception is being configured for.</typeparam>
229226 /// <param name="interceptor">The interceptor to use by default.</param>
230227 /// <returns>This extension object.</returns>
231- [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Design" , "CA1004:GenericMethodsShouldProvideTypeParameter" , Justification = "As designed" ) ]
232228 public Interception SetDefaultInterceptorFor < TTypeToIntercept > ( IInstanceInterceptor interceptor )
233229 {
234- return this . SetDefaultInterceptorFor ( typeof ( TTypeToIntercept ) , interceptor ) ;
230+ return SetDefaultInterceptorFor ( typeof ( TTypeToIntercept ) , interceptor ) ;
235231 }
236232
237233 private static void GuardTypeInterceptable ( Type typeToIntercept , IInterceptor interceptor )
@@ -243,7 +239,7 @@ private static void GuardTypeInterceptable(Type typeToIntercept, IInterceptor in
243239 CultureInfo . CurrentCulture ,
244240 Resources . InterceptionNotSupported ,
245241 typeToIntercept . FullName ) ,
246- " typeToIntercept" ) ;
242+ nameof ( typeToIntercept ) ) ;
247243 }
248244 }
249245
0 commit comments