Comments (8)
You can not use it like that.
This would be quite complex to implement since you could have tree of nested elements and would have go through entire depth of that structure, analysing each table and what to insert first.
The way you do it with Bulk operations is that you first add the parent, via regular Add or using BulkInsert if there are a lot of them as well.
And then you add Child element by sending Child list in BulkInsert.
Here usually is where SetOutputIdentity is used because if Id is generated in Db you need it back so you can set their FK in Child objects.
from efcore.bulkextensions.
So how do you use SetOutputIdentity, what does return, a list of the newly inserted id's. ?
from efcore.bulkextensions.
Not list of Id-s, but list of entities themselves, the list that you have send, it just updates Id Property.
It is explained in README, Paragraph SetOutputIdentity.
from efcore.bulkextensions.
Can you please explain how It works, i am passing in a list of entities for inserting, but even after using BulkInsert and set output identity as true, noting is updated in the entities list, the id remains 0 as before inserting, please explain. thank you. can you show me a code snippet
this is my code: I expect list to have the changes
public void InsertBulk(List list)
{
_context.BulkInsert(list, new BulkConfig { SetOutputIdentity = true});
}
from efcore.bulkextensions.
Also Borris, I am running into timeout problems when inserting thousands of records, how do I increase timeout, will that help?
from efcore.bulkextensions.
There was a small bug with SetOutputIdentity which is now fixed in 2.0.1 version.
from efcore.bulkextensions.
Big thanks for your help, just asking do you always see comments even on closed issues?, what is the proper way to ask something, open a new issue? is opening new issues a problem? sorry for asking, I am fairly new to the github world
from efcore.bulkextensions.
Yes, I get the notification about comments even on closed issues.
I guess the good rule would be to ask questions even on closed issues if they are about the issue itself, and if it is unrelated question about another thing then to open a new issue, regardless whether others issues are opened or closed.
from efcore.bulkextensions.
Related Issues (20)
- BulkInsertOrUpdateAsync performance questions HOT 3
- Using EF Core 8 Complex Property results in error "Sequence contains no matching element"
- When using PostgreSQL to batch insert DateTime.Now data, there might be a time offset.
- BulkExtensions determines target DbContext incorrectly when calls to different database servers in parallel HOT 1
- VULN: CVE-2024-32655 in Npgsql dependency HOT 3
- BulkInsertOrUpdate doesn't return Identity when no insert or update happen
- not present in the dictionary.
- can BulkInsert support my custom ValueGenerator for Id column HOT 1
- BulkSaveChangesAsync leaves tracked entities in state of "Added" even after successful save. HOT 2
- Spatial support in SQLite for Point
- BulkRead: System.NotSupportedException: 'Specified method is not supported.'
- BulkInsert produces sytanx error on PostgreSQL (version 6.x) HOT 1
- Bulk operation fails when owned type has enum member on PostgreSQL
- `SharedTypeEntity` don't work with bulk operations HOT 1
- [MySql/MariaDb] Insert an boolean type has invalid result (Always insert true in a bit column) HOT 1
- Question : Set value on shadow properties "on save" HOT 1
- Unable to cast object of type 'System.Int64' to type 'System.Nullable`1[System.Int32]' HOT 1
- PostgreSQL Table-Per-Hierarchy Inheritance Is Not Working HOT 1
- Truncate method with custom table name HOT 1
- BulkInsertAsync is assigning negative values to inserted entries' primary keys HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efcore.bulkextensions.