title: How to use dynamic connection string for SQL Server CE?
body: <p>I used SQL Server CE 4.0 in my windows app and use Entity Framework to create a model of it.</p>
  
  <p>It works fine but my problems is that it doesn't have a constructor to change the connection string, and by default it reads the connection string from the <code>app.config</code> file.</p>
  
  <pre><code> using (var Context = new MyEntitiesModel(//has no constructor))
   {
          ...
   }
  </code></pre>
  
  <p>I create a dynamic connection string and</p>
  
  <pre><code>  using (var Context = new MyEntitiesModel())
     {
           Context.Database.Connection.ConnectionString = entityConnection.ConnectionString;
     }
  </code></pre>
  
  <p>It works fine by this way but if I remove another connection string in <code>app.config</code> file it gave me this.</p>
  
  <blockquote>
    <p><em>error = invalid metasource ....</em></p>
  </blockquote>
  
  <p>because the default constructor uses it</p>
  
  <p>How can I handle it?</p>