Skip to content

Code comments for dependency injection lifetime give wrong defaults #5018

@jblazek

Description

@jblazek

Before submitting

This repo is for Npgsql ADO.NET issues only. Entity Framework issues belong in Npgsql.EntityFrameworkCore.PostgreSQL for EF Core, or EntityFramework6.Npgsql for EF 6.x.

Steps to reproduce

No steps to reproduce

The issue

In the NpgsqlServiceCollectionExtensions class, there are various places where connectionLifetime is documented to have a lifetime of scoped by default, but the actual default is transient . It seems like the documented default of scoped is what you'd want, which is what the typical EF Core recommendation says.

https://github.com/npgsql/npgsql/blob/main/src/Npgsql.DependencyInjection/NpgsqlServiceCollectionExtensions.cs#L23-L25

https://github.com/npgsql/npgsql/blob/main/src/Npgsql.DependencyInjection/NpgsqlServiceCollectionExtensions.cs#L36

Exception message:
Stack trace:

Further technical details

Npgsql version: current, 7.0.2
PostgreSQL version: n/a
Operating system: n/a

Other details about my project setup:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions