Unable to define EFProfiledDbProviderServices class of type 'MySqlProviderServices'


I am using EF6 with MySQL (MySql.Data 6.8.3). In an MVC 5.1 website. Visual Studio 2013. Packages: MiniProfiler 3.0.10-beta7 and MiniProfiler.EF6 3.0.10-beta4

When initializing Miniprofiler with MiniProfilerEF6.Initialize(); the following error occurs:

Unable to define EFProfiledDbProviderServices class of type ‘MySqlProviderServices’. Please check that your web.config defines a <DbProviderFactories> section underneath <system.data>

After reading the error message I added DBProviderFactories to web.config but the error remains.
I am unsure if this addition is correct or if there are other steps I need to take.
My web.config is as follows:

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
  <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"/>
    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>

    <remove invariant="MySql.Data.MySqlClient" />
    <add name="MySQL" description="ADO.Net driver for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>

I have two database connections. One for my edmx (standard System.Data.EntityClient) and one for aspnet.Identity (basic DB connection string)

Any help is most appreciated!


I’ve had a quick look at the source of the EFProfiledDbProviderServices class and it expects a public static Property or Field called “Instance” on the MySqlProviderServices class.

Unfortunately the “Instance” property is marked as internal. It works with SqlProviderServices as this exposes the “Instance” property as public.

So either the MySqlProviderServices class needs to expose the “Instance” property publicly, or MiniProfiler needs to be updated to look for non-public properties too.