當前位置: 首頁>>代碼示例>>C#>>正文


C# StandardKernel.Load方法代碼示例

本文整理匯總了C#中Ninject.StandardKernel.Load方法的典型用法代碼示例。如果您正苦於以下問題:C# StandardKernel.Load方法的具體用法?C# StandardKernel.Load怎麽用?C# StandardKernel.Load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Ninject.StandardKernel的用法示例。


在下文中一共展示了StandardKernel.Load方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Configure

        /// <summary>
        /// Configures the DI container
        /// </summary>
        /// <returns>configured kernel</returns>
        static IKernel Configure()
        {
            var kernel = new StandardKernel();

			//TODO: Move this to a module
			kernel.Bind<IClock> ().To<LinuxSystemClock> ().InSingletonScope ();

            //infrastructure modules
			kernel.Load(new List<NinjectModule>()
            {
				new LoggingModule(new List<string>(){"Log.config"})
            });

			var logger = kernel.Get<ILogger> ();

			logger.Info ("Loading Plugins...");
			//plugins
			kernel.Load (new string[] { "*.Plugin.dll" });

			logger.Info ("Loading Core...");
			//core services/controllers
            kernel.Bind<IRaceController>().To<RaceController>()
                .InSingletonScope()
                .WithConstructorArgument("autoRoundMarkDistanceMeters", AppConfig.AutoRoundMarkDistanceMeters);
			kernel.Bind<Supervisor>().ToSelf()
                .InSingletonScope()
                .WithConstructorArgument("cycleTime", AppConfig.TargetCycleTime);
                
            return kernel;
        }
開發者ID:brookpatten,項目名稱:MrGibbs,代碼行數:34,代碼來源:Program.cs

示例2: Initialize

 public static void Initialize()
 {
     var kernel = new StandardKernel(new RegistrationModule());
     kernel.Load("DD4T.ContentModel.Contracts");
     kernel.Load("DD4T.Factories");
     kernel.Load("DD4T.Providers.Test");
     kernel.Load("DD4T.ViewModels");
     PageFactory = kernel.Get<IPageFactory>();
     ComponentPresentationFactory = kernel.Get<IComponentPresentationFactory>();
     ComponentFactory = kernel.Get<IComponentFactory>();
     PageFactory.CacheAgent = kernel.Get<ICacheAgent>();
     PageFactory.PageProvider = kernel.Get<IPageProvider>();
     ComponentPresentationFactory.CacheAgent = kernel.Get<ICacheAgent>();
     ComponentPresentationFactory.ComponentPresentationProvider = kernel.Get<IComponentPresentationProvider>();
     ((ComponentFactory)ComponentFactory).ComponentPresentationFactory = ComponentPresentationFactory;
     ((TridionPageProvider)PageFactory.PageProvider).SerializerService = kernel.Get<ISerializerService>();
     ((TridionComponentPresentationProvider)ComponentPresentationFactory.ComponentPresentationProvider).SerializerService = kernel.Get<ISerializerService>();
     ((TridionPageProvider)PageFactory.PageProvider).ComponentPresentationProvider = ComponentPresentationFactory.ComponentPresentationProvider;
     kernel.Bind<IViewModelKeyProvider>().To <WebConfigViewModelKeyProvider>();
     kernel.Bind<IViewModelResolver>().To<DefaultViewModelResolver>();
     kernel.Bind<IViewModelFactory>().To<ViewModelFactory>();
     kernel.Bind<IReflectionHelper>().To<ReflectionOptimizer>();
     ViewModelFactory = kernel.Get<IViewModelFactory>();
     ViewModelFactory.LoadViewModels(new [] { typeof(TestViewModelA).Assembly });
 }
開發者ID:contacttomukesh,項目名稱:DD4T.Core,代碼行數:25,代碼來源:BaseFactoryTest.cs

示例3: LoadKernel

 private static IKernel LoadKernel()
 {
     var kernel = new StandardKernel();
     kernel.Load<HEWFitnessWebModule>();
     kernel.Load<HEWFitnessAutomationFrameworkModule>();
     return kernel;
 }
開發者ID:JWroe,項目名稱:HEWFitness,代碼行數:7,代碼來源:AutomationTestBase.cs

示例4: CreateKernel

 /// <summary>
 /// Creates the kernel that will manage your application.
 /// </summary>
 /// <returns>
 /// The created kernel.
 /// </returns>
 protected override IKernel CreateKernel()
 {
     var kernel = new StandardKernel();
     kernel.Load(new CoreModule());
     kernel.Load(new DataModule());
     return kernel;
 }
開發者ID:Ireney,項目名稱:Formula-1-Picker-Game,代碼行數:13,代碼來源:Global.asax.cs

示例5: CreateKernel

 protected override Ninject.IKernel CreateKernel()
 {
     var kernel = new StandardKernel();
     kernel.Load(Assembly.GetExecutingAssembly());
     kernel.Load(new List<String>() { "Tartan.Services.*" });
     return kernel;
 }
開發者ID:freemsly,項目名稱:mongo-tartan-cms,代碼行數:7,代碼來源:Global.asax.cs

示例6: Working

        public Working()
        {
            // 1 create the kernel
            var kernel = new StandardKernel();

            kernel.Bind<ICreditCard>().To<Visa>();
            kernel.Bind<ICreditCard>().To<MasterCard>().InSingletonScope();
            kernel.Bind<Shopper>().ToSelf().InSingletonScope();

            // 5 modules
            kernel.Load(new WorkingModule());

            // 6 xml config
            kernel.Load(Helpers.AssemblyDirectory + "\\*.xml");

            // 7 conventions
            kernel.Bind(x => x
                              .FromAssembliesInPath(Helpers.AssemblyDirectory)
                              .SelectAllClasses()
                              .InheritedFrom<ICreditCard>()
                              .BindDefaultInterfaces()
                              .Configure(b => b.InSingletonScope()
                                               .WithConstructorArgument("name", "BackupCard"))
                              //.ConfigureFor<Shopper>(b => b.InThreadScope())
                        );
        }
開發者ID:stesta,項目名稱:Talk-DependencyInjection,代碼行數:26,代碼來源:Working.cs

示例7: ConstructorCreatedCorrectly

        public void ConstructorCreatedCorrectly()
        {
            var kernel = new StandardKernel();
            kernel.Load(new ThingsToDoCityModule());
            kernel.Load(new AppModule());

            var controller = kernel.Get<EventController>();
        }
開發者ID:akoesnan,項目名稱:PraLoup,代碼行數:8,代碼來源:EventControllerTest.cs

示例8: Initialize

        public static IKernel Initialize(params NinjectModule[] modules)
        {
            var kernel = new StandardKernel();
            kernel.Load(new FoundationModule());
            kernel.Load(modules);

            return kernel;
        }
開發者ID:StefanAniff,項目名稱:NServiceBusCQRS,代碼行數:8,代碼來源:NinjectConfiguration.cs

示例9: CreateKernel

        public static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            kernel.Load(Assembly.GetExecutingAssembly());

            kernel.Load(new NinjectServiceModule());
            kernel.Load(new NinjectDataModule());

            return kernel;
        }
開發者ID:Philyorkshire,項目名稱:AnswerSpaTest,代碼行數:10,代碼來源:Startup.cs

示例10: Main

 public static void Main(string[] args)
 {
     var kernel = new StandardKernel();
     kernel.Load<TychaiaGlobalIoCModule>();
     kernel.Load<TychaiaProceduralGenerationIoCModule>();
     kernel.Load<TychaiaToolIoCModule>();
     ConsoleCommandDispatcher.DispatchCommand(
         kernel.GetAll<ConsoleCommand>(),
         args,
         Console.Out);
 }
開發者ID:TreeSeed,項目名稱:Tychaia,代碼行數:11,代碼來源:Program.cs

示例11: CreateRuntimeLayer

 protected RuntimeLayer CreateRuntimeLayer(IAlgorithm algorithm)
 {
     var kernel = new StandardKernel();
     kernel.Load<TychaiaGlobalIoCModule>();
     kernel.Load<TychaiaProceduralGenerationIoCModule>();
     kernel.Load<Protogame3DIoCModule>();
     kernel.Load<ProtogameAssetIoCModule>();
     kernel.Bind<IAssetContentManager>().To<NullAssetContentManager>();
     kernel.Bind<IAssetManagerProvider>().To<LocalAssetManagerProvider>();
     return kernel.Get<IRuntimeLayerFactory>().CreateRuntimeLayer(algorithm);
 }
開發者ID:TreeSeed,項目名稱:Tychaia,代碼行數:11,代碼來源:TestBase.cs

示例12: TestInitialize

		public void TestInitialize()
		{
			var kernel = new StandardKernel();
			kernel.Load<StorageModule>();
			kernel.Load<LogicModule>();

			SecurityContext = Substitute.For<ISecurityContext>();
			SecurityContext.CurrentUser.Returns(new User { Id = 1 });

			Target = new PayPalCreditCardService(kernel.Get<IConfigurationHelper>(), SecurityContext);
		}
開發者ID:evkap,項目名稱:DVS,代碼行數:11,代碼來源:PayPalCreditCardServiceTest.cs

示例13: Main

        public static void Main(string[] args)
        {
            var kernel = new StandardKernel();
            kernel.Load<Protogame2DIoCModule>();
            kernel.Load<ProtogameAssetIoCModule>();
            AssetManagerClient.AcceptArgumentsAndSetup<GameAssetManagerProvider>(kernel, args);

            using (var game = new {PROJECT_SAFE_NAME}Game(kernel))
            {
                game.Run();
            }
        }
開發者ID:jbeshir,項目名稱:Protobuild,代碼行數:12,代碼來源:Program.cs

示例14: CreateKernel

        protected override IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            NinjectModule[] modules = new NinjectModule[]
            {
                new WebModule()
            };

            kernel.Load(Assembly.GetExecutingAssembly());
            kernel.Load(modules);
            return kernel;
        }
開發者ID:AnatoliMalev,項目名稱:mesoBoard,代碼行數:12,代碼來源:Global.asax.cs

示例15: IsNotOnGroundWhenJustAboveTheGround

 public void IsNotOnGroundWhenJustAboveTheGround()
 {
     var kernel = new StandardKernel();
     kernel.Load<Protogame2DIoCModule>();
     kernel.Load<ProtogamePlatformingIoCModule>();
     var platforming = kernel.Get<IPlatforming>();
     var player = this.CreateBoundingBox(200, 200 - 17, 16, 16);
     var ground = this.CreateBoundingBox(0, 200, 400, 16);
     Assert.False(platforming.IsOnGround(
         player,
         new[] { player, ground },
         x => true));
 }
開發者ID:johnsonc,項目名稱:Protogame,代碼行數:13,代碼來源:PlatformingModuleTests.cs


注:本文中的Ninject.StandardKernel.Load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。