I have an one-to-many relationship defined with EntityFramework code-first. Something like: BigEntity that contains a SmallEntitiesList (list o of SmallEntity).
Whenver I update the SmallEntities list of that object, and I perform a dbContext.SaveChanges()
, I can see in the SQL logger that Entity Framework inserts those items by making a roundtrip to database for each one.
So the log is looking something like this:
Each of these inserts looks like this:
DECLARE
updatedRowid ROWID;
BEGIN
INSERT INTO SOME_TABLE(...)
VALUES (...)
RETURNING ROWID INTO updatedRowid;
OPEN '' /* @outParameter */ FOR SELECT
SOME_TABLE
FROM SOME_TABLE
WHERE ROWID = updatedRowid;
END;
Is there a way to make entity framework to behave differently and make these inserts making a trip to database for each one?
UPDATE: Already tried BulkInsert (there is no support for Oracle DevArt, which is what I am using).