Exemple #1
0
        private IEdmExpression ComputeAppliedFunction()
        {
            if (this.expression.Function == null)
            {
                return(CsdlSemanticsModel.WrapExpression(this.expression.Arguments.FirstOrDefault(null), this.bindingContext, this.schema));
            }
            else
            {
                IEdmFunction referenced;
                IEnumerable <IEdmFunction> candidateFunctions = this.schema.FindFunctions(this.expression.Function);
                if (candidateFunctions.Count() == 0)
                {
                    referenced = new UnresolvedFunction(this.expression.Function, Edm.Strings.Bad_UnresolvedFunction(this.expression.Function), this.Location);
                }
                else
                {
                    candidateFunctions = candidateFunctions.Where(this.IsMatchingFunction);
                    if (candidateFunctions.Count() > 1)
                    {
                        referenced = new UnresolvedFunction(this.expression.Function, Edm.Strings.Bad_AmbiguousFunction(this.expression.Function), this.Location);
                    }
                    else if (candidateFunctions.Count() == 0)
                    {
                        referenced = new UnresolvedFunction(this.expression.Function, Edm.Strings.Bad_FunctionParametersDontMatch(this.expression.Function), this.Location);
                    }
                    else
                    {
                        referenced = candidateFunctions.Single();
                    }
                }

                return(new Library.Expressions.EdmFunctionReferenceExpression(referenced));
            }
        }
        private IEnumerable <IEdmExpression> ComputeElements()
        {
            List <IEdmExpression> edmExpressions = new List <IEdmExpression>();

            foreach (CsdlExpressionBase elementValue in this.expression.ElementValues)
            {
                edmExpressions.Add(CsdlSemanticsModel.WrapExpression(elementValue, this.bindingContext, base.Schema));
            }
            return(edmExpressions);
        }
 private IEdmExpression ComputeBase()
 {
     if (this.expression.BaseExpression != null)
     {
         return(CsdlSemanticsModel.WrapExpression(this.expression.BaseExpression, this.bindingContext, base.Schema));
     }
     else
     {
         return(null);
     }
 }
        private IEnumerable <IEdmExpression> ComputeArguments()
        {
            bool function = this.expression.Function == null;
            List <IEdmExpression> edmExpressions = new List <IEdmExpression>();

            foreach (CsdlExpressionBase argument in this.expression.Arguments)
            {
                if (!function)
                {
                    edmExpressions.Add(CsdlSemanticsModel.WrapExpression(argument, this.bindingContext, this.schema));
                }
                else
                {
                    function = false;
                }
            }
            return(edmExpressions);
        }
Exemple #5
0
        private IEnumerable <IEdmExpression> ComputeArguments()
        {
            bool skipFirst = this.expression.Function == null;
            List <IEdmExpression> result = new List <IEdmExpression>();

            foreach (CsdlExpressionBase argument in this.expression.Arguments)
            {
                if (skipFirst)
                {
                    skipFirst = false;
                }
                else
                {
                    result.Add(CsdlSemanticsModel.WrapExpression(argument, this.bindingContext, this.schema));
                }
            }

            return(result);
        }
        private IEdmExpression ComputeAppliedFunction()
        {
            IEdmFunction unresolvedFunction;

            if (this.expression.Function != null)
            {
                IEnumerable <IEdmFunction> edmFunctions = this.schema.FindFunctions(this.expression.Function);
                if (edmFunctions.Count <IEdmFunction>() != 0)
                {
                    edmFunctions = edmFunctions.Where <IEdmFunction>(new Func <IEdmFunction, bool>(this.IsMatchingFunction));
                    if (edmFunctions.Count <IEdmFunction>() <= 1)
                    {
                        if (edmFunctions.Count <IEdmFunction>() != 0)
                        {
                            unresolvedFunction = edmFunctions.Single <IEdmFunction>();
                        }
                        else
                        {
                            unresolvedFunction = new UnresolvedFunction(this.expression.Function, Strings.Bad_FunctionParametersDontMatch(this.expression.Function), base.Location);
                        }
                    }
                    else
                    {
                        unresolvedFunction = new UnresolvedFunction(this.expression.Function, Strings.Bad_AmbiguousFunction(this.expression.Function), base.Location);
                    }
                }
                else
                {
                    unresolvedFunction = new UnresolvedFunction(this.expression.Function, Strings.Bad_UnresolvedFunction(this.expression.Function), base.Location);
                }
                return(new EdmFunctionReferenceExpression(unresolvedFunction));
            }
            else
            {
                return(CsdlSemanticsModel.WrapExpression(this.expression.Arguments.FirstOrDefault <CsdlExpressionBase>(null), this.bindingContext, this.schema));
            }
        }
 private IEdmExpression ComputeOperand()
 {
     return(CsdlSemanticsModel.WrapExpression(this.expression.Operand, this.bindingContext, base.Schema));
 }
Exemple #8
0
 private IEdmExpression ComputeBase()
 {
     return((this.expression.BaseExpression != null) ? CsdlSemanticsModel.WrapExpression(this.expression.BaseExpression, this.bindingContext, this.Schema) : null);
 }
 private IEdmExpression ComputeExpression()
 {
     return(CsdlSemanticsModel.WrapExpression(this.sourceElement, this.BindingContext, this.schema));
 }
 private IEdmExpression ComputeValue()
 {
     return(CsdlSemanticsModel.WrapExpression(this.property.Expression, this.context.BindingContext, this.context.Schema));
 }
 private IEdmExpression ComputeValue()
 {
     return(CsdlSemanticsModel.WrapExpression(((CsdlValueAnnotation)this.Annotation).Expression, TargetBindingContext, this.Schema));
 }
Exemple #12
0
 private IEdmExpression ComputeIfTrue()
 {
     return(CsdlSemanticsModel.WrapExpression(this.expression.IfTrue, this.BindingContext, base.Schema));
 }
 private IEdmExpression ComputeTest()
 {
     return(CsdlSemanticsModel.WrapExpression(this.expression.Test, this.BindingContext, this.Schema));
 }