Created
January 28, 2013 13:12
-
-
Save hagbarddenstore/4655397 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
public static AutoMappingExpression Override<TController>(this AutoMappingExpression autoMappingExpression, string url, Expression<Action<TController>> actionExpression) | |
{ | |
Assert.ParameterIsNotNull(autoMappingExpression, "mappingExpression"); | |
Assert.ParameterIsNotNull(url, "url"); | |
var methodCallExpression = actionExpression.Body as MethodCallExpression; | |
if (methodCallExpression == null) | |
{ | |
throw new ArgumentException("Invalid expression. Expression should consist of a Method call only."); | |
} | |
var controllerType = typeof(TController); | |
var actionType = methodCallExpression.Method; | |
return autoMappingExpression.AddOverride(controllerType, actionType, url); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment