在我的 Sitecore 应用程序中,我有以下陈述。
using (new Sitecore.SecurityModel.SecurityDisabler())
{
Item item = database.GetItem(itemId);
if (item != null)
{
item.Delete();
}
}
该item
对象不为空,并且在item.Delete();
语句中发生错误。谁能告诉这个问题有什么问题?
更新: 堆栈跟踪
at Sitecore.Tasks.ItemEventHandler.OnItemDeleted(Object sender, EventArgs args)
at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result)
at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters)
at Sitecore.Events.Event.RaiseEvent(String eventName, Object[] parameters)
at Sitecore.Events.Event.RaiseItemDeleted(Object sender, ItemDeletedEventArgs args)
at Sitecore.Events.Event.DataEngine_ItemDeleted(Object sender, ExecutedEventArgs`1 e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Sitecore.Data.Engines.EngineCommand`2.RaiseExecuted()
at Sitecore.Data.Engines.EngineCommand`2.Executed()
at Sitecore.Data.Engines.EngineCommand`2.Execute()
at Sitecore.Data.Engines.DataEngine.DeleteItem(Item item)
at Sitecore.Data.Managers.ItemProvider.DeleteItem(Item item, SecurityCheck securityCheck)
at Sitecore.Data.Managers.ItemManager.DeleteItem(Item item)
at Sitecore.Data.Items.Item.Delete(Boolean removeBlobs)
at Sitecore.Data.Items.Item.Delete()
我进一步发现该项目实际上已从 Sitecore 树中删除,然后给出了错误。