title: Get connection string from App.config
body: <pre><code>var connection = ConnectionFactory.GetConnection(
      ConfigurationManager.ConnectionStrings["Test"]
      .ConnectionString, DataBaseProvider);
  </code></pre>
  
  <p>And this is my App.config: </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
      &lt;connectionStrings&gt;
          &lt;add name="Test" connectionString="Data Source=.;Initial Catalog=OmidPayamak;Integrated Security=True" providerName="System.Data.SqlClient" /&gt;
      &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>But when my project runs this is my error:</p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object.</p>
  </blockquote>