Git Product home page Git Product logo

Comments (8)

borisdj avatar borisdj commented on August 16, 2024

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.

nafberger avatar nafberger commented on August 16, 2024

So how do you use SetOutputIdentity, what does return, a list of the newly inserted id's. ?

from efcore.bulkextensions.

borisdj avatar borisdj commented on August 16, 2024

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.

nafberger avatar nafberger commented on August 16, 2024

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.

nafberger avatar nafberger commented on August 16, 2024

Also Borris, I am running into timeout problems when inserting thousands of records, how do I increase timeout, will that help?

from efcore.bulkextensions.

borisdj avatar borisdj commented on August 16, 2024

There was a small bug with SetOutputIdentity which is now fixed in 2.0.1 version.

from efcore.bulkextensions.

nafberger avatar nafberger commented on August 16, 2024

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.

borisdj avatar borisdj commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.