title: How to integrate SQL Server CE with Enterprise Library 5 DatabaseFactory?
body: <p>I'm getting an </p>
  
  <blockquote>
    <p>"Activation error occured while trying to get instance of type
    Database, key "" "</p>
  </blockquote>
  
  <p>exception with my <code>DatabaseFactory.CreateDatabase()</code> whenever I reference the default database to a SQL Server CE</p>
  
  <p>I tried checking if the problem is just my .dll reference, which I was able to prove wrong because I was still able to connect to a real SQL Server 2008 db.</p>
  
  <p>Here's my config:</p>
  
  <pre><code>&lt;configSections&gt;
  &lt;section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/&gt;
      &lt;/configSections&gt;
  &lt;dataConfiguration defaultDatabase="sqlCEDB"/&gt;
      &lt;connectionStrings&gt;
          &lt;add name="sqlCEDB"
             connectionString="Data Source=|DataDirectory|\sqlCEDB.sdf;Password='somepassword'"
             providerName="Microsoft.SqlServerCe.Client.3.5" /&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>Here's how I create the database instance:</p>
  
  <pre><code>private Database db;
  
  protected internal Database DB
  {
     get 
     {
        if (db == null)
           db = DatabaseFactory.CreateDatabase();
        return db; 
     }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>change config property
  solved: providerName="System.Data.SqlServerCe.3.5"</p>