System.Data.Common.CommandTrees.ExpressionBuilder.DbExpressionBuilder.Variable(System.Data.Metadata.Edm.TypeUsage, string)

Here are the examples of the csharp api class System.Data.Common.CommandTrees.ExpressionBuilder.DbExpressionBuilder.Variable(System.Data.Metadata.Edm.TypeUsage, string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

View license
protected virtual DbLambda VisitLambda(DbLambda lambda)
        {
            EntityUtil.CheckArgumentNull(lambda, "lambda");

            DbLambda result = lambda;
            IList<DbVariableReferenceExpression> newFormals = this.VisitList(lambda.Variables, varRef =>
                {
                    TypeUsage newVarType = this.VisitTypeUsage(varRef.ResultType);
                    if (!object.ReferenceEquals(varRef.ResultType, newVarType))
                    {
                        return CqtBuilder.Variable(newVarType, varRef.VariableName);
                    }
                    else
                    {
                        return varRef;
                    }
                }
            );
            this.EnterScope(newFormals.ToArray()); // ToArray: Don't pass the List instance directly to OnEnterScope
            DbExpression newBody = this.VisitExpression(lambda.Body);
            this.ExitScope();

            if (!object.ReferenceEquals(lambda.Variables, newFormals) ||
                !object.ReferenceEquals(lambda.Body, newBody))
            {
                result = CqtBuilder.Lambda(newBody, newFormals);
            }
            return result;
        }