public void Main(string[] args)
        {
            var container = InicializarContainer();

            _servico = container.Resolve<IMeuServico>();
            _servico.Executar();
        }
Exemplo n.º 2
0
        public void Main(string[] args)
        {
            var container = new WindsorContainer();

            container.Register(Component.For<IMeuServico>().ImplementedBy<MeuServico>());
            container.Register(Component.For<IMeuServicoUtil>().ImplementedBy<MeuServicoUtil>());

            container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel));
            container.Register(Component.For<IMeuRepositorio>().ImplementedBy<MeuRepositorio1>());
            container.Register(Component.For<IMeuRepositorio>().ImplementedBy<MeuRepositorio2>());

            _servico = container.Resolve<IMeuServico>();
            _servico.Executar();
        }
        public void Main(string[] args)
        {
            IMeuRepositorio _meuRepositorio = new MeuRepositorio();
            IMeuServicoUtil _meuServicoUtil = new MeuServicoUtil(_meuRepositorio);
            _servico = new MeuServico(_meuServicoUtil);

            _servico.Executar();
        }