title: Stop Autofac module registering already-registered components
body: <p>I have an Autofac module which has the following (trimmed down) logic in the Load override:</p>
  <pre class="lang-cs prettyprint-override"><code>protected override void Load(ContainerBuilder builder)
  {
      foreach (var componentType in allTypesInAllAvailableAssemblies) // Set elsewhere
      {
          var handlerInterfaces = componentType.GetInterfaces().Where(i =&gt; i.IsClosedTypeOf(typeof(IMessageHandler&lt;&gt;)));
          if (handlerInterfaces.Any())                    
              builder.RegisterType(componentType).As(handlerInterfaces);
      }
  }
  </code></pre>
  <p>This is looking for any class that declares itself a message handler and registers it against all the IMessageHandler interfaces it implements.</p>
  <p>What I want to do is <em>not</em> register the component if it's already registered. As a bonus, it would be ideal if I could update the existing registration to resolve against the message handler interface(s) if it isn't already.</p>
  <p>For the sake of argument it can be assumed that this code will run <em>after</em> all other types have been registered (including possible message handler candidates)</p>
  <p>I've used the <code>AttachToComponentRegistration</code> override for registration manipulation in the past but it doesn't look like it's useful in this scenario.</p>
  <p>Is this possible or should I rethink my design and force plugins to explicitly declare their handlers?</p>