Example #1
0
 /// <summary>
 /// Configures a collection of dependency-consuming types, such that any dependencies
 /// they consume (which are interfaces) will be resolved auto-lazily.
 /// Note that the consuming types are the concrete classes requiring dependencies,
 /// and not their interfaces.
 /// </summary>
 /// <param name="builder">An Autofac container builder.</param>
 /// <param name="handlePropertyInjection">If set to <c>true</c> then property-injection is handled,
 /// by setting any settable properties on the resolved instance of the <paramref name="consumerTypes"/>,
 /// where the property-type is a resolvable interface, to an auto-lazy instance.
 /// If <c>false</c> then the property-injection process (if any) will not be altered.</param>
 /// <param name="consumerTypes">The types of the dependency-consuming components.</param>
 public static void MakeConsumedInterfacesAutoLazy(this ContainerBuilder builder,
                                                   bool handlePropertyInjection,
                                                   params Type[] consumerTypes)
 => builder.MakeConsumedInterfacesAutoLazy(consumerTypes, handlePropertyInjection);
Example #2
0
 /// <summary>
 /// Configures a collection of dependency-consuming types, such that any dependencies
 /// they consume (which are interfaces) will be resolved auto-lazily.
 /// Note that the consuming types are the concrete classes requiring dependencies,
 /// and not their interfaces.
 /// </summary>
 /// <param name="builder">An Autofac container builder.</param>
 /// <param name="consumerTypes">The types of the dependency-consuming components.</param>
 /// <param name="handlePropertyInjection">If set to <c>true</c> then property-injection is handled,
 /// by setting any settable properties on the resolved instance of the <paramref name="consumerTypes"/>,
 /// where the property-type is a resolvable interface, to an auto-lazy instance.
 /// If <c>false</c> then the property-injection process (if any) will not be altered.</param>
 public static void MakeConsumedInterfacesAutoLazy(this ContainerBuilder builder,
                                                   IEnumerable <Type> consumerTypes,
                                                   bool handlePropertyInjection = DefaultPropertyInjection)
 => builder.MakeConsumedInterfacesAutoLazy(t => consumerTypes.Contains(t), handlePropertyInjection);
Example #3
0
 /// <summary>
 /// Configures a dependency-consuming type, such that any dependencies
 /// it consumes (which are interfaces) will be resolved auto-lazily.
 /// Note that the consuming type is the concrete class requiring dependencies,
 /// and not its interface.
 /// </summary>
 /// <param name="builder">An Autofac container builder.</param>
 /// <param name="handlePropertyInjection">If set to <c>true</c> then property-injection is handled,
 /// by setting any settable properties on the resolved instance of <typeparamref name="T"/>, where the
 /// property-type is a resolvable interface, to an auto-lazy instance.
 /// If <c>false</c> then the property-injection process (if any) will not be altered.</param>
 /// <typeparam name="T">The type of the dependency-consuming component.</typeparam>
 public static void MakeConsumedInterfacesAutoLazy <T>(this ContainerBuilder builder,
                                                       bool handlePropertyInjection = DefaultPropertyInjection) where T : class
 => builder.MakeConsumedInterfacesAutoLazy(t => Equals(t, typeof(T)), handlePropertyInjection);