private static ComponentRegistration <TService> ResolveLifestyle <TService>(ComponentRegistration <TService> registration, Microsoft.Extensions.DependencyInjection.ServiceDescriptor service) where TService : class
        {
            switch (service.Lifetime)
            {
            case ServiceLifetime.Singleton:
                return(registration.LifeStyle.NetCoreStatic());

            case ServiceLifetime.Scoped:
                return(registration.LifeStyle.ScopedToNetCoreScope());

            case ServiceLifetime.Transient:
                return(registration.LifestyleNetCoreTransient());

            default:
                throw new System.ArgumentException($"Invalid lifetime {service.Lifetime}");
            }
        }