This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello,
Best regards, Dariusz Wąsacz, InstalSoft |
|
|
re 1: The reason this is slow is due to the association on EntA which triggers the need for any associated entities to be updated. This in turn triggers a query for those children. This is not the intended way of bulk deleting objects, instead you should use a "remove by query" approach which avoids all of these overheads. See http://www.mindscapehq.com/documentation/lightspeed/Performance-and-Tuning/Bulk-Updates-and-Deletes for more details on this. re 2: When deleting entities explicitly (e.g. UnitOfWork.Remove(entity)) they are always processed individually. As with #1 use UnitOfWork.Remove(query) if you want to bulk delete instances.
|
|
|
Hi Jeremy, Thank you for the answer. I tried to use bulk delete, but it is only slightly better. Re 1: The times are now:
Additional info:
Re 2: I also looked at the SQL executed on SaveChanges for bulk delete and it is no better than before. Each entity is deleted separately. My tests are attached as usual. Dariusz Wąsacz, InstalSoft |
|
|
It looks like there's also another issue with this bulk delete. It doesn't delete objects created within the same UnitOfWork. A new test added to attached tests: BulkDeleteremovescreated_entities() With regards, Darek |
|
|
Hello Jeremy, Is there any news in this subject (please see my previous 2 posts)? Darek |
|
|
You are actually using the UnitOfWork.Remove(IEnumerable
In terms of it not dealing with in-memory entities, thats correct - in the case of your IEnumerable
|
|
|
Hello Jeremy, Thank you very much for the answer. Now everything works fine :-) I thought that constructing a query the way I did it before, was equal to the method described in your post. With best regards, Darek |
|