Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

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