@@ -12,44 +12,21 @@ namespace LazyProxy.Autofac
12
12
/// </summary>
13
13
public static class AutofacExtensions
14
14
{
15
- /// <summary>
16
- /// Is used to register interface TFrom to class TTo by creation a lazy proxy at runtime.
17
- /// The real class To will be instantiated only after first method or property execution.
18
- /// </summary>
19
- /// <param name="builder">The instance of the Autofac container builder.</param>
20
- /// <typeparam name="TFrom">The linked interface.</typeparam>
21
- /// <typeparam name="TTo">The linked class.</typeparam>
22
- /// <returns>The instance of the Autofac registration builder.</returns>
23
- public static IRegistrationBuilder < object , SimpleActivatorData , SingleRegistrationStyle >
24
- RegisterLazy < TFrom , TTo > ( this ContainerBuilder builder )
25
- where TTo : TFrom where TFrom : class =>
26
- builder . RegisterLazy ( typeof ( TFrom ) , typeof ( TTo ) , null ) ;
27
-
28
15
/// <summary>
29
16
/// Is used to register interface TFrom to class TTo by creation a lazy proxy at runtime.
30
17
/// The real class To will be instantiated only after first method or property execution.
31
18
/// </summary>
32
19
/// <param name="builder">The instance of the Autofac container builder.</param>
33
20
/// <param name="name">The registration name. Null if named registration is not required.</param>
21
+ /// <param name="nonLazyRegistrationMutator">A mutator allowing to change the non-lazy registration.</param>
34
22
/// <typeparam name="TFrom">The linked interface.</typeparam>
35
23
/// <typeparam name="TTo">The linked class.</typeparam>
36
24
/// <returns>The instance of the Autofac registration builder.</returns>
37
25
public static IRegistrationBuilder < object , SimpleActivatorData , SingleRegistrationStyle >
38
- RegisterLazy < TFrom , TTo > ( this ContainerBuilder builder , string name )
26
+ RegisterLazy < TFrom , TTo > ( this ContainerBuilder builder , string name = null ,
27
+ IRegistrationMutator nonLazyRegistrationMutator = null )
39
28
where TTo : TFrom where TFrom : class =>
40
- builder . RegisterLazy ( typeof ( TFrom ) , typeof ( TTo ) , name ) ;
41
-
42
- /// <summary>
43
- /// Is used to register interface TFrom to class TTo by creation a lazy proxy at runtime.
44
- /// The real class To will be instantiated only after first method execution.
45
- /// </summary>
46
- /// <param name="typeFrom">The linked interface.</param>
47
- /// <param name="typeTo">The linked class.</param>
48
- /// <param name="builder">The instance of the Autofac container builder.</param>
49
- /// <returns>The instance of the Autofac registration builder.</returns>
50
- public static IRegistrationBuilder < object , SimpleActivatorData , SingleRegistrationStyle >
51
- RegisterLazy ( this ContainerBuilder builder , Type typeFrom , Type typeTo ) =>
52
- builder . RegisterLazy ( typeFrom , typeTo , null ) ;
29
+ builder . RegisterLazy ( typeof ( TFrom ) , typeof ( TTo ) , name , nonLazyRegistrationMutator ) ;
53
30
54
31
/// <summary>
55
32
/// Is used to register interface TFrom to class TTo by creation a lazy proxy at runtime.
@@ -62,7 +39,7 @@ public static IRegistrationBuilder<object, SimpleActivatorData, SingleRegistrati
62
39
/// <param name="nonLazyRegistrationMutator">A mutator allowing to change the non-lazy registration.</param>
63
40
/// <returns>The instance of the Autofac registration builder.</returns>
64
41
public static IRegistrationBuilder < object , SimpleActivatorData , SingleRegistrationStyle >
65
- RegisterLazy ( this ContainerBuilder builder , Type typeFrom , Type typeTo , string name ,
42
+ RegisterLazy ( this ContainerBuilder builder , Type typeFrom , Type typeTo , string name = null ,
66
43
IRegistrationMutator nonLazyRegistrationMutator = null )
67
44
{
68
45
// There is no way to constraint it on the compilation step.
0 commit comments