title: The type '***' is not assignable to service '***' in Autofac
body: <p>I am now doing a dynamic query in my project by using System.Linq.Dynamic. I use Autofac as my default IOC container. But Now I get a problem on registering generic components, here is my code :</p>
  
  <p>the interface:</p>
  
  <pre><code>public interface IDynamicQuery
  {
      IQueryable&lt;T&gt; CreateDynamicQuery&lt;T&gt;(string propertyName, string propertyValue, Expression&lt;Func&lt;T, bool&gt;&gt; where) where T:class;
  }
  </code></pre>
  
  <p>the class:</p>
  
  <pre><code>public class DynamicQuery :IDynamicQuery
  {
      public DynamicQuery(IUnitOfWork unitOfWork)
      {
          this.unitOfWork = unitOfWork;
      }
      private  readonly IUnitOfWork unitOfWork;
  
      public IQueryable&lt;T&gt; CreateDynamicQuery&lt;T&gt;(string propertyName, string propertyValue, Expression&lt;Func&lt;T, bool&gt;&gt; where) where T:class
      {
          var appRepository = unitOfWork.Repository&lt;T&gt;();
  
          IQueryable&lt;T&gt; queryResult = null;
          if (propertyName.Contains('$'))  
              propertyName = propertyName.Replace('$', '.');
          queryResult = appRepository.GetMany(where).Where("" + propertyName + ".Contains(\"" + propertyValue + "\")");
          return queryResult;
      }
  }
  </code></pre>
  
  <p>Then I register them in the application start entry:</p>
  
  <pre><code>builder.RegisterType&lt;IDynamicQuery&gt;().As&lt;DynamicQuery&gt;().InstancePerHttpRequest();
  </code></pre>
  
  <p>But When I start up my project based on MVC 4, it throws me an exception like :</p>
  
  <blockquote>
  <pre><code> The type 'TinyFrame.Framework.Query.IDynamicQuery' is not assignable to service 'TinyFrame.Framework.Query.DynamicQuery'.
  </code></pre>
  </blockquote>
  
  <p>the Exception throws at : <code>var container = builder.Build();</code></p>
  
  <p>I know how to register a generic class in autofac, but I don't know how to register above class I raised, anyone can help me on this? I am a new comer to autofac, thx in advice.</p>