Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dependency Injection overload that takes an action with an IServiceProvider parameter #1316

Closed
bgrainger opened this issue May 3, 2023 · 0 comments
Assignees

Comments

@bgrainger
Copy link
Member

Add the following overload to MySqlConnector.DependencyInjection:

public static IServiceCollection AddMySqlDataSource(
	this IServiceCollection serviceCollection,
	string? connectionString,
	Action<IServiceProvider, MySqlDataSourceBuilder> dataSourceBuilderAction, // THIS IS THE CHANGE
	ServiceLifetime connectionLifetime = ServiceLifetime.Transient,
	ServiceLifetime dataSourceLifetime = ServiceLifetime.Singleton);

This would allow users to configure the MySqlDataSourceBuilder from services, e.g., getting the connection string or a periodic password provider from services. (Without having to recreate MySqlConnector.DependencyInjection themselves.)

Should align with npgsql/npgsql#4822 on final API.

@bgrainger bgrainger self-assigned this Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant