-
Notifications
You must be signed in to change notification settings - Fork 226
MySQL
Please note that reverse engineering a MySQL database is still under development. However the notes below are accurate 👍
The generator is a T4 template that runs externally to your project and, therefore, cannot make use of any NuGet packages you have installed into your project. It can however use ones that are installed in the GAC. Therefore the MySQL MySql.Data.dll file needs to be installed into the GAC to make it accessible to the generator.
- Visit https://dev.mysql.com/downloads/connector/net/ and download the latest installer. The current one as of creating this document is v9.3.0
- Run the installer.
- Open the "Developer command prompt" in Administrator mode. You can do this by clicking start -> run, type
Command, Select "Developer command prompt" and on the right hand side, select "run as administrator".

- At the command prompt, change directory to where the driver got installed.
cd C:\Program Files (x86)\MySQL\MySQL Connector NET 9.3
gacutil /i MySql.Data.dll
Notice I am using the .NET 4.6.1 version because the generator runs as a T4 template using .NET, and not a .NET Core template. It does not matter if you are generating code for .NET or .NET Core, the generator is run outside of your project as a .NET program.
Looking at which version I have installed with gacutil /l mysql.data shows the following:
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
The Global Assembly Cache contains the following assemblies:
mysql.data, Version=9.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL
Number of items = 1
Which means I have v9.3.0.0 installed.
In both
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.configc:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
at approximately line 156 I have the following <system.data> XML where you will see the MySQL Data Provider has been added
<system.data>
<DbProviderFactories>
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
<add name="Npgsql Data Provider" invariant="Npgsql" description=".NET Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Version=4.1.8.0, Culture=neutral, PublicKeyToken=5D8B90D52F46FDA7"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=9.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>