@@ -17,44 +17,6 @@ namespace Autofac;
1717[ SuppressMessage ( "Microsoft.Maintainability" , "CA1506:AvoidExcessiveClassCoupling" , Justification = "RegistrationBuilder is where all registration syntax lives." ) ]
1818public static partial class RegistrationExtensions
1919{
20- /// <summary>
21- /// Decorate all components implementing open generic service <paramref name="decoratedServiceType"/>.
22- /// The <paramref name="fromKey"/> and <paramref name="toKey"/> parameters must be different values.
23- /// </summary>
24- /// <param name="builder">Container builder.</param>
25- /// <param name="decoratorType">
26- /// The type of the decorator. Must be an open generic type, and accept a parameter
27- /// of type <paramref name="decoratedServiceType"/>, which will be set to the instance being decorated.
28- /// </param>
29- /// <param name="decoratedServiceType">Service type being decorated. Must be an open generic type.</param>
30- /// <param name="fromKey">Service key or name associated with the components being decorated.</param>
31- /// <param name="toKey">Service key or name given to the decorated components.</param>
32- /// <returns>The decorator registration for continued configuration.</returns>
33- public static IRegistrationBuilder < object , OpenGenericDecoratorActivatorData , DynamicRegistrationStyle >
34- RegisterGenericDecorator (
35- this ContainerBuilder builder ,
36- [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors ) ] Type decoratorType ,
37- Type decoratedServiceType ,
38- object fromKey ,
39- object ? toKey = null )
40- {
41- if ( builder == null )
42- {
43- throw new ArgumentNullException ( nameof ( builder ) ) ;
44- }
45-
46- if ( decoratorType == null )
47- {
48- throw new ArgumentNullException ( nameof ( decoratorType ) ) ;
49- }
50-
51- if ( decoratedServiceType == null )
52- {
53- throw new ArgumentNullException ( nameof ( decoratedServiceType ) ) ;
54- }
55-
56- return OpenGenericRegistrationExtensions . RegisterGenericDecorator ( builder , decoratorType , decoratedServiceType , fromKey , toKey ) ;
57- }
5820
5921 /// <summary>
6022 /// Decorate all components implementing service <typeparamref name="TService"/>
@@ -275,6 +237,45 @@ public static void RegisterDecorator<TService>(
275237 builder . RegisterCallback ( crb => crb . Register ( decoratorRegistration ) ) ;
276238 }
277239
240+ /// <summary>
241+ /// Decorate all components implementing open generic service <paramref name="decoratedServiceType"/>.
242+ /// The <paramref name="fromKey"/> and <paramref name="toKey"/> parameters must be different values.
243+ /// </summary>
244+ /// <param name="builder">Container builder.</param>
245+ /// <param name="decoratorType">
246+ /// The type of the decorator. Must be an open generic type, and accept a parameter
247+ /// of type <paramref name="decoratedServiceType"/>, which will be set to the instance being decorated.
248+ /// </param>
249+ /// <param name="decoratedServiceType">Service type being decorated. Must be an open generic type.</param>
250+ /// <param name="fromKey">Service key or name associated with the components being decorated.</param>
251+ /// <param name="toKey">Service key or name given to the decorated components.</param>
252+ /// <returns>The decorator registration for continued configuration.</returns>
253+ public static IRegistrationBuilder < object , OpenGenericDecoratorActivatorData , DynamicRegistrationStyle >
254+ RegisterGenericDecorator (
255+ this ContainerBuilder builder ,
256+ [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors ) ] Type decoratorType ,
257+ Type decoratedServiceType ,
258+ object fromKey ,
259+ object ? toKey = null )
260+ {
261+ if ( builder == null )
262+ {
263+ throw new ArgumentNullException ( nameof ( builder ) ) ;
264+ }
265+
266+ if ( decoratorType == null )
267+ {
268+ throw new ArgumentNullException ( nameof ( decoratorType ) ) ;
269+ }
270+
271+ if ( decoratedServiceType == null )
272+ {
273+ throw new ArgumentNullException ( nameof ( decoratedServiceType ) ) ;
274+ }
275+
276+ return OpenGenericRegistrationExtensions . RegisterGenericDecorator ( builder , decoratorType , decoratedServiceType , fromKey , toKey ) ;
277+ }
278+
278279 /// <summary>
279280 /// Decorate all components implementing open generic service <paramref name="serviceType"/>.
280281 /// </summary>
0 commit comments