title: Register type conditionally in Autofac
body: <p>I have parent class Animal and two child classes Dog and cat. I am using Autofac for dependency injection.  I want to register Dog and Cat based on condition that is specified in config file.</p>
  
  <p>I want following code in my module class.</p>
  
  <p><code>If Dog mentioned in Config file then
  builder.RegisterType&lt;Dog&gt;().As&lt;Animal&gt;().PropertiesAutowired().SingleInstance();
  If cat mentioned in Config file then
  builder.RegisterType&lt;Cat&gt;().As&lt;Animal&gt;().PropertiesAutowired().SingleInstance();</code></p>
  
  <p>Please suggest for same.</p>