Skip to content

Use DbDataSource.CreateCommand when a transaction isn't necessary #28267

@roji

Description

@roji

#28266 tracks basic support for the new DbDataSource ADO.NET abstraction (dotnet/runtime#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 npgsql/npgsql#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.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions