title: Ninject: Binding an interface with a generic that is also an interface
body: <p>I have searched this issue but with no luck. Here we go.</p>
  
  <p>Suppose I have an interface:</p>
  
  <pre><code>interface IQueryRepository&lt;T&gt; where T : class
  </code></pre>
  
  <p>and I want to bind any requests for:</p>
  
  <pre><code>IQueryRepository&lt;IClient&gt;
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>ConcreteQueryRepository&lt;Client&gt;
  </code></pre>
  
  <p>I've tried the obvious:</p>
  
  <pre><code>Bind&lt;IGenericQueryRepository&lt;IClient&gt;&gt;().To&lt;ConcreteQueryRepository&lt;Client&gt;&gt;()
  </code></pre>
  
  <p>But I get an error: </p>
  
  <blockquote>
    <p><code>ConcreteQueryRepository&lt;Client&gt;</code> cannot be used as type parameter 'TImplementation' in 
        the generic type or method '<code>Ninject.Syntax.IBindingToSyntax&lt;T&gt;.To&lt;TImplementation&gt;()</code>'
        There is no implicit reference conversion from '<code>ConcreteQueryRepository&lt;Client&gt;</code>'
        to '<code>IGenericQueryRepository&lt;IClient&gt;</code>'</p>
  </blockquote>
  
  <p>But I don't understand why since GenericQueryRepository implements IGenericQueryRepository and Client implements IClient.</p>
  
  <p>I would like Ninject to give me a concrete generic repository where T is Client. I want this to avoid using concrete types in the code.</p>
  
  <p>Can it be done?</p>