コード例 #1
0
        public IServiceCollection GetServiceDescriptors()
        {
            IServiceCollection serviceDescriptors = new ServiceCollection();

            serviceDescriptors.AddTransient <ILogger <Kyameru.Route> >(sp =>
            {
                return(this.logger.Object);
            });

            Inflator inflator = new Inflator();

            inflator.RegisterFrom(serviceDescriptors);
            inflator.RegisterTo(serviceDescriptors);

            return(serviceDescriptors);
        }
コード例 #2
0
        private IServiceCollection GetServiceDescriptors(bool tryFrom = false)
        {
            IServiceCollection serviceDescriptors = new ServiceCollection();

            serviceDescriptors.AddTransient <ILogger <Kyameru.Route> >(sp =>
            {
                return(this.logger.Object);
            });

            Inflator inflator = new Inflator();

            inflator.RegisterTo(serviceDescriptors);
            if (tryFrom)
            {
                inflator.RegisterFrom(serviceDescriptors);
            }

            return(serviceDescriptors);
        }