title: Configuring Enterprise Library 5.0 Data Access Application Block
body: <p>I'm trying to figure out how to configure the enterprise library 5.0 Data Access Application Block.
  When running my unittest, I get the following error:</p>
  
  <pre><code>Microsoft.Practices.ServiceLocation.ActivationException was caught
    Message=Activation error occured while trying to get instance of type Database, key "PokerAdviserProvider"
    InnerException: Microsoft.Practices.Unity.ResolutionFailedException
         Message=Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Data.Database", name = "PokerAdviserProvider".
  Exception occurred while: while resolving.
  Exception is: InvalidOperationException - The type Database cannot be constructed. You must configure the container to supply this value.
  </code></pre>
  
  <p>The line of code where I get this: </p>
  
  <pre><code>var db = DatabaseFactory.CreateDatabase("PokerAdviserProvider");
  </code></pre>
  
  <p>App.config:</p>
  
  <pre><code>&lt;configuration&gt;
      &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="PokerAdviserProvider" /&gt;
      &lt;connectionStrings&gt;
          &lt;add name="PokerAdviserProvider" connectionString="server=(localhost);Initial Catalog=PokerAdviser;uid=abc;pwd=xyz"
              providerName="System.Data.SqlClient" /&gt;
      &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I've been googling around a bit and found some answers that these settings should also be put in the app.Config of my unittest-project, but that didn't make a difference.</p>
  
  <p>I'm a bit stuck here, so any help is highly appreciated.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I referenced the correct dll's (the ones from Program Files, not from the source code), so that isn't the problemneither.</p>