Esempio n. 1
0
        public static IKernel Create(ModuleSettingConfiguration settings)
        {
            if (settings == null)
            {
                throw new ArgumentException("Invalid dependency settings or path");
            }

            IKernel kernel = Create( );

            LoadModules(kernel, settings);

            return(kernel);
        }
Esempio n. 2
0
        private static void LoadModules(IKernel kernel, ModuleSettingConfiguration settings)
        {
            foreach (ModuleSetting module in settings.Modules)
            {
                Type type = Type.GetType(module.Type, false);

                if (type == null)
                {
                    throw new ConfigurationErrorsException("Invalid module in configuration: " + module.Type);
                }

                kernel.Bind(type).ToSelf( );
                kernel.Load(( NinjectModule )kernel.Get(type));

                Log.InfoFormat("Loaded module {0}", module.Type);
            }
        }