Bug #70803 Wrong namespace on MySql.Data.MySqlClient.MySqlClientFactory
Submitted: 2 Nov 2013 15:17 Modified: 27 Dec 2013 1:00
Reporter: David Sarmiento Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.8.0 OS:Any
Assigned to: Francisco Alberto Tirado Zavala CPU Architecture:Any

[2 Nov 2013 15:17] David Sarmiento
Description:
Hi, after some fighting with the installer (I had to extract and then manually install the DLLs because I have the VS plugin), I reference mysql.data.ef6 and I am getting the following error:

The 'Instance' member of the Entity Framework provider type 'MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.8.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

How to repeat:
Install connector.net on VS2012
Create a Solution
Add a Model-First ADO Data Entities Project
Create a console Project and reference the above
Try to load something from the db via .Find()

Suggested fix:
While inspecting the referenced assembly (MySql.Data v.6.8.0) you see this:

#region Assembly MySql.Data.dll, v6.8.0.0
// C:\Users\Paavum Ex Machina\Documents\Visual Studio 2012\Projects\ConsoleApplication1\packages\MySQL Connector Net 6.8.0\Assemblies\v4.5\MySql.Data.dll
#endregion

using System;

namespace MySql.Data.MySqlClient
{
    public sealed class MySqlClientFactory : System.Data.Common.DbProviderFactory, IServiceProvider
    {
        public static MySqlClientFactory Instance;

        public MySqlClientFactory();

        public override bool CanCreateDataSourceEnumerator { get; }

        public override System.Data.Common.DbCommand CreateCommand();
        public override System.Data.Common.DbCommandBuilder CreateCommandBuilder();
        public override System.Data.Common.DbConnection CreateConnection();
        public override System.Data.Common.DbConnectionStringBuilder CreateConnectionStringBuilder();
        public override System.Data.Common.DbDataAdapter CreateDataAdapter();
        public override System.Data.Common.DbParameter CreateParameter();
    }
}

According to: https://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20E...

The namespaces should change according to the following:
"The general rule for namespace changes is that any type in System.Data.* is moved to System.Data.Entity.Core.*. In other words, just insert Entity.Core. after System.Data."
[6 Nov 2013 0:14] Francisco Alberto Tirado Zavala
Hello David.

Please verify that the configuration in your app.config/web.config looks like:
...
<entityFramework>
  <providers>
    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.8.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
  </providers>
</entityFramework>
...

Note the "MySql.Data.Entity.EF6" in the type property.
You can take a look here to know more about the configuration for EF5 or EF6:
http://bugs.mysql.com/bug.php?id=70758

Thanks for your time.
[28 Dec 2013 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".