本文整理汇总了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;
}
示例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 });
}
示例3: LoadKernel
private static IKernel LoadKernel()
{
var kernel = new StandardKernel();
kernel.Load<HEWFitnessWebModule>();
kernel.Load<HEWFitnessAutomationFrameworkModule>();
return kernel;
}
示例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;
}
示例5: CreateKernel
protected override Ninject.IKernel CreateKernel()
{
var kernel = new StandardKernel();
kernel.Load(Assembly.GetExecutingAssembly());
kernel.Load(new List<String>() { "Tartan.Services.*" });
return kernel;
}
示例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())
);
}
示例7: ConstructorCreatedCorrectly
public void ConstructorCreatedCorrectly()
{
var kernel = new StandardKernel();
kernel.Load(new ThingsToDoCityModule());
kernel.Load(new AppModule());
var controller = kernel.Get<EventController>();
}
示例8: Initialize
public static IKernel Initialize(params NinjectModule[] modules)
{
var kernel = new StandardKernel();
kernel.Load(new FoundationModule());
kernel.Load(modules);
return kernel;
}
示例9: CreateKernel
public static IKernel CreateKernel()
{
var kernel = new StandardKernel();
kernel.Load(Assembly.GetExecutingAssembly());
kernel.Load(new NinjectServiceModule());
kernel.Load(new NinjectDataModule());
return kernel;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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;
}
示例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));
}