AspireMySqlConnectorExtensions Methods
ClassMethods2 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
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.namestringThe 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.configureSettingsAction<MySqlConnectorSettings>optionalAn optional method that can be used for customizing options. It's invoked after the settings are read from the configuration.Exceptions
ArgumentNullExceptionThrown when builder or name is null.ArgumentExceptionThrown if mandatory name is empty.InvalidOperationExceptionThrown 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
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.configureSettingsAction<MySqlConnectorSettings>optionalAn optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.Exceptions
ArgumentNullExceptionThrown if mandatory builder is null.InvalidOperationExceptionThrown when mandatory MySqlConnectorSettings.ConnectionString is not provided.Remarks
Reads the configuration from "Aspire:MySqlConnector" section.