1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc.ExpressionUtil {
\r
15 using System.Linq.Expressions;
\r
17 // ParameterExpression fingerprint class
\r
18 // Specifically, instances of this type represent the model parameter
\r
19 internal sealed class ParameterExpressionFingerprint : ExpressionFingerprint {
\r
21 private ParameterExpressionFingerprint(ParameterExpression expression)
\r
22 : base(expression) {
\r
25 public static ParameterExpressionFingerprint Create(ParameterExpression expression, ParserContext parserContext) {
\r
26 if (expression == parserContext.ModelParameter) {
\r
27 return new ParameterExpressionFingerprint(expression);
\r
30 // degenerate case - uncaptured parameter expression passed into the system
\r
35 public override Expression ToExpression(ParserContext parserContext) {
\r
36 // The only time an instance of this class exists is if it represents the actual model parameter,
\r
37 // so just return it directly.
\r
38 return parserContext.ModelParameter;
\r