title: Unable to inject object using Autofac
body: <p>I am new to IoC and Autofac. I have created a simple console project to test the technique. When I ran the application I am getting this error: The requested service 'AutoFac.BLL.IEmployeeDetail' has not been registered. The following is my code. This line is throwing the error: build.Register(y => new Employee(y.Resolve()));</p>
  
  <pre><code>public class Employee
  {
      IEmployeeDetail _employeeDetail;
  
      public Employee(IEmployeeDetail employeeDetail)
      {
          _employeeDetail = employeeDetail;
      }
  
      public string GetName()
      {
          return _employeeDetail.Name();
      }
  }
  
  public class EmployeeDetail : IEmployeeDetail
  {
      public string Name()
      {
          return "John Doe";
      }
  }
  
  public interface IEmployeeDetail
  {
      string Name();
  }
  
  public class Program
  {
      static void Main(string[] args)
      {
          var build = new ContainerBuilder();
          build.Register(y =&gt; new Employee(y.Resolve&lt;IEmployeeDetail&gt;()));
          var container = build.Build();
          Employee employee = container.Resolve&lt;Employee&gt;();
  
          Console.WriteLine(employee.GetName());
          Console.ReadLine();
      }
  }
  </code></pre>