title: Is there a .NET method to grab the data source for an entity framework connection string?
body: <p>I want to grab the data source from my connection string.  I know I can use </p>
  
  <pre><code>ConfigurationManager.ConnectionStrings["name"].ConnectionString
  </code></pre>
  
  <p>and extract it out with regex.  But, it seems there should be an easy way to grab this data source.  I don't want to grab from character position because that would be fragile to any changes in the ordering of the string.</p>
  
  <p><strong>UPDATE</strong><br />
  I am using entity framework 4.  The connection string is generated and begins with </p>
  
  <pre><code>metadata=res://*/
  </code></pre>
  
  <p>This appears to complicate things as the suggested object <code>SqlConnectionStringBuilder</code> throws error </p>
  
  <blockquote>
    <p>"Keyword not supported: 'metadata'."</p>
  </blockquote>