title: Configuration reading, should it be confined to client code?
body: <p>I'm just writing some data access code. I've decided to pass in the name of connection string from the config via constructor injection which the repository then reads and uses to construct a SqlConnectionStringBuilder.</p>
  
  <p>Thinking about it I probably don't need the SqlConnectionStringBuilder but that's a different matter. </p>
  
  <p>Should I be reading the configuration here or should that be confined to client code? Opinions?</p>
  
  <pre><code>public class SqlRepository : IRepository
  {
      private SqlConnectionStringBuilder _connString;
  
      public SqlRepository(string connectionStringName)
      {
          var connStringSetting = ConfigurationManager.ConnectionStrings[connectionStringName];
  
          if (connStringSetting == null)
              throw new ArgumentException("Could not find connection string in configuration.");
  
          _connString = new SqlConnectionStringBuilder(connStringSetting.ConnectionString);
      }
  
  } 
  </code></pre>