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

Enable custom configuration of NpgsqlDataSourceBuilder when using AddEventuousPostgres #323

Closed
gius opened this issue Mar 21, 2024 · 1 comment · Fixed by #341
Closed

Comments

@gius
Copy link

gius commented Mar 21, 2024

Is your feature request related to a problem? Please describe.
When using PostgreSQL projectors along with NodaTime, one needs to configure NpgsqlDataSourceBuilder. However, when initializing Postgres using AddEventuousPostgres, there is no way to customize the initialization. We could manually register NpgsqlDataSource, but that would require to repeat all the additional setup that is done by AddEventuousPostgres.

Describe the solution you'd like
Add a way to access NpgsqlDataSourceBuilder created by AddNpgsqlDataSourceCore.

For example, with EF, you can configure the builder as follows:

services.AddDbContext<PostregressDbContext>((provider, options) =>
{
    options.UseNpgsql(connectionString.Value, b => b.UseNodaTime());
});

Describe alternatives you've considered
Manually registering NpgsqlDataSource.

Additional context
NodaTime + PostgreSQL

@gius
Copy link
Author

gius commented Mar 21, 2024

A workaround is to configure the mappings globally. However, the function is Obsolete.

NpgsqlConnection.GlobalTypeMapper.UseNodaTime();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant