AspireMySqlConnectorExtensions.AddKeyedMySqlDataSource Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Registers MySqlConnector.MySqlDataSource as a keyed service for given name
for connecting MySQL database with MySqlConnector client.
Configures health check, logging and telemetry for the MySqlConnector client.
public static void AddKeyedMySqlDataSource (this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.MySqlConnector.MySqlConnectorSettings>? configureSettings = default);
static member AddKeyedMySqlDataSource : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.MySqlConnector.MySqlConnectorSettings> -> unit
<Extension()>
Public Sub AddKeyedMySqlDataSource (builder As IHostApplicationBuilder, name As String, Optional configureSettings As Action(Of MySqlConnectorSettings) = Nothing)
Parameters
- builder
- IHostApplicationBuilder
The IHostApplicationBuilder to read config from and add services to.
- name
- String
The name of the component, which is used as the ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
- configureSettings
- Action<MySqlConnectorSettings>
An optional method that can be used for customizing options. It's invoked after the settings are read from the configuration.
Exceptions
Thrown when builder
or name
is null.
Thrown if mandatory name
is empty.
Thrown when mandatory ConnectionString is not provided.
Remarks
Reads the configuration from "Aspire:MySqlConnector:{name}" section.