title: How to properly use Ninject's NamedScope extension?
body: <p>I have a pattern that comes up all the time when I'm working. I am almost exclusively a web developer, and Ninject's InRequestScope handles 99% of my needs.</p>
  
  <p>Here's the pattern:</p>
  
  <pre><code>// abstractions
  
  interface IFoo {
      void FooMe();
      int GetSomeValue();
  }
  
  interface IBar {
      void BarMe();
  }
  
  interface IFooBar {
      void FooAndBar();
  }
  
  // concrete classes
  
  class Foo : IFoo {
      public void FooMe() { Console.WriteLine("I have fooed"); }
      public void GetSomeValue() { return 123; }
  }
  
  class Bar : IBar {
      private readonly IFoo _Foo;
  
      public Bar(IFoo foo) { _Foo = foo; }
  
      public void BarMe() { Console.WriteLine("Bar: {0}", _Foo.GetSomeValue()); }
  }
  
  class FooBar : IFooBar {
      private readonly IFoo _Foo;
      private readonly IBar _Bar;
  
      public Bar(IFoo foo, IBar bar) { _Foo = foo; _Bar = bar; }
      public void FooAndBar() {
          _Foo.FooMe();
          _Bar.BarMe();
      }
  }
  
  // bindings
  kernel.Bind&lt;IFoo&gt;().To&lt;Foo&gt;();
  kernel.Bind&lt;IBar&gt;().To&lt;Bar&gt;();
  kernel.Bind&lt;IFooBar&gt;().To&lt;FooBar&gt;();
  </code></pre>
  
  <p>What I want to do is set it up such that every time I <code>kernel.Get&lt;IFooBar&gt;</code> it creates <strong>exactly one</strong> Foo and injects it into the constructors of both Bar and FooBar.</p>
  
  <p>I've experimented with this off and on using the Named Scope extension, but I've never been able to get it to work.</p>
  
  <p>What is the proper binding syntax for this?</p>