This project has moved and is read-only. For the latest updates, please go here.

foreign key relationships

Feb 25, 2015 at 8:10 AM

I am using version EntityFramework.BulkInsert-ef6
First of all I would like to say well done, it's really fast, and works very well.

My issue is with foreign key values not being enforced. If I bulk insert entities containing a parent entity that is not persisted, all the child entities are inserted into the database with a zero foreign key value.

This is in clear violation of the foreign key constraints in the database.
How is the bulk insert able to completely flaunt the foreign key relationships. Is it possible to enforce the relationships? I would prefer not to have this risk?
Feb 25, 2015 at 9:07 AM
Edited Feb 25, 2015 at 9:07 AM

I have just found the bulk insert options.
(I really think this should be the default, it's dangerous otherwise)
                        new BulkInsertOptions
                                 SqlBulkCopyOptions = SqlBulkCopyOptions.CheckConstraints