Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BulkRead (auto) remove non-existent items. #960

Closed
Odraio opened this issue Sep 26, 2022 · 2 comments
Closed

BulkRead (auto) remove non-existent items. #960

Odraio opened this issue Sep 26, 2022 · 2 comments

Comments

@Odraio
Copy link

Odraio commented Sep 26, 2022

Is it possible to (auto) remove items which are NOT present in the database?

E.g. myIds contains 1234 (an Id which doesn't exists in the database).
After executing the BulkRead method, the items list still contains the item...
Does EFCore.BulkExtensions provide a bulkConfig to remove the non-existent items?

var items = myIds.Select(tmpId => new Item() { Id = tmpId }).ToList();
var bulkConfig = new BulkConfig { SetOutputIdentity = true, SqlBulkCopyOptions = SqlBulkCopyOptions.KeepIdentity};
_context.BulkRead(items, bulkConfig);
@Odraio
Copy link
Author

Odraio commented Sep 29, 2022

I think the question/ request will be resolved by pull request Added ReplaceReadEntities property to BulkConfig (#571). #946

@borisdj
Copy link
Owner

borisdj commented Dec 8, 2022

This would not be base feature of the lib.
Better to implement it by overriding the BulkRead method, similir example just for Audit: #56

@borisdj borisdj closed this as completed Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants