コード例 #1
0
        /// <summary>
        /// Scans for all implementations of <typeparamref name="TRegistration"/> and registers them.
        /// </summary>
        /// <param name="lifetime">Lifetime of the registration, defaults to singleton</param>
        /// <typeparam name="TRegistration">The <see cref="Type"/> to scan for and register as.</typeparam>
        public void RegisterAll <TRegistration>(Lifetime lifetime = Lifetime.Singleton)
        {
            var implementations = AppDomainAssemblyTypeScanner
                                  .TypesOf <TRegistration>();

            var registration =
                new CollectionTypeRegistration(typeof(TRegistration), implementations, lifetime);

            this.collectionRegistrations.Add(registration);
        }
コード例 #2
0
        /// <summary>
        /// Scans for all implementations of <typeparamref name="TRegistration"/> and registers them.
        /// </summary>
        /// <param name="lifetime">Lifetime of the registration, defaults to singleton</param>
        /// <typeparam name="TRegistration">The <see cref="Type"/> to scan for and register as.</typeparam>
        public void RegisterAll <TRegistration>(Lifetime lifetime = Lifetime.Singleton)
        {
            var implementations = this.typeCatalog
                                  .GetTypesAssignableTo <TRegistration>();

            var registration =
                new CollectionTypeRegistration(typeof(TRegistration), implementations, lifetime);

            this.collectionRegistrations.Add(registration);
        }