Skip to content

.Net: [MEVD] Constrain TRecord to be class #11880

@roji

Description

@roji

There are two problems arising from a struct record:

  • When Upsert is used with database key generation, the key needs to be injected into the record type; for structs, that requires the record to be a ref parameter, which complicates the signature for everyone etc.
  • For Get, null is returned for classes when a record isn't found. For structs, the distinction between "not found" and "found but happens to be the default" can't easily be maintained; we can modify the API in various complicated/unfriendly ways to make this possible, but it doesn't seem worth it.
  • FWIW EF also constrains entity types to be classes (for similar reasons, but also since EF implements change tracking).

We don't believe there's enough need for struct record types, so we'll constrain TRecord to be class.

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codeBuildFeatures planned for next Build conferencemsft.ext.vectordataRelated to Microsoft.Extensions.VectorData

Projects

Status

Sprint: Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions