/// <summary>
        /// Represents the entry point to the application.
        /// </summary>
        /// <param name="args">The command line arguments, which should always be empty, since they are not used in the application.</param>
        public static void Main(string[] args)
        {
            // Asks the user to specifiy which IoC container shall be used
            System.Console.Write("Use 'SimpleIoC' or 'Ninject': ");
            IIocContainer iocContainer;
            if (System.Console.ReadLine().ToUpperInvariant() == "NINJECT")
                iocContainer = new NinjectIocContainer();
            else
                iocContainer = new SimpleIocContainer();

            // Binds the vehicles to the kernel
            iocContainer.RegisterType<IVehicle, Car>();
            iocContainer.RegisterType<IVehicle, Motorcycle>(typeof(SuperCoolPerson)); // Obviously super cool people drive motorcycles!

            // Creates some persons
            Person person = iocContainer.GetInstance<Person>();
            Person superCoolPerson = iocContainer.GetInstance<SuperCoolPerson>();
            Person namedPerson = iocContainer.GetInstance<NamedPerson>("Bob");

            // Prints out the personal information about the persons that were created
            System.Console.WriteLine(person);
            System.Console.WriteLine(superCoolPerson);
            System.Console.WriteLine(namedPerson);

            // Waits for a key stroke, before the application is quit
            System.Console.WriteLine("Press any key to quit...");
            System.Console.ReadKey();
        }
        public void NinjectShouldRetrieveAllImageStorageInterfaces()
        {
            var container = new NinjectIocContainer();

            container.Register();

            foreach (var imageStorage in Enum.GetNames(typeof(DataStorageType)).Select(container.Resolve<IDataStorage<IImageSource>>))
            {
                Assert.IsNotNull(imageStorage);
            }
        }
Exemple #3
0
 public static void Run()
 {
     Ioc.Initialize(NinjectIocContainer.Create(new StandardKernel(new uFluentMigrateModule())));
     Ioc.Get <IMigrationProcessor>().Run();
 }