EFCore.BulkExtensions
EFCore.BulkExtensions copied to clipboard
BulkRead not working with Postgres database when including "xmin" column
What I'm trying to do is to read large amounts of data by a large list of Ids. I have a database model that looks like this:
public class Partner
{
public Guid Id { get; set; }
public string Name { get; set; }
public string? FirstName { get; set; }
[Timestamp]
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
[Column("xmin", TypeName = "xid")]
public uint RowVersion { get; set; }
}
Then I have a large list of Ids, which can contain hundred of thousands of records, and a query like this:
List<Guid> idsToFetch = new(); // bunch of Ids
var items = idsToFetch.Select(a => new Partner { Id = a }).ToList();
var bulkConfig = new BulkConfig
{
UpdateByProperties = new List<string> { nameof(Partner.Id) },
};
await _context.BulkReadAsync(items, bulkConfig);
The error I constantly keep receiving is The required column 'xmin' was not present in the results of a 'FromSql' operation.
.
I've tried enablind EnableShadowProperties
property, as well as exclude the RowVersion
property entirely, but always same error.
EFCore version: 7.0.7
EFCore.BulkExtensions version: 7.1.2
Postgres version: 15.2
Any way to solve this?
Can confirm the issue, it happens on casting to 'List<T>', but not sure how to solve it.
Can confirm the issue, it happens on casting to 'List', but not sure how to solve it.
I see. Is there plans perhaps to investigate this further or...?
I'll leave it open for now, maybe later something comes to mind.