示例#1
0
        private void Add()
        {
            using (var scope = _container.BeginLifetimeScope())
            {
                _addClassWithRefit = scope.Resolve<AddClassWithRefit>();
                _addClassWithoutRefit = scope.Resolve<AddClassWithoutRefit>();

                var result = _addClassWithoutRefit.Add(5, 10);
                Console.WriteLine("Without refit: " + result);
                Console.ReadLine();

                result = _addClassWithRefit.Add(5, 10);
                Console.WriteLine("With refit: " + result);
                Console.ReadLine();
            }
        }
示例#2
0
        private void Add()
        {
            using (var scope = _container.BeginLifetimeScope())
            {
                _addClassWithRefit    = scope.Resolve <AddClassWithRefit>();
                _addClassWithoutRefit = scope.Resolve <AddClassWithoutRefit>();

                var result = _addClassWithoutRefit.Add(5, 10);
                Console.WriteLine("Without refit: " + result);
                Console.ReadLine();

                result = _addClassWithRefit.Add(5, 10);
                Console.WriteLine("With refit: " + result);
                Console.ReadLine();
            }
        }