本文整理汇总了C#中Binder.bind方法的典型用法代码示例。如果您正苦于以下问题:C# Binder.bind方法的具体用法?C# Binder.bind怎么用?C# Binder.bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Binder
的用法示例。
在下文中一共展示了Binder.bind方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: configure
public override void configure(Binder binder)
{
binder.bind(typeof(AbstractTranslator)).to(typeof(StaticTranslator));
//Everyone in this context gets this same DemoEventBus
binder.bind(typeof(AbstractEventBus)).to(typeof(DemoEventBus));
binder.bind(typeof(DemoEventBus)).inScope(Scope.Context).to(typeof(DemoEventBus));
}
示例2: configure
public override void configure(Binder binder)
{
//make the StyleExtensionMap a Singleton
binder.bind(typeof(StyleExtensionMap)).inScope(Scope.Singleton).to(typeof(StyleExtensionMap));
//Setup a NoOp translator as the default
binder.bind(typeof(AbstractTranslator)).to(typeof(NoOpTranslator));
}
示例3: ChildInjector
public ChildInjector(Binder binder, ClassResolver classResolver, Injector parentInjector)
: base(binder, classResolver)
{
this.parentInjector = parentInjector;
//Child injectors set themselves up as the new default Injector for the tree below them
binder.bind(typeof(Injector)).toInstance(this);
}
示例4: createInjector
public Injector createInjector(GuiceModule module)
{
var hashMap = new BindingHashMap();
var binder = new Binder( hashMap );
var loader = new SynchronousClassLoader(new XMLHttpRequest(), "generated/");
var classResolver = new ClassResolver( loader );
if (module != null) {
module.configure(binder);
}
var injector = new Injector(binder, classResolver);
binder.bind(typeof(Injector)).toInstance(injector);
binder.bind(typeof(ClassResolver)).toInstance(classResolver);
binder.bind(typeof(SynchronousClassLoader)).toInstance(loader);
return injector;
}