title: How to use Application Data in an (App.config) connectionString
body: <p>I've got an SQL Server CE database in a project that I wan't to store somewhere in the %AppData% directory. However I can't find a way to make a reference to the Application Data path in the connection string (in the App.Config)</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
    &lt;/configSections&gt;
    &lt;connectionStrings&gt;
      &lt;add name="EntityConnectionString" connectionString="metadata=res://*/EntityModel.csdl|res://*/EntityModel.ssdl|res://*/EntityModel.msl;provider=System.Data.SqlServerCe.3.5;provider connection string=&amp;quot;Data Source=|ApplicationData|\Entities.sdf&amp;quot;" providerName="System.Data.EntityClient"/&gt;
    &lt;/connectionStrings&gt;
  &lt;startup&gt;&lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;&lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>So far I learned that: %APPDATA% is not supported and using the settings class (like suggested) won't work either (the settings class isn't constructed at the time the exception is already thrown).</p>
  
  <p>Is it possible to use the application data folder (or another special folder) in the connectionString property (in the App.Config)?</p>
  
  <p>Note: it seems like I'm searching for an solution to modify the connection string (in code) as early as possible rather than an native App.Config solution.</p>