Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>DataObjects.Net offers an intermediate solution:</p> <ul> <li>Currently it can't perform server-side deletion of entities selected by query. This will be implemented some day, but for now there is another solution.</li> <li>One the other hand, is supports so-called generalized batching: queries it sends are sent in batches by up to 25 items at once, when this is possible. "Possible" means "query result won't be necessary right now". This is almost always correct for creations, updates and deletes. Since such queries always lead to a single (or few, if there is inheritance) seek operations, they're pretty cheap. If they're sent in bulks, SQL Server can cache plans for the whole bulks, not for just individual queries there. </li> </ul> <p>So this is very fast, although not yet ideal:</p> <ul> <li>For now DO4 doesn't use IN (...) to optimize such deletions.</li> <li>So far it doesn't support asynchronous batch execution. When this is done (I hope this will be done in a month or so), its speed on CUD (a subset from CRUD) operations will be nearly the same as of SqlBulkCopy (~= 1.5 ... 2 times faster than now).</li> </ul> <p>So in case with DO bulk deletion looks as follows:</p> <pre><code>var customersToRemove = from customer in Query&lt;Customer&gt;.All where customer.IsDeleted select customer; foreach (customer in customersToRemove) customer.Remove(); // This will be automatically batched </code></pre> <p>I can name a benefit of this approach: any of such objects will be able to react on deletion; Session event subscribers will be notified about each deletion as well. So any common logic related to deletions will work as expected. This is impossible, if such operation is executed on server.</p> <p>Code for soft delete must look like:</p> <pre><code>var customersToRemove = from customer in Query&lt;Customer&gt;.All where ... select customer; foreach (customer in customersToRemove) customer.IsRemoved = true; // This will be automatically batched </code></pre> <p>Obviously, such an approach is slower that bulk server-side update. By our estimates, what we have now is about 5 times slower than true server-side deletion in worst case ([bigint Id, bigint Value] table, clustered primary index, no other indexes); on real-life cases (more columns, more indexes, more data) it must bring a comparable performance right now (i.e. be 2-3 times slower). Asynchronous batch execution will improve this further.</p> <p>Btw, we shared tests for bulk CUD operations with entities for various ORM frameworks at <a href="http://ormbattle.net/" rel="nofollow noreferrer">ORMBattle.NET</a>. Note that tests there don't use bulk server-side updates (in fact, such test would be a test for database performance rather than ORM); instead they test if ORM is capable of optimizing this. Anyway, the info provided there + <a href="http://code.google.com/p/ormbattle/source/browse/#svn/trunk/Tests/Performance" rel="nofollow noreferrer">test code</a> might be helpful, if you're evaluating multiple ORM tools.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload