Created
January 28, 2017 12:43
-
-
Save chrisalexander/599feefee0c6e2519eaed42f61508b00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ObjectProcessor4 | |
{ | |
bool CanProcess(DomainObject x, out Func<Result> doProcess); | |
} | |
public Result DoProcessing4(ObjectProcessor4 processor, DomainObject x) | |
{ | |
Action doProcess; | |
if (processor.CanProcess(x, out doProcess)) | |
{ | |
// Here, the validation is done and we know it will work - unless the object has changed | |
return doProcess(); | |
} | |
throw new InvalidOperationException("Validation failed, but we don't know why"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment