title: Using Ninject, can I create an instance from an interface without exposing my concrete class?
body: <p>The samples I've seen so far look like this:</p>
  
  <p>Write your code like this...</p>
  
  <pre><code>public class Samurai {
    public IWeapon Weapon { get; private set; }
    public Samurai(IWeapon weapon) {
      Weapon = weapon;
    }
  }
  </code></pre>
  
  <p>And Ninject can map the interface to the concrete type like this...</p>
  
  <pre><code>public class WarriorModule : NinjectModule {
    public override void Load() {
      Bind&lt;IWeapon&gt;().To&lt;Sword&gt;();
    }
  }
  </code></pre>
  
  <p>So when I say <code>var samurai = kernel.Get&lt;Samurai&gt;();</code> in my Samurai object my IWeapon is automatically a Sword.</p>
  
  <p>That's cool, but what if I want just the ISword without the Samurai and the concrete sword is marked as internal?</p>
  
  <p>Currently, I use a home made dependency resolver where I could say <code>var sword = DependencyResolver.Current.Resolve&lt;ISword&gt;();</code> and it gives me back a Sword cast as ISword. My concrete classes are marked as internal so the developer <em>must</em> go through my dependency resolver to create an instance. Does Ninject have anything similar to this?</p>
  
  <p>And a bonus question, I decorate my Interfaces with a custom "DefaultConcreteType" attribute which my dependency resolver can use if no mapping exists. Does Ninject have anything like that either?</p>
  
  <p>Thanks</p>