title: AutoFac.Core.DependencyResolutionException after following tutorial
body: <p>New to Autofac, followed a tutorial on Youtube(with great ratings) but its throwing an exception, no idea why.</p>
  
  <p>Exceptions:</p>
  
  <blockquote>
    <p>DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = IDomainRepository (ReflectionActivator), Services = [Solution.Entities.IDomainRepository], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope</p>
  </blockquote>
  
  <p>And</p>
  
  <blockquote>
    <p>NoConstructorsFoundException: No accessible constructors were found for the type 'Solution.Entities.IDomainRepository'.</p>
  </blockquote>
  
  <p>IDomainRepository</p>
  
  <pre><code>public interface IDomainRepository
  {
      List&lt;Domain&gt; GetAll();
  
      string Insert(Domain obj);
  
      bool Update(Domain obj);
  
      bool Delete(string URL);
  }
  </code></pre>
  
  <p>DomainRepository</p>
  
  <pre><code>public class DomainRepository : IDomainRepository
  {
      public List&lt;Domain&gt; GetAll()
      {
          using (IDbConnection db = new SqlConnection(Helper.ConnectionString))
          {
              if (db.State == ConnectionState.Closed)
              {
                  db.Open();
              }
              return db.Query&lt;Domain&gt;("SELECT * FROM Domains", commandType: CommandType.Text).ToList();
  
          }
      }
  
      public string Insert(Domain obj)
      {
          using (IDbConnection db = new SqlConnection(Helper.ConnectionString))
          {
              if (db.State == ConnectionState.Closed)
              {
                  db.Open();
              }
              db.Query&lt;Domain&gt;("INSERT INTO Domains (Domain) VALUES ("+obj.URL+")", commandType: CommandType.Text);
              return obj.URL;
  
          }
      }
  
      public bool Update(Domain obj)
      {
          using (IDbConnection db = new SqlConnection(Helper.ConnectionString))
          {
              if (db.State == ConnectionState.Closed)
              {
                  db.Open();
              }
              int result = db.Execute("UPDATE Domains SET Domain="+obj.URL+" WHERE Domain="+obj.URL+")", commandType: CommandType.Text);
              return result != 0;
  
          }
      }
  
      public bool Delete(string URL)
      {
          using (IDbConnection db = new SqlConnection(Helper.ConnectionString))
          {
              if (db.State == ConnectionState.Closed)
              {
                  db.Open();
              }
              int result = db.Execute("delete from Domains where Domain = @Url", new { Url = URL }, commandType: CommandType.Text);
              return result != 0;
          }
      }
  }
  </code></pre>
  
  <p>DomainHandler</p>
  
  <pre><code>static Autofac.IContainer _container;
  
      static DomainHandler()
      {
          ContainerBuilder builder = new ContainerBuilder();
          builder.RegisterType&lt;IDomainRepository&gt;().As&lt;IDomainRepository&gt;();
          _container = builder.Build();
      }
  
      public static bool Delete(string Url)
      {
          return _container.Resolve&lt;IDomainRepository&gt;().Delete(Url);
      }
  
      public static List&lt;Domain&gt; GetAll()
      {
          return _container.Resolve&lt;IDomainRepository&gt;().GetAll();
      }
  
      public static Domain Save(Domain obj, EntityState state)
      {
          if (state == EntityState.Added)
              obj.URL = _container.Resolve&lt;IDomainRepository&gt;().Insert(obj);
          else
              _container.Resolve&lt;IDomainRepository&gt;().Update(obj);
  
          return obj;
      }
  </code></pre>
  
  <p>Anyone know what might be causing this error? Read about forgetting to set public access on the interface but thats not the issue here.. :/</p>