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

Way to retrieve generated identity values for bulk inserted entities? #8

Open
lqxdave opened this issue May 7, 2021 · 1 comment
Open

Comments

@lqxdave
Copy link

lqxdave commented May 7, 2021

With straight EF Core, calling MyDbContext.MyEntities.AddRange(someEntities) followed by MyDbContext.SaveChanges() results in someEntities having their Id column being populated with those generated by Sql Server; is there any way to accomplish the same with MyDbContext.BulkInsertAsync<MyEntity>()? Note that I am using version 2.0 of your library.

On an unrelated note, any plans to add Upsert functionality to 2.0, or is that only supported with EF 5.0?

@PawelGerr
Copy link
Owner

At the moment, BulkInsertAsync doesn't populate columns generated by the database. I may add support for that in the future, but not any time soon because my customers are generating Guids in .NET, so there is no real demand for this feature.

As for bulk-upsert, it is implemented in v3 already: documentation

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