How do I get Effort to work with EntityFramework?

c# effort entity-framework


When using Fitnesse with EF6, Effort won't launch. Every trick I could find has been tried by me.
Every single article advises either calling "RegisterProvider" or adding a configuration section. Both are ineffective.

So far:
In the DbProviderFactories section of machine.config, I have "Effort.Provider." When I look at DbProviderFactories, Effort.Provider appears. GetFactoryClasses(); ProcMon indicates that Effort is being sought after and located. dll.

Any of

DbProviderFactory dataFactory = DbProviderFactories.GetFactory(dt.Rows[5]);   


Effort.Exceptions.EffortException: The Effort library failed to register

Added effort
Runner.exe.config's entityFramework section with "Effort.Provider," however I was unable to make that work. Just the app crashed.
EF and Effort removal. EF6 is being reinstalled. No discernible impact.
Effort is called. Provider. EffortProviderConfiguration. From a class constructor and numerous startup sites, use RegisterProvider(). Effort. In DbProviderFactories, the provider was never visible. GetFactoryClasses();
When "Effort.Provider" is specified in the DbProviderFactories section of the app.config file, it appears in GetFactoryClasses and machine.config equally.

OS Windows 10
.Net 4.6
VS 2016
EF 6.1.2 (although it says 6.1.3 is installed, not sure what that means)

Do I require a DLL registration or something else? There is nothing about that in the instructions.

More information

        <loadFromRemoteSources enabled="true"/>
            <add name="Effort.Provider" invariant="Effort.Provider" description="Effort.Provider" type="Effort.Provider.EffortProviderFactory, Effort" />
5/2/2016 3:15:54 PM

Accepted Answer

It appears that the "entityFramework" configuration section needs to be registered in the app.config file.

   <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      <provider invariantName="Effort.Provider" type="Effort.Provider.EffortProviderServices,Effort" />

Create the Effort connection next, and send it to your DbContext in your code. Create a constructor if you don't already have one that accepts an object of type System.Data.Common.DbConnection.

System.Data.Common.DbConnection connection = DbConnectionFactory.CreateTransient();
var context = new MyContext(connection);

Additionally, I advise adding a connectionString to your app.config. However, if your code under test has code that creates another dbContext someplace, Effort will look to the app.config to retrieve that information. I assume the call to CreateTransient makes a connection for you. The example that will establish a temporary database is provided below to ensure that no operations carried out in one test have an impact on any other tests.

<add name="DefaultConnection" connectionString="Data Source=in-process;IsTransient=true" providerName="Effort.Provider" />
5/13/2016 6:41:17 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow