/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

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