dotnet / dotnet/efcore

Use DbDataSource.CreateCommand when a transaction isn't necessary

Open
#28,267 0 comments 0 reactions 0 assignees View on GitHub
area-global
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

#28266 tracks basic support for the new DbDataSource ADO.NET abstraction (https://github.com/dotnet/runtime/issues/64812), i.e. allowing users to provide a DbDataSource to UseSqlServer.

This issue tracks going further, and using the "connection-less command" feature on DbDataSource when single commands are executed without state (i.e. there's no transaction). The main current reason for this is that in Npgsql, we want to make multiplexing available only via the "connection-less command" API; that's both the right API for it (no possibility of the user accidentally using NpgsqlConnection in a way which depends on state), and it would also considerably simplify the internal implementation (see https://github.com/npgsql/npgsql/issues/4496). But if that's done on the Npgsql side, it would no longer be possible for the EF provider to use multiplexing until this issue is done.

It's **probably** OK to do this by default, since users need to make a code change to opt into using DbDataSource in any case, and the DbDataSource itself has a default CreateCommand implementation which works.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.