title: Effort unit testing Entity framework 6.1.3 DB-first
body: <p>I am experiencing problems when using Effort framework (version 1.1.4) to unit test my DB-layer.</p>
  
  <p>I have a DB-layer using Entity framework 6.1.3 and the model is created using database-first approach so there is an <code>*.edmx</code> file describing the model.</p>
  
  <p>I have created a partial class to expose an additional constructor used by the unit tests with effort like this:</p>
  
  <pre><code>public partial class Entities
  {
      public Entities(DbConnection connection)
          : base(connection, true)
      {
      }
  }
  </code></pre>
  
  <p>The simple unit-test looks like this:</p>
  
  <pre><code>    private Entities CreateContext()
      {
          //var connectionString = ConfigurationManager.ConnectionStrings["Entities"].ConnectionString;
          //var connection = Effort.EntityConnectionFactory.CreateTransient(connectionString);
          //return new Entities(connection as DbConnection);
  
          var connection = Effort.EntityConnectionFactory.CreatePersistent("name=Entities");
          var context = new Entities(connection);
          return context;
      }
  
      [TestMethod]
      public void Testing_Effort_Integration()
      {
          using (var context = CreateContext())
          {
              var entity = context.TableEntity.FirstOrDefault(i=&gt; i.Id);
              Assert.IsNotNull(entity);
          }
      }
  </code></pre>
  
  <p>When I run the unit test it throws an exception for the line:</p>
  
  <pre><code>var connection  = Effort.EntityConnectionFactory.CreatePersistent("name=Entities");
  </code></pre>
  
  <blockquote>
    <p>{"The provider did not return a ProviderManifest instance."}
    InnerException Message: {"Could not determine storage version; a valid
    storage connection or a version hint is required."}</p>
  </blockquote>
  
  <p>Other posts I have found suggests to change the <code>ProviderManifestToken</code> attribute in the <code>*.edmx</code> file from "2012" to "2008". This seems to solve the problem but instead gives my another exception when trying to use the context for the first time here: </p>
  
  <pre><code>var entity = context.TableEntity.FirstOrDefault(i=&gt; i.Id);
  </code></pre>
  
  <blockquote>
    <p>NotSupportedException Unable to determine the provider name for
    provider factory of type
    'System.Data.EntityClient.EntityProviderFactory'. Make sure that the
    ADO.NET provider is installed or registered in the application config.</p>
  </blockquote>
  
  <p>Anyone know how to solve this issue so I can use Effort with entity framework 6.1.3 DB-first approach?</p>
  
  <p>I have successfully been able to use Effort (version 1.1.4) to unit test DB-layers created in EF 4 and EF 5 with DB-first approach - this is why I think that the EF-version can be of interest...</p>