示例#1
0
 //Used in a child injector situation to configure a binder with a module at runtime
 internal void configureBinder(GuiceModule module)
 {
     if (module != null)
     {
         module.configure(binder);
     }
 }
        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;
        }
示例#3
0
        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);
        }
 //Used in a child injector situation to configure a binder with a module at runtime
 internal void configureBinder(GuiceModule module)
 {
     if (module != null) {
         module.configure(binder);
     }
 }
 //This is a little evil and I am not sure I like it, but it is the best way we can provide bindings to a child injector for now.
 public void configureInjector(ChildInjector injector, GuiceModule module)
 {
     injector.configureBinder( module );
 }
示例#6
0
 //This is a little evil and I am not sure I like it, but it is the best way we can provide bindings to a child injector for now.
 public void configureInjector(ChildInjector injector, GuiceModule module)
 {
     injector.configureBinder(module);
 }