title: autofac binding to a repository that inherits a base repo
body: <p>I am trying to configure autofac with my generic repository 
  I am using WebApi 2.2 and trying to create a generic controller and generic repository to do the CRUD operations.</p>
  
  <p>I did ask this question but I think I may have over complicated the question <a href="https://stackoverflow.com/questions/26321195/binding-autofac-with-webapi-using-generic-repository">Binding autofac with webapi using generic repository</a></p>
  
  <p>I have setup my projects with the following configuration</p>
  
  <p>global.asax</p>
  
  <pre><code>    var builder = new ContainerBuilder();
  
      // Register the Web API controllers.
      builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
  
      // Register other dependencies.
      builder.Register(c =&gt; new Logger()).As&lt;ILogger&gt;().InstancePerApiRequest();
  
      builder.RegisterType&lt;SkillRepository&gt;()
          .As&lt;IDomainService&lt;Skill&gt;&gt;()
          .As&lt;ISkill&gt;()
          .InstancePerRequest();
  
      // Build the container.
      var container = builder.Build();
  
      // Create the depenedency resolver.
      var resolver = new AutofacWebApiDependencyResolver(container);
  
      // Configure Web API with the dependency resolver.
      GlobalConfiguration.Configuration.DependencyResolver = resolver;
  </code></pre>
  
  <p>My controller</p>
  
  <pre><code>  public class SkillsController : BaseController&lt;Skill&gt;
      {
          private readonly ISkill _skillRepository;
  
          public SkillsController(SkillRepository skillRepository) : base(skillRepository)
          {
              _skillRepository = skillRepository;
          }
  </code></pre>
  
  <p>The repository</p>
  
  <pre><code>public class SkillRepository : DomainService&lt;Skill&gt;,ISkill
   {
       private DataContext _db = new DataContext();
       //private readonly ILogger _log = null;
  
  
      public SkillRepository(IDomainService&lt;Skill&gt; repository): base(repository)
      {
  
      }
  </code></pre>
  
  <p>interface</p>
  
  <pre><code>public interface ISkill
      {}
  </code></pre>
  
  <p>The domain service</p>
  
  <pre><code>  public class DomainService&lt;T&gt;:IDomainService&lt;T&gt;
      {
          protected readonly IDomainService&lt;T&gt; Repository;
  
          public DomainService(IDomainService&lt;T&gt; repository)
          {
              Repository = repository;
          }
  </code></pre>
  
  <p>The domains interface</p>
  
  <pre><code> public interface IDomainService&lt;T&gt;
      {
          Task&lt;T&gt; Add(T entity);
          Task&lt;bool&gt; Delete(T entity);
          Task&lt;T&gt; Update(T entity);
    }
  </code></pre>
  
  <p>Why when I try call my controller do I get an error</p>
  
  <blockquote>
    <p>"An error occurred when trying to create a controller of type
    'SkillsController'. Make sure that the controller has a parameterless
    public constructor."</p>
  </blockquote>
  
  <p>Is there something stupid I am doing wrong here with my setup?</p>