EFCore.BulkExtensions icon indicating copy to clipboard operation
EFCore.BulkExtensions copied to clipboard

Return all existing entities from BulkRead

Open JiriRichter opened this issue 4 years ago • 6 comments

Hi, This is a suggestion, not an issue. In our project, we needed a function very similar to BulkRead but a version which would return all matching entities. Basically, a method that would under the hood call a copy of the SQL adapter ReadAsync method, skip the tableInfo.UpdateReadEntities and return existingEntities. The BulkRead, in its current implementation, is not really an alternative to using .Contains/IN which will return all entities matching the criteria while BulkRead will only return the first.

JiriRichter avatar Jun 15 '21 22:06 JiriRichter

Will consider it but I'm not sure how to implement it. Can you write example of what you need to achieve and also if you feel up to it could try to make a PR.

borisdj avatar Jun 16 '21 07:06 borisdj

I have this functionality implemented on top of EFCore.BulkExtensions lib. Luckily all the key classes are public. I'll try to make a PR with the proposed changes to the BulkRead operation.

JiriRichter avatar Jun 16 '21 13:06 JiriRichter

Hi I have the same logic needed and i do same like @JiriRichter and i have a suggestion to make GetDataTable public because i needed with custom logic

Ameen-Alqattow avatar Jun 20 '21 17:06 Ameen-Alqattow

This sounds like it would be useful :)

Tyler-V avatar Feb 08 '22 13:02 Tyler-V

just found this issue. would be great to have this feature

ignj avatar May 03 '22 19:05 ignj

GetDataTable was made public, and will review any PR made regarding this proposal.

borisdj avatar May 03 '22 20:05 borisdj

PR was merged. BulkConfig now has ReplaceReadEntities.

borisdj avatar Jan 23 '23 10:01 borisdj