Example #1
0
        public override void ConfigureServices(IServiceCollection services)
        {
            base.ConfigureServices(services);
            Sites.GetSites().ForEach(site =>
            {
                ServiceManager.GetServiceCollection(site)
                .AddSingleton <IAsyncInterceptor, LoggerAsyncInterceptor>()
                .AddSingleton <IAsyncInterceptor, PolicyAsyncInterceptor>()
                .AddSingleton <IPolicyFactory, Common.PolicyFactory>();
            });
            ServiceManager.BuildServices();

            /*
             * var a0 = ServiceManager.GetService<ITest>("AAA");
             * a0.Work();
             * a0.Wait();
             * var s1 = await a0.GetIdAsync();
             * var s2 = await a0.GetNamesAsync();
             */
            /*
             *лн─▄ио╬Ш
             * int ii = 0;
             * var a0 = ServiceManager.GetService<ITest>("AAA");
             * Stopwatch stopwatch = new Stopwatch();
             * stopwatch.Start();
             * while (ii < 100000)
             * {
             *  var a00 = ServiceManager.GetService<ITest>("AAA");
             *  ii++;
             * }
             *
             * stopwatch.Stop();
             *
             * stopwatch.Stop();
             */
        }