c# - Castle Windsor - Interceptor: call invocation.Proceed twice -


We have interceptors on data-changing methods that change the changes in the database after the methods are running. In case of a deadlock, we want to redo the methods.

In this simple example, I capture SqlExceptions and in case of a deadlock, I try to call go forward again. / P>

  Try {invocation.Proceed (); If (! IsReadOnly) {log .cece ("sliding unit of work."); Session.Flush (); }} Hold (formerly generic adoption) {var sqle = ADOExceptionHelper.ExtractDbException (formerly) as SqlException; If (sqle! = Null) {if (sqle.Number == deadlockVictim) {invocation.Proceed (); }}  

Because of the castle, it fails that I am trying to call to proceed and start an exception: < / P>

This is a DynamicProxy2 error: invocation.Proceed () has been asked more often than expected.

How can I call the go forward again to catch exceptions?

It is not possible that your interceptor reset the interceptor number of the series, but if you actually You should:

  • Enter the IInterception class and change it by changing the code currentInterceptorIndex (this name was changed by -1), whatever you need.
  • In fact actually

    > actually Not recommended;

To avoid some issues, you should set the minimum limit to the call loop of the method, where your DB call never goes forward

>

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -