title: Ninject - Xml Configuration module
body: <p>I have an interface that implements in multiple classes. These classes handle their very specific tasks that are intended to. So I'm trying to get the instance of the class I want through ninject. Those binding needs to be set up in the XML file and load whatever the class instance I need.</p>
  
  <p><strong>Binding XML</strong><br></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;module name="Downloader"&gt;
    &lt;bind service="Microsoft.Azure.Management.DataFactories.Runtime.IDotNetActivity, Microsoft.Azure.Management.DataFactories" 
          to="TV.ABC.InvoiceDownloader, TV.ABC" /&gt;
    &lt;bind service="Microsoft.Azure.Management.DataFactories.Runtime.IDotNetActivity, Microsoft.Azure.Management.DataFactories"
          to="TV.ABC.PaymentsDownloader, TV.ABC" /&gt;
  &lt;/module&gt;
  </code></pre>
  
  <p><strong>Code</strong><br></p>
  
  <pre><code>public class Program
      {
          static void Main(string[] args)
          {
              var settings = new NinjectSettings { LoadExtensions = false };
              var kernel = new StandardKernel(settings, new XmlExtensionModule());
              string executionPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
              XDocument xDoc = XDocument.Load(string.Format(@"{0}\NinjectModules.xml", executionPath));
  
              IEnumerable&lt;INinjectModule&gt; modules = GetModules(kernel, xDoc);
              kernel.Load(modules);
  
              var objtest = kernel.Get&lt;IDotNetActivity&gt;();
          }
  
          private static IEnumerable&lt;INinjectModule&gt; GetModules(IKernel kernel, XDocument document)
          {
              var elementProcessors = kernel.Components.GetAll&lt;IModuleChildXmlElementProcessor&gt;()
                                            .ToDictionary(processor =&gt; processor.XmlNodeName);
  
              return (from moduleElement in document.Elements("module")
                      select new XmlModule(moduleElement, elementProcessors)).Cast&lt;INinjectModule&gt;();
          }
      }
  </code></pre>
  
  <p>I expect to load all the modules defined in the XML file.</p>
  
  <p><strong><em>The output is as follows, throws an error</em></strong><br>
  Ninject.ActivationException: 'Error activating IDotNetActivity
  More than one matching bindings are available.<br>
  Matching bindings:<br>
    1) binding from IDotNetActivity to CustomerInvoiceDownloaderActivity<br>
    2) binding from IDotNetActivity to CustomerPaymentsDownloaderActivity<br><br>
  Activation path:<br>
    1) Request for IDotNetActivity<br><br></p>
  
  <p>Suggestions:<br>
    1) Ensure that you have defined a binding for IDotNetActivity only once.
  '
  <br><br><strong><em>Can someone helps me why this issue is coming up?</em></strong></p>