Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't use <code>SimpleInterceptor</code> in this case because that is meant as base class for the most common scenario where you want to do an action before or after the actual method call. Also you are not allowed to call <code>Proceed</code> Instead implement the <code>IInterceptor</code> interface and put your code into the <code>Intercept</code> method.</p> <p>But probably we should extend <code>SimpleInterceptor</code> in a future version so that you can prevent that the actual method is called:</p> <pre><code>public abstract class SimpleInterceptor : IInterceptor { private bool proceedInvocation = true; /// &lt;summary&gt; /// Intercepts the specified invocation. /// &lt;/summary&gt; /// &lt;param name="invocation"&gt;The invocation to intercept.&lt;/param&gt; public void Intercept( IInvocation invocation ) { BeforeInvoke( invocation ); if (proceedInvocation) { invocation.Proceed(); AfterInvoke( invocation ); } } /// &lt;summary&gt; /// When called in BeforeInvoke then the invokation in not proceeded anymore. /// Or in other words the decorated method and AfterInvoke won't be called anymore. /// Make sure you have assigned the return value in case it is not void. /// &lt;/summary&gt; protected void DontProceedInvokation() { this.proceedInvocation = false; } /// &lt;summary&gt; /// Takes some action before the invocation proceeds. /// &lt;/summary&gt; /// &lt;param name="invocation"&gt;The invocation that is being intercepted.&lt;/param&gt; protected virtual void BeforeInvoke( IInvocation invocation ) { } /// &lt;summary&gt; /// Takes some action after the invocation proceeds. /// &lt;/summary&gt; /// &lt;param name="invocation"&gt;The invocation that is being intercepted.&lt;/param&gt; protected virtual void AfterInvoke( IInvocation invocation ) { } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload