title: The type is not assignable to service autofac
body: <p>I have an interface like this:</p>
  
  <pre><code>public interface ICategoryFacade
  {
      IEnumerable&lt;Category&gt; Get();
      Category Get(int id);
      int Post(Category model);
      int Put(Category model);
      int Patch(Category model);
      int Delete(int id);
  
  } 
  </code></pre>
  
  <p>and I have class:</p>
  
  <pre><code>public class CategoryFacade : ICategoryFacade
  {
      MyContext _dbContext = new MyContext ();
  
      public IEnumerable&lt;Category&gt; Get()
      {
          return _dbContext.Categories;
      }
      public Category Get(int id)
      {
          return _dbContext.Categories.FirstOrDefault(m =&gt; m.CategoryID == id);
      }
      public int Post(Category model)
      {
          return 0;
      }
      public int Put(Category model)
      {
          return 0;
      }
      public int Patch(Category model)
      {
          return 0;
      }
      public int Delete(int id)
      {
          return 0;
      }
  }
  </code></pre>
  
  <p>Now I want to use IOC with my ODATA Controller. So for doing this I am using following line of code in Global.asax file (Application_Start event):</p>
  
  <pre><code>  var builder = new ContainerBuilder();
          builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
  
          builder.RegisterInstance(new CategoryFacade()).As&lt;ICategoryFacade&gt;();
          builder.RegisterInstance(new TVideoFacade()).As&lt;ITVideoFacade&gt;();
  
          builder.RegisterType&lt;CategoryController&gt;();
  
  
          //builder.RegisterType&lt;CategoryFacade&gt;().As&lt;ICategoryFacade&gt;();
          //builder.RegisterType&lt;TVideoFacade&gt;().As&lt;ITVideoFacade&gt;();
  
          //builder.Register(c =&gt; new CategoryFacade()).As&lt;ICategoryFacade&gt;().InstancePerRequest();
          //builder.Register(c =&gt; new TVideoFacade()).As&lt;ITVideoFacade&gt;().InstancePerRequest();
  
          var container = builder.Build();
          var resolver = new AutofacWebApiDependencyResolver(container);
          GlobalConfiguration.Configuration.DependencyResolver = resolver;
  </code></pre>
  
  <p>But it showing following exception:</p>
  
  <pre><code>Additional information: The type 'ABC.ABCDatabase.Facades.TVideoFacade' is not assignable to service 'ABC.ABCDatabase.Abstractions.ICategoryFacade'.
  </code></pre>
  
  <p>Can you guys tell me what is the proper way to use autofac with OData controller. I am newbie for autofac.</p>