title: StructureMap - Get constructor dependencies via name
body: <p>How can I get constructor dependencies via name when the class itself is does not need to get the concrete implementation via the name.</p>
  
  <pre><code>public class PriceValidator : IPriceValidator
  {
      private readonly IEnumerable&lt;IPriceValidationRule&gt; _priceValidationRules;
  
      public PriceValidator(IEnumerable&lt;IPriceValidationRule&gt; priceValidationRules)
      {
          _priceValidationRules = priceValidationRules;
      }
  
      public bool IsPriceValid(decimal price)
      {
          return _priceValidationRules.All(priceValidator =&gt; priceValidator.IsPriceValid(price));
      }
  }
  </code></pre>
  
  <p>Call:</p>
  
  <pre><code>_priceValidator = ObjectFactory.GetInstance&lt;IPriceValidator&gt;();
  </code></pre>
  
  <p>So I want a concrete implementation of IPriceValidator but with specific (by name) Validation Rules.</p>
  
  <p>Edit:</p>
  
  <p>My rules:</p>
  
  <pre><code>For&lt;IPriceValidationRule&gt;().Use&lt;MaxPriceValidationRule&gt;().Named("A");
  For&lt;IPriceValidationRule&gt;().Use&lt;MinPriceValidationRule&gt;().Named("A");
  For&lt;IPriceValidationRule&gt;().Use&lt;MyDoublePriceValidationRule&gt;().Named("B");
  For&lt;IPriceValidationRule&gt;().Use&lt;MyPriceValidationRule&gt;().Named("B");
  </code></pre>
  
  <p>How could I use the same rule with different names? So when I say give me all instances named "X" I want to get MaxPriceValidationRule? </p>