Request for further information on ScopeProvider

Is the scopeprovider only for opening a scope = transaction directly on the db for database operations or does it allow making a transaction when using Save or SaveAndPublish?

How to make Save or SaveAndPublish an atomic operation?

Thanks.

The Umbraco scopes are much more elaborate. For instance, they also handle the dispatch of notifications, cache updates etc. And yes, also a transaction for the database.

Save and SaveAndPublish already create a scope, so in that sense they are already atomic operations. In fact, they are so atomic, that if you rapid fire SaveAndPublish in a foreach loop, you will eventually run into issues that Umbraco cannot process everything fast enough. In that case, you might want to create a scope and handle batches like 50 save and publishes in one go, In that case it will do one database transaction instead of 50, dispatch all notifications once and update the cache once.

Hi. Thanks.

That is:

  • create and open a scope
  • Made a loop ( 50 iterations) with SaveAndPublish
  • close the scope after the loop: mean commit the one transaction? And if one Save goes bad it do a rollback for the other previous SaveAndPublish?