AspireMySqlConnectorExtensions Methods
Class Methods 2 members
Extension methods for connecting MySQL database with MySqlConnector client
AddKeyedMySqlDataSource(IHostApplicationBuilder, string, Action<MySqlConnectorSettings>) Section titled AddKeyedMySqlDataSource(IHostApplicationBuilder, string, Action<MySqlConnectorSettings>) extension Registers
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 class AspireMySqlConnectorExtensions{ public static void AddKeyedMySqlDataSource( this IHostApplicationBuilder builder, string name, Action<MySqlConnectorSettings>? configureSettings = null) { // ... }}Parameters
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to. name string The name of the component, which is used as the ServiceDescriptor.ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section. configureSettings Action<MySqlConnectorSettings> optional An optional method that can be used for customizing options. It's invoked after the settings are read from the configuration. Exceptions
ArgumentNullException Thrown when builder or name is null. ArgumentException Thrown if mandatory name is empty. InvalidOperationException Thrown when mandatory MySqlConnectorSettings.ConnectionString is not provided. Remarks
Reads the configuration from "Aspire:MySqlConnector:{name}" section.
AddMySqlDataSource(IHostApplicationBuilder, string, Action<MySqlConnectorSettings>) Section titled AddMySqlDataSource(IHostApplicationBuilder, string, Action<MySqlConnectorSettings>) extension Registers
MySqlDataSource service for connecting MySQL database with MySqlConnector client. Configures health check, logging and telemetry for the MySqlConnector client. public static class AspireMySqlConnectorExtensions{ public static void AddMySqlDataSource( this IHostApplicationBuilder builder, string connectionName, Action<MySqlConnectorSettings>? configureSettings = null) { // ... }}Parameters
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to. connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section. configureSettings Action<MySqlConnectorSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration. Exceptions
ArgumentNullException Thrown if mandatory builder is null. InvalidOperationException Thrown when mandatory MySqlConnectorSettings.ConnectionString is not provided. Remarks
Reads the configuration from "Aspire:MySqlConnector" section.