Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 56 lines (47 sloc) 1.437 kb
using System;
namespace FubuMVC.Core.Behaviors
{
public enum PartialBehavior
{
Ignored,
Executes
}
public abstract class BasicBehavior : IActionBehavior
{
private readonly PartialBehavior _partialBehavior;
private Action _innerInvoke;
protected BasicBehavior(PartialBehavior partialBehavior)
{
_partialBehavior = partialBehavior;
_innerInvoke = () => { if (InsideBehavior != null) InsideBehavior.Invoke(); };
}
public IActionBehavior InsideBehavior { get; set; }
public void Invoke()
{
if (performInvoke() == DoNext.Continue && InsideBehavior != null)
{
_innerInvoke();
}
afterInsideBehavior();
}
public void InvokePartial()
{
if (_partialBehavior == PartialBehavior.Executes)
{
_innerInvoke = () => { if (InsideBehavior != null) InsideBehavior.InvokePartial(); };
Invoke();
}
else if (InsideBehavior != null)
{
InsideBehavior.InvokePartial();
}
}
protected virtual DoNext performInvoke()
{
return DoNext.Continue;
}
protected virtual void afterInsideBehavior()
{
}
}
}
Jump to Line
Something went wrong with that request. Please try again.