title: How to use Microsoft Unity in such case?
body: <p>Suppose I have an IBookRepository interface and implemented by SybaseAsaBookRepository and XMLBookRepository. </p>
  
  <p>SybaseAsaBookRepository constructor requiers 2 parameters, database user id and password, both values could be retrieved by an IBookAppConfiguration instance.
  XMLBookRepository constructor needs no parameter.</p>
  
  <p>Apparently IBookAppConfiguration can be easily configured for Microsoft Unity to resole, let's even assume it's a Singleton.</p>
  
  <p>Now, how could I configure the Microsoft Unity, to resolve IBookRepository interface to SybaseAsaBookRepository, with the required 2 constructor parameters properly served?</p>
  
  <p>Sample codes are below:</p>
  
  <pre><code>public interface IBookRepository
  {
      /// &lt;summary&gt;
      /// Open data source from Sybase ASA .db file, or an .XML file
      /// &lt;/summary&gt;
      /// &lt;param name="fileName"&gt;Full path of Sybase ASA .db file or .xml file&lt;/param&gt;
      void OpenDataSource(string fileName);
  
      string[] GetAllBookNames(); // just return all book names in an array
  }
  
  public interface IBookAppConfiguration
  {
      string GetUserID();   // assuming these values can only be determined 
      string GetPassword(); // during runtime
  }
  
  public class SybaseAsaBookRepository : IBookRepository
  {
      public DatabaseAccess(string userID, string userPassword)
      {
          //...
      }
  }
  
  &lt;register type="IBookAppConfiguration" mapTo="BookAppConfigurationImplementation"&gt;
      &lt;lifetime type="singleton"/&gt;
  &lt;/register&gt;
  
  &lt;register name="SybaseAsa" type="IBookRepository" mapTo="SybaseAsaBookRepository"&gt; 
      &lt;constructor&gt; 
          &lt;param name="userID" value="??? what shall i put it here???"/&gt; 
          &lt;param name="userPassword" value="??? what shall i put it here???"/&gt; 
      &lt;/constructor&gt; 
  &lt;/register&gt;
  </code></pre>