title: Connection string for using SQL Server Compact with Entity Framework?
body: <p>I'm done trying to Google for this. I have installed SQL Server CE 4.0, and have EF 4.1, but I can't get a proper connection string. Nothing on <code>connectionstrings.com</code> applies to me. </p>
  
  <p>I just want to create a <code>SqlCeEngine</code> object, but no matter what I try I get some exception. Most recently it's been </p>
  
  <blockquote>
    <p>Unknown connection option in connection string</p>
  </blockquote>
  
  <p>with either "metadata", "app", "provider", or "provider connection string" after it. I know EF requires metadata in the connection string. And I can't imagine how anything could do without "provider connection string".</p>
  
  <p>So far I have this:</p>
  
  <pre><code>&lt;add name="DBContext" 
       connectionString="provider connection string=&amp;quot;Data Source=MyDbFile.sdf;Persist Security Info=False;&amp;quot;" 
       providerName="System.Data.EntityClient" /&gt;
  </code></pre>
  
  <p>At one point I had it with metadata:</p>
  
  <pre><code>&lt;add name="DBContext" 
       connectionString="metadata=res://*/Data.DBContext.csdl|res://*/Data.DBContext.ssdl|res://*/Data.DBContext.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;Data Source=MyDbFile.sdf;Persist Security Info=False;&amp;quot;" 
       providerName="System.Data.EntityClient" /&gt;
  </code></pre>
  
  <p>Does it need metadata or not? What goes in the "app" part of the connection string? What should the provider be, <code>System.Data.SqlClient</code> or some SQL Server CE version? (which I still can't find when I try to add references. My add references window still only contains <code>System.Data.SqlServerCe</code> version 3.5.1.0.) Or nothing? </p>
  
  <p>And what should go in the <code>providerName</code> attribute? Is <code>System.Data.EntityClient</code> correct? It's like there are 10 different variables here and every combination gives me a new equally mysterious error, none of which turns up anything useful on Google. I'm at my wits' end. Is this even possible?</p>