Created
September 28, 2014 00:49
-
-
Save ahmad2x4/8f586c3e08a799ef792a to your computer and use it in GitHub Desktop.
Blog automapper extensions
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
public static class FunctionCompositionExtensions | |
{ | |
public static Expression<Func<TX, TY>> Compose<TX, TY, TZ>(this Expression<Func<TZ, TY>> outer, Expression<Func<TX, TZ>> inner) | |
{ | |
return Expression.Lambda<Func<TX, TY>>( | |
ParameterReplacer.Replace(outer.Body, outer.Parameters[0], inner.Body), | |
inner.Parameters[0]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment