Skip to content

Instantly share code, notes, and snippets.

@MarcoNicolodi
Created January 21, 2019 23:42
Show Gist options
  • Save MarcoNicolodi/53d7ce6e112943b558d977677f142fd6 to your computer and use it in GitHub Desktop.
Save MarcoNicolodi/53d7ce6e112943b558d977677f142fd6 to your computer and use it in GitHub Desktop.
ChainOfResponsibility
public abstract class RuleHandler<TRequest, TReturn>
{
private RuleHandler<TRequest, TReturn> _nextHandler;
public RuleHandler<TRequest, TReturn> SetNext(RuleHandler<TRequest, TReturn> handler)
{
_nextHandler = handler;
return _nextHandler;
}
public virtual TReturn Run(TRequest request) => _nextHandler.Run(request);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment