Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var    service    = new HelloService();
            var    controller = new HomeController(service);
            string greeting   = controller.Index("Stephanie");

            Console.WriteLine(greeting);
        }
Exemplo n.º 2
0
        private static void UseDependencyInjection()
        {
            IHelloService hello = new HelloService();

            var greetingController = new HelloController(hello);

            string result = greetingController.Greeting("Tobi");

            Console.WriteLine(result);
        }
        public string Greeting(string name)
        {
            var service = new HelloService();

            return(service.Hello(name));
        }