PageRenderTime 247ms CodeModel.GetById 141ms app.highlight 5ms RepoModel.GetById 96ms app.codeStats 0ms

/examples/ioc/DependencyInjectionSample/Program.cs

http://github.com/philiplaureano/LinFu
C# | 29 lines | 23 code | 4 blank | 2 comment | 0 complexity | 21a805d460781358bf71e6b72a77058b MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Text;
 4using CarLibrary;
 5using LinFu.IoC;
 6using LinFu.IoC.Configuration;
 7using LinFu.IoC.Interfaces;
 8
 9namespace DependencyInjectionSample
10{
11    class Program
12    {
13        static void Main(string[] args)
14        {
15            string directory = AppDomain.CurrentDomain.BaseDirectory;
16            var container = new ServiceContainer();
17
18            // Load CarLibrary.dll; If you need load
19            // all the libaries in a directory, use "*.dll" instead
20            container.LoadFrom(directory, "CarLibrary.dll");
21
22            IVehicle vehicle = container.GetService<IVehicle>();
23
24            Console.WriteLine("Press ENTER to continue...");
25            Console.ReadLine();
26            return;
27        }
28    }
29}