System.Data.Common.CommandTrees.DefaultExpressionVisitor.VisitFunction(System.Data.Metadata.Edm.EdmFunction)

Here are the examples of the csharp api class System.Data.Common.CommandTrees.DefaultExpressionVisitor.VisitFunction(System.Data.Metadata.Edm.EdmFunction) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

View license
public override DbExpression Visit(DbFunctionExpression expression)
        {
            EntityUtil.CheckArgumentNull(expression, "expression");

            DbExpression result = expression;
            IList<DbExpression> newArguments = this.VisitExpressionList(expression.Arguments);
            EdmFunction newFunction = this.VisitFunction(expression.Function);
            if (!object.ReferenceEquals(expression.Arguments, newArguments) ||
                !object.ReferenceEquals(expression.Function, newFunction))
            {
                result = CqtBuilder.Invoke(newFunction, newArguments);
            }
            
            NotifyIfChanged(expression, result);
            return result;
        }

2. Example

View license
protected virtual DbFunctionAggregate VisitFunctionAggregate(DbFunctionAggregate aggregate)
        {
            DbFunctionAggregate result = aggregate;
            if (aggregate != null)
            {
                EdmFunction newFunction = this.VisitFunction(aggregate.Function);
                IList<DbExpression> newArguments = this.VisitExpressionList(aggregate.Arguments);

                Debug.Assert(newArguments.Count == 1, "Function aggregate had more than one argument?");

                if (!object.ReferenceEquals(aggregate.Function, newFunction) ||
                    !object.ReferenceEquals(aggregate.Arguments, newArguments))
                {
                    if (aggregate.Distinct)
                    {
                        result = CqtBuilder.AggregateDistinct(newFunction, newArguments[0]);
                    }
                    else
                    {
                        result = CqtBuilder.Aggregate(newFunction, newArguments[0]);
                    }
                }
            }
            return result;
        }