0

I have the following code:

using (new SecurityDisabler()) {
    using (new EditContext(itemToChange, false, false)) {
        itemToChange[field] = theValue;
    }
}

the third parameter of EditContext, if set to true, disables all Events from the enclosed code, making it functionally identical as if it was inside an EventDisabler block.

  • If the events are disabled, the change to the field's value is apparently immediately reversed once out of the block;
  • If events are enabled, the code works as expected - the changes are apparent both from the UI and on the application.

To make matters more strange, when I disable the Event the changes sometimes show up after a considerable amount of time.

My gut feeling tells me that the immediate update is caused by some event I don't know about, different from item:saved, that is firing when the item changes.

Question

Does anyone has a comprehensive list of ALL events that fire when an item's field value is changed?

Bonus question: is it possible to selectively disable specific events?

7
  • 2
    I don't have an answer to your question, but as an FYI you should consider moving away from using EditContext() - kamsar.net/index.php/2017/01/EditContext-Considered-Harmful – Trayek Dec 14 '18 at 9:57
  • Thank you, I amended my code accordingly. – Emanuele Ciriachi Dec 14 '18 at 10:10
  • 1
    Can you try to use cache.aspx page to clear all the caches after your change with event disabler enabled? – Marek Musielak Dec 14 '18 at 10:42
  • I'll give it a shot. – Emanuele Ciriachi Dec 14 '18 at 10:45
  • 1
    That is excellent question but I think it happens too deep in Sitecore item provider world and I'm afraid I won't be able to help with that. If you need to remove that item from cache you may try (I haven't tested that!): CacheManager.GetItemCache(item.Database).RemoveItem(item.ID); – Marek Musielak Dec 14 '18 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.