title: Enterprise Library Migration - You must configure the container to supply this value
body: <p>I don't know who else to ask for help.</p>
  
  <p>Here in my company we are migrating the system. 2.0 to 3.5 net</p>
  
  <p>We use enterprise library 3.1 and we are migrating to 5.0</p>
  
  <p>I used the tool for configuration file</p>
  
  <p>The compilation was ok but when I run, i receive this message:</p>
  
  <p><strong>Activation error occured while trying to get instance of type Database, key "MrvFramework"</strong></p>
  
  <p><strong>Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Data.Database", name = "MrvFramework".
  Exception occurred while: while resolving.</strong></p>
  
  <p><strong>Exception is: InvalidOperationException - The type Database cannot be constructed. You must configure the container to supply this value.</strong></p>
  
  <p><strong>At the time of the exception, the container was:
    Resolving Microsoft.Practices.EnterpriseLibrary.Data.Database</strong></p>
  
  <p>I spent a lot of time on internet:</p>
  
  <p>I had made this tests:</p>
  
  <ul>
  <li>All DLL required by enterprise library are referenced in the project</li>
  <li><code>var database = DatabaseFactory.CreateDatabase(MrvFramework)</code></li>
  <li><code>var database = EnterpriseLibraryContainer.Current.GetInstance&lt;Database&gt;(MrvFramework)</code></li>
  <li><code>var database = new SqlDatabase(MrvFramework)</code></li>
  </ul>
  
  <p>This is my app.config (snippet-code)</p>
  
  <pre><code>&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="true" /&gt;
  
  &lt;dataConfiguration defaultDatabase="MRVFramework"/&gt;
  &lt;connectionStrings&gt;
     &lt;add name="MRVFramework" connectionString="Data Source=H:\MRV\Projetos\MRV Framework\Branch\Update SqlServerCe\MRV.Framework.Seguranca.Console\MRVFramework.sdf;Persist Security Info=True" providerName="System.Data.SqlClient"/&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>This is my machine.config file</p>
  
  <pre><code>&lt;DbProviderFactories&gt;
    &lt;add name="Odbc Data Provider" invariant="System.Data.Odbc" description=".Net Framework Data Provider for Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
    &lt;add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
    &lt;add name="OracleClient Data Provider" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle" type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
    &lt;add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
    &lt;add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /&gt;
  &lt;/DbProviderFactories&gt;
  </code></pre>