public static AutoRegisterData Where(this AutoRegisterData autoRegData, Func <Type, bool> predicate)
        {
            if (autoRegData == null)
            {
                throw new ArgumentNullException(nameof(autoRegData));
            }

            autoRegData.TypeFilter = predicate;
            return(new AutoRegisterData(autoRegData.Services, autoRegData.TypesToConsider.Where(predicate)));
        }
        public static IServiceCollection AsImplementedInterfaces(
            this AutoRegisterData autoRegData,
            ServiceLifetime lifetime = ServiceLifetime.Transient)
        {
            if (autoRegData == null)
            {
                throw new ArgumentNullException(nameof(autoRegData));
            }

            foreach (var classType in autoRegData.TypeFilter == null
                ? autoRegData.TypesToConsider
                : autoRegData.TypesToConsider.Where(autoRegData.TypeFilter))
            {
                var interfaces = classType.GetTypeInfo().ImplementedInterfaces
                                 .Where(i => i != typeof(IDisposable) && i.IsPublic);
                foreach (var infc in interfaces)
                {
                    autoRegData.Services.Add(new ServiceDescriptor(infc, classType, lifetime));
                }
            }

            return(autoRegData.Services);
        }