/// <summary>
 /// Fluent method for setting the registration configuration on <see cref="Autofac.Features.ResolveAnything.AnyConcreteTypeNotAlreadyRegisteredSource"/>.
 /// </summary>
 /// <param name="source">The registration source to configure.</param>
 /// <param name="configurationAction">A configuration action that will run on any registration provided by the source.</param>
 /// <returns>
 /// The <paramref name="source" /> with the registration configuration set.
 /// </returns>
 public static AnyConcreteTypeNotAlreadyRegisteredSource WithRegistrationsAs(this AnyConcreteTypeNotAlreadyRegisteredSource source, Action <IRegistrationBuilder <object, ConcreteReflectionActivatorData, SingleRegistrationStyle> > configurationAction)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     source.RegistrationConfiguration = configurationAction;
     return(source);
 }
Пример #2
0
 public void TypesIgnoredUsingPredicateAreNotResolvedFromTheContainer()
 {
     var cb = new ContainerBuilder();
     var registrationSource = new AnyConcreteTypeNotAlreadyRegisteredSource(t => !t.IsAssignableTo<string>());
     cb.RegisterSource(registrationSource);
     var container = cb.Build();
     Assert.False(container.IsRegistered<string>());
 }