/// <summary> /// Adds rule to include certain types that satisfy specified type filter /// and register them using specified registration options /// </summary> /// <param name="typeFilter">Type filter.</param> /// <param name="registrationOptions">RegistrationOptions options.</param> /// <returns>Auto registration</returns> public virtual IAutoRegistration Include(Predicate<Type> typeFilter, IRegistrationOptions registrationOptions) { if (typeFilter == null) { throw new ArgumentNullException("typeFilter"); } if (registrationOptions == null) { throw new ArgumentNullException("registrationOptions"); } registrationEntries.Add(new RegistrationEntry( typeFilter, (t, c) => { registrationOptions.Type = t; foreach (var contract in registrationOptions.Interfaces) { c.RegisterType( contract, t, registrationOptions.Name, registrationOptions.LifetimeManager); } }, container)); return this; }
/// <summary> /// Adds rule to include certain types that satisfy specified type filter /// and register them using specified registration options /// </summary> /// <param name="typeFilter">Type filter.</param> /// <param name="registrationOptions">RegistrationOptions options.</param> /// <returns>Auto registration</returns> public virtual IAutoRegistration Include( Predicate <Type> typeFilter, IRegistrationOptions registrationOptions) { if (typeFilter == null) { throw new ArgumentNullException("typeFilter"); } if (registrationOptions == null) { throw new ArgumentNullException("registrationOptions"); } _registrationEntries.Add(new RegistrationEntry( typeFilter, (t, c) => { registrationOptions.Type = t; foreach (var contract in registrationOptions.Interfaces) { c.RegisterType( contract, t, registrationOptions.Name, registrationOptions.LifetimeManager); } }, _container)); return(this); }
/// <summary> /// Adds rule to include certain types that satisfy specified type filter /// and register them using specified registration options /// </summary> /// <param name="typeFilter">Type filter.</param> /// <param name="registrationOptions">RegistrationOptions options.</param> /// <returns>Auto registration</returns> public virtual IAutoRegistration Include( Predicate <Type> typeFilter, IRegistrationOptions registrationOptions) { if (typeFilter == null) { throw new ArgumentNullException("typeFilter"); } if (registrationOptions == null) { throw new ArgumentNullException("registrationOptions"); } _registrationEntries.Add(new RegistrationEntry( typeFilter, (t, c) => { registrationOptions.Type = t; foreach (var contract in registrationOptions.Interfaces) { c.Add(new ServiceDescriptor( contract, t, registrationOptions.ServiceLifetime)); } }, _services)); return(this); }