当前位置: 首页>>代码示例>>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;未经允许,请勿转载。