What is in a mysql provider?

2019-09-07 07:47发布

问题:

I have been toiling with an issue with mysql connector on and off for the past 3 months using a workaround. I even filed a bug report recently. However, I have found multiple instances of mysql connector failing in situations of advanced linq use. Some dating back to 2009 ( 3 years ) and still unresolved. In almost every instance, the user switched connectors.

I am considering doing the same. However, I came across looking at where mysql connector exists inside of my project. From what I can tell, it is only an included .dll (mysql.data and mysql.data.entity). After that, it is referenced only in web.config.

The first reference to the connector is in the connection string, providerName = "MySql.Data.MySqlClient".

The second reference is the definition of the provider

<system.data>
 <DbProviderFactories>
  <clear />
  <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" 
    description=".Net Framework Data Provider for MySQL"
    type="MySql.Data.MySqlClient.MySqlClientFactory, mysql.data, Version=6.5.4.0,
          Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
 </DbProviderFactories>
</system.data>

The third is inside of the assemblies

<add assembly="mysql.data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

And the last is another assembly reference

<dependentAssembly>
    <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-6.5.4.0" newVersion="6.5.4.0" />
</dependentAssembly>

Is this really the whole footprint of the connector?

回答1:

Is this really the whole footprint of the connector?

Yes and no.

Yes

As far as the project which references the connector is concerned, this is the whole footprint. The only configuration that needs to be made is to have MySql.Data and MySql.Data.Entity added as references to the project. Usually these are inside of the packages folder, and are then copied into the bin folder once a reference has been added.

No

The connector has a lot of internal code going on. Because of where it is defined, the connector inherits from and extends on the DbProviderFactory. This extension involves many classes and sub classes which determine how the interaction to mysql is enacted. Because it is open source, the actual code can be downloaded from oracle.