Esempio n. 1
0
        public void ResolveInterceptors()
        {
            var fileName = @"..\..\..\ResolveInterceptors.txt";

            File.WriteAllText(fileName, "");
            var serviceProvider = new ServiceCollection().BuildServiceProvider();
            var collector       = new InterceptorCollector(new InterceptorChainBuilder(serviceProvider));
            var sw = Stopwatch.StartNew();

            collector.GetInterceptors(typeof(Demo));
            File.AppendAllLines(fileName, new string[] { sw.Elapsed.ToString() });

            sw.Restart();
            collector.GetInterceptors(typeof(Demo));
            File.AppendAllLines(fileName, new string[] { sw.Elapsed.ToString() });

            sw.Restart();
            collector.GetInterceptors(typeof(Demo));
            File.AppendAllLines(fileName, new string[] { sw.Elapsed.ToString() });

            Console.WriteLine(sw.Elapsed);
        }