Skip to content

.Net: [MEVD] Stop serializing to intermediate type in relational connectors #11123

Open
@roji

Description

@roji

The PostgreSQL connector (and others) doesn't directly deserialize from the DbDataReader; there's a temporary Dictionary<string, object> "storage model", which is read from the DbDataReader and then the CLR type is populated from that. This adds an additional unnecessary intermediate conversion, memory allocations for the temporary dictionary, and various dictionary lookups. We should change the relevant connectors to read and write directly instead. The dictionary also forces boxing of value types to occur (#11183).

Note: this will prevent the user of custom mappers in their current form, since they're designed around the idea of converting one object to another; but when dealing with ADO.NET, database results aren't an object - they're exposed via DbDataReader which must be exposed. So a PostgreSQL custom mapper would need to accept a DbDataReader and implement the logic for reading properties out of it directly (and for the other side - writing - it would need to accept or return a DbCommand, on which it would populate DbParameters).

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codemsft.ext.vectordataRelated to Microsoft.Extensions.VectorData

Type

No type

Projects

Status

Sprint: In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions