Skip to content

Commit

Permalink
Typo
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Jun 29, 2024
1 parent a985fc3 commit 62714ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion conceptual/Npgsql/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dataSourceBuilder.UsePasswordProvider(
await using var dataSource = dataSourceBuilder.Build();
```

Every time a new physical connection needs to be opened to PostgreSQL, either the synchronous `passwordProvider` or the asynchronous `passwordProviderAsync` will be called (depending whether you used `Open()` or `OpenAsync()`). Since modern .NET applications are encouraged to always use synchronous I/O, it's good practice to simply throw in the synchronous password provider, as above.
Every time a new physical connection needs to be opened to PostgreSQL, either the synchronous `passwordProvider` or the asynchronous `passwordProviderAsync` will be called (depending whether you used `Open()` or `OpenAsync()`). Since modern .NET applications are encouraged to always use asynchronous I/O, it's good practice to simply throw in the synchronous password provider, as above.

Note that since the password provider is invoked *every* time a physical connection is opened, it shouldn't take too long; typically, this would call into a cloud provider API (e.g. Azure Managed Identity), which itself implements a caching mechanism. However, if no such caching is done and the code could take a while, you can instead instruct Npgsql to cache the auth token for a given amount of time:

Expand Down

0 comments on commit 62714ec

Please sign in to comment.