Using DbProviderFactories
MySqlConnector can be registered with DbProviderFactories
and obtained via DbProviderFactories.GetFactory("MySqlConnector")
, or by
using the methods described here.
.NET Framework
For .NET Framework applications, add the following section to your app.config
or web.config
:
<system.data>
<DbProviderFactories>
<add name="MySqlConnector"
invariant="MySqlConnector"
description="Async MySQL ADO.NET Connector"
type="MySqlConnector.MySqlConnectorFactory, MySqlConnector, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92" />
</DbProviderFactories>
</system.data>
.NET Core
For .NET Core 2.1 or later, call DbProviderFactories.RegisterFactory("MySqlConnector", MySqlConnectorFactory.Instance)
during application
startup. This will register MySqlConnector’s DbProviderFactory
implementation in the central DbProviderFactories
registry.