Ejemplo n.º 1
0
        static void SubMainWithDI()
        {
            //with dependency injection, it will automatically injected the proper object into arguments.
            ContextA _contextA = Container.Resolve <ContextA>();
            ContextB _contextB = Container.Resolve <ContextB>();
            ContextC _contextC = Container.Resolve <ContextC>();

            _contextA.DoSomething();
            _contextB.DoSomething();
            _contextC.DoSomething();
        }
Ejemplo n.º 2
0
        static void SubMainWithoutDI()
        {
            //without dependency injection, manually inputed the object
            ContextA contextA = new ContextA(new ClassA());
            ContextB contextB = new ContextB(new ClassA(), new ClassB());
            ContextC contextC = new ContextC(new ClassA(), new ClassB(), new ClassC());

            contextA.DoSomething();
            contextB.DoSomething();
            contextC.DoSomething();
        }