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

Allow transfer of ownership of DbConnection from application to DbContext #24199

Closed
ajcvickers opened this issue Feb 19, 2021 · 0 comments · Fixed by #29960
Closed

Allow transfer of ownership of DbConnection from application to DbContext #24199

ajcvickers opened this issue Feb 19, 2021 · 0 comments · Fixed by #29960
Labels
area-dbcontext closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. ef6-parity providers-beware type-enhancement
Milestone

Comments

@ajcvickers
Copy link
Contributor

The defaults:

  • When EF Core creates a DbConnection from a connection string, then EF Core owns that connection and will dispose it when the context is disposed.
  • When the application creates a DbConnection and passes to a DbContext, then the application still owns the context and is responsible for disposing it.

The proposal here is to allow an application to pass ownership of the DbConnection to DbContext so that DbContext will handle disposing it. This existing in EF6, and we just saw a customer scenario where this would be very useful in EF Core.

@ajcvickers ajcvickers added this to the Backlog milestone Feb 19, 2021
@ajcvickers ajcvickers self-assigned this Feb 19, 2021
@ajcvickers ajcvickers added providers-beware closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed consider-for-current-release labels Jan 1, 2023
@ajcvickers ajcvickers modified the milestones: Backlog, 8.0.0 Jan 1, 2023
@ajcvickers ajcvickers modified the milestones: 8.0.0, 8.0.0-preview1 Jan 29, 2023
@ajcvickers ajcvickers modified the milestones: 8.0.0-preview1, 8.0.0 Nov 14, 2023
@ajcvickers ajcvickers removed their assignment Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dbcontext closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. ef6-parity providers-beware type-enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant