Hi,
I am using NH 2.1 and custom PreDeleteEventListener (code below).
Listener works, deletes entity, but when I flush session I get this
error
*** Failures ***
System.InvalidOperationException: Collection was modified; enumeration
operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException
(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at
NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions
(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush
(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
Code for listener is
public class TaskPaneCleanerEventListener :
IPreDeleteEventListener
{
public bool OnPreDelete(PreDeleteEvent e)
{
var taskPaneSource = e.Entity as ITaskPaneSource;
var taskPaneTarget = e.Entity as ITaskPaneTarget;
if (taskPaneSource != null)
HBBCoreServiceLocation.TaskPaneRegister.UnregisterTaskPaneSource
(taskPaneSource);
if (taskPaneTarget != null)
HBBCoreServiceLocation.TaskPaneRegister.UnregisterTaskPaneTarget
(taskPaneTarget);
return false;
}
}
Has anyone faced this problem before?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---