public CustomStringConstant(string value, EdmExpressionKind expressionKind, EdmValueKind valueKind)
     : base(null)
 {
     this.value          = value;
     this.ExpressionKind = expressionKind;
     this.valueKind      = valueKind;
 }
 public CustomStringConstant(string value, EdmExpressionKind expressionKind, EdmValueKind valueKind)
     : base(null)
 {
     this.value = value;
     this.ExpressionKind = expressionKind;
     this.valueKind = valueKind;
 }
        internal void WriteInlineExpression(IEdmExpression expression)
        {
            EdmExpressionKind expressionKind = expression.ExpressionKind;

            switch (expressionKind)
            {
            case EdmExpressionKind.BinaryConstant:
            {
                this.WriteRequiredAttribute <byte[]>("Binary", ((IEdmBinaryConstantExpression)expression).Value, new Func <byte[], string>(EdmValueWriter.BinaryAsXml));
                return;
            }

            case EdmExpressionKind.BooleanConstant:
            {
                this.WriteRequiredAttribute <bool>("Bool", ((IEdmBooleanConstantExpression)expression).Value, new Func <bool, string>(EdmValueWriter.BooleanAsXml));
                return;
            }

            case EdmExpressionKind.DateTimeConstant:
            {
                this.WriteRequiredAttribute <DateTime>("DateTime", ((IEdmDateTimeConstantExpression)expression).Value, new Func <DateTime, string>(EdmValueWriter.DateTimeAsXml));
                return;
            }

            case EdmExpressionKind.DateTimeOffsetConstant:
            {
                this.WriteRequiredAttribute <DateTimeOffset>("DateTimeOffset", ((IEdmDateTimeOffsetConstantExpression)expression).Value, new Func <DateTimeOffset, string>(EdmValueWriter.DateTimeOffsetAsXml));
                return;
            }

            case EdmExpressionKind.DecimalConstant:
            {
                this.WriteRequiredAttribute <decimal>("Decimal", ((IEdmDecimalConstantExpression)expression).Value, new Func <decimal, string>(EdmValueWriter.DecimalAsXml));
                return;
            }

            case EdmExpressionKind.FloatingConstant:
            {
                this.WriteRequiredAttribute <double>("Float", ((IEdmFloatingConstantExpression)expression).Value, new Func <double, string>(EdmValueWriter.FloatAsXml));
                return;
            }

            case EdmExpressionKind.GuidConstant:
            {
                this.WriteRequiredAttribute <Guid>("Guid", ((IEdmGuidConstantExpression)expression).Value, new Func <Guid, string>(EdmValueWriter.GuidAsXml));
                return;
            }

            case EdmExpressionKind.IntegerConstant:
            {
                this.WriteRequiredAttribute <long>("Int", ((IEdmIntegerConstantExpression)expression).Value, new Func <long, string>(EdmValueWriter.LongAsXml));
                return;
            }

            case EdmExpressionKind.StringConstant:
            {
                this.WriteRequiredAttribute <string>("String", ((IEdmStringConstantExpression)expression).Value, new Func <string, string>(EdmValueWriter.StringAsXml));
                return;
            }

            case EdmExpressionKind.TimeConstant:
            {
                this.WriteRequiredAttribute <TimeSpan>("Time", ((IEdmTimeConstantExpression)expression).Value, new Func <TimeSpan, string>(EdmValueWriter.TimeAsXml));
                return;
            }

            case EdmExpressionKind.Null:
            case EdmExpressionKind.Record:
            case EdmExpressionKind.Collection:
            {
                return;
            }

            case EdmExpressionKind.Path:
            {
                this.WriteRequiredAttribute <IEnumerable <string> >("Path", ((IEdmPathExpression)expression).Path, new Func <IEnumerable <string>, string>(EdmModelCsdlSchemaWriter.PathAsXml));
                return;
            }

            default:
            {
                return;
            }
            }
        }
Exemplo n.º 4
0
        private IEdmValue Eval(IEdmExpression expression, IEdmStructuredValue context)
        {
            Func <IEdmValue[], IEdmValue> func = null;
            IEdmStructuredTypeReference   edmStructuredTypeReference;
            IEdmCollectionTypeReference   edmCollectionTypeReference;
            object            traceString;
            EdmExpressionKind expressionKind = expression.ExpressionKind;

            switch (expressionKind)
            {
            case EdmExpressionKind.BinaryConstant:
            {
                return((IEdmBinaryConstantExpression)expression);
            }

            case EdmExpressionKind.BooleanConstant:
            {
                return((IEdmBooleanConstantExpression)expression);
            }

            case EdmExpressionKind.DateTimeConstant:
            {
                return((IEdmDateTimeConstantExpression)expression);
            }

            case EdmExpressionKind.DateTimeOffsetConstant:
            {
                return((IEdmDateTimeOffsetConstantExpression)expression);
            }

            case EdmExpressionKind.DecimalConstant:
            {
                return((IEdmDecimalConstantExpression)expression);
            }

            case EdmExpressionKind.FloatingConstant:
            {
                return((IEdmFloatingConstantExpression)expression);
            }

            case EdmExpressionKind.GuidConstant:
            {
                return((IEdmGuidConstantExpression)expression);
            }

            case EdmExpressionKind.IntegerConstant:
            {
                return((IEdmIntegerConstantExpression)expression);
            }

            case EdmExpressionKind.StringConstant:
            {
                return((IEdmStringConstantExpression)expression);
            }

            case EdmExpressionKind.TimeConstant:
            {
                return((IEdmTimeConstantExpression)expression);
            }

            case EdmExpressionKind.Null:
            {
                return((IEdmNullExpression)expression);
            }

            case EdmExpressionKind.Record:
            {
                IEdmRecordExpression edmRecordExpression = (IEdmRecordExpression)expression;
                EdmExpressionEvaluator.DelayedExpressionContext delayedExpressionContext = new EdmExpressionEvaluator.DelayedExpressionContext(this, context);
                List <IEdmPropertyValue> edmPropertyValues = new List <IEdmPropertyValue>();
                foreach (IEdmPropertyConstructor property in edmRecordExpression.Properties)
                {
                    edmPropertyValues.Add(new EdmExpressionEvaluator.DelayedRecordProperty(delayedExpressionContext, property));
                }
                if (edmRecordExpression.DeclaredType != null)
                {
                    edmStructuredTypeReference = edmRecordExpression.DeclaredType.AsStructured();
                }
                else
                {
                    edmStructuredTypeReference = null;
                }
                EdmStructuredValue edmStructuredValue = new EdmStructuredValue(edmStructuredTypeReference, edmPropertyValues);
                return(edmStructuredValue);
            }

            case EdmExpressionKind.Collection:
            {
                IEdmCollectionExpression edmCollectionExpression = (IEdmCollectionExpression)expression;
                EdmExpressionEvaluator.DelayedExpressionContext delayedExpressionContext1 = new EdmExpressionEvaluator.DelayedExpressionContext(this, context);
                List <IEdmDelayedValue> edmDelayedValues = new List <IEdmDelayedValue>();
                foreach (IEdmExpression element in edmCollectionExpression.Elements)
                {
                    edmDelayedValues.Add(this.MapLabeledExpressionToDelayedValue(element, delayedExpressionContext1, context));
                }
                if (edmCollectionExpression.DeclaredType != null)
                {
                    edmCollectionTypeReference = edmCollectionExpression.DeclaredType.AsCollection();
                }
                else
                {
                    edmCollectionTypeReference = null;
                }
                EdmCollectionValue edmCollectionValue = new EdmCollectionValue(edmCollectionTypeReference, edmDelayedValues);
                return(edmCollectionValue);
            }

            case EdmExpressionKind.Path:
            {
                EdmUtil.CheckArgumentNull <IEdmStructuredValue>(context, "context");
                IEdmPathExpression edmPathExpression = (IEdmPathExpression)expression;
                IEdmValue          edmValue          = context;
                foreach (string path in edmPathExpression.Path)
                {
                    edmValue = this.FindProperty(path, edmValue);
                    if (edmValue != null)
                    {
                        continue;
                    }
                    throw new InvalidOperationException(Strings.Edm_Evaluator_UnboundPath(path));
                }
                return(edmValue);
            }

            case EdmExpressionKind.ParameterReference:
            case EdmExpressionKind.FunctionReference:
            case EdmExpressionKind.PropertyReference:
            case EdmExpressionKind.ValueTermReference:
            case EdmExpressionKind.EntitySetReference:
            case EdmExpressionKind.EnumMemberReference:
            {
                throw new InvalidOperationException(string.Concat("Not yet implemented: evaluation of ", expression.ExpressionKind.ToString(), " expressions."));
            }

            case EdmExpressionKind.If:
            {
                IEdmIfExpression edmIfExpression = (IEdmIfExpression)expression;
                if (!((IEdmBooleanValue)this.Eval(edmIfExpression.TestExpression, context)).Value)
                {
                    return(this.Eval(edmIfExpression.FalseExpression, context));
                }
                else
                {
                    return(this.Eval(edmIfExpression.TrueExpression, context));
                }
            }

            case EdmExpressionKind.AssertType:
            {
                IEdmAssertTypeExpression edmAssertTypeExpression = (IEdmAssertTypeExpression)expression;
                IEdmValue         edmValue1 = this.Eval(edmAssertTypeExpression.Operand, context);
                IEdmTypeReference type      = edmAssertTypeExpression.Type;
                return(EdmExpressionEvaluator.AssertType(type, edmValue1));
            }

            case EdmExpressionKind.IsType:
            {
                IEdmIsTypeExpression edmIsTypeExpression = (IEdmIsTypeExpression)expression;
                IEdmValue            edmValue2           = this.Eval(edmIsTypeExpression.Operand, context);
                IEdmTypeReference    edmTypeReference    = edmIsTypeExpression.Type;
                return(new EdmBooleanConstant(EdmExpressionEvaluator.MatchesType(edmTypeReference, edmValue2)));
            }

            case EdmExpressionKind.FunctionApplication:
            {
                IEdmApplyExpression             edmApplyExpression             = (IEdmApplyExpression)expression;
                IEdmExpression                  appliedFunction                = edmApplyExpression.AppliedFunction;
                IEdmFunctionReferenceExpression edmFunctionReferenceExpression = appliedFunction as IEdmFunctionReferenceExpression;
                if (edmFunctionReferenceExpression != null)
                {
                    IList <IEdmExpression> list          = edmApplyExpression.Arguments.ToList <IEdmExpression>();
                    IEdmValue[]            edmValueArray = new IEdmValue[list.Count <IEdmExpression>()];
                    int num = 0;
                    foreach (IEdmExpression edmExpression in list)
                    {
                        int num1 = num;
                        num = num1 + 1;
                        edmValueArray[num1] = this.Eval(edmExpression, context);
                    }
                    IEdmFunction referencedFunction = edmFunctionReferenceExpression.ReferencedFunction;
                    if (referencedFunction.IsBad() || !this.builtInFunctions.TryGetValue(referencedFunction, out func))
                    {
                        if (this.lastChanceFunctionApplier != null)
                        {
                            return(this.lastChanceFunctionApplier(referencedFunction.FullName(), edmValueArray));
                        }
                    }
                    else
                    {
                        return(func(edmValueArray));
                    }
                }
                if (edmFunctionReferenceExpression != null)
                {
                    traceString = edmFunctionReferenceExpression.ReferencedFunction.ToTraceString();
                }
                else
                {
                    traceString = string.Empty;
                }
                throw new InvalidOperationException(Strings.Edm_Evaluator_UnboundFunction(traceString));
            }

            case EdmExpressionKind.LabeledExpressionReference:
            {
                return(this.MapLabeledExpressionToDelayedValue(((IEdmLabeledExpressionReferenceExpression)expression).ReferencedLabeledExpression, null, context).Value);
            }

            case EdmExpressionKind.Labeled:
            {
                return(this.MapLabeledExpressionToDelayedValue(expression, new EdmExpressionEvaluator.DelayedExpressionContext(this, context), context).Value);
            }
            }
            int expressionKind1 = (int)expression.ExpressionKind;

            throw new InvalidOperationException(Strings.Edm_Evaluator_UnrecognizedExpressionKind(expressionKind1.ToString(CultureInfo.InvariantCulture)));
        }
Exemplo n.º 5
0
        public static bool TryAssertType(this IEdmExpression expression, IEdmTypeReference type, out IEnumerable <EdmError> discoveredErrors)
        {
            EdmError[] edmError;
            EdmUtil.CheckArgumentNull <IEdmExpression>(expression, "expression");
            if (type == null || type.TypeKind() == EdmTypeKind.None)
            {
                discoveredErrors = Enumerable.Empty <EdmError>();
                return(true);
            }
            else
            {
                EdmExpressionKind expressionKind = expression.ExpressionKind;
                switch (expressionKind)
                {
                case EdmExpressionKind.BinaryConstant:
                case EdmExpressionKind.BooleanConstant:
                case EdmExpressionKind.DateTimeConstant:
                case EdmExpressionKind.DateTimeOffsetConstant:
                case EdmExpressionKind.DecimalConstant:
                case EdmExpressionKind.FloatingConstant:
                case EdmExpressionKind.GuidConstant:
                case EdmExpressionKind.IntegerConstant:
                case EdmExpressionKind.StringConstant:
                case EdmExpressionKind.TimeConstant:
                {
                    IEdmPrimitiveValue edmPrimitiveValue = (IEdmPrimitiveValue)expression;
                    if (edmPrimitiveValue.Type == null)
                    {
                        return(edmPrimitiveValue.TryAssertPrimitiveAsType(type, out discoveredErrors));
                    }
                    else
                    {
                        return(edmPrimitiveValue.Type.TestTypeMatch(type, expression.Location(), out discoveredErrors));
                    }
                }

                case EdmExpressionKind.Null:
                {
                    return(((IEdmNullExpression)expression).TryAssertNullAsType(type, out discoveredErrors));
                }

                case EdmExpressionKind.Record:
                {
                    IEdmRecordExpression edmRecordExpression = (IEdmRecordExpression)expression;
                    if (edmRecordExpression.DeclaredType == null)
                    {
                        return(edmRecordExpression.TryAssertRecordAsType(type, out discoveredErrors));
                    }
                    else
                    {
                        return(edmRecordExpression.DeclaredType.TestTypeMatch(type, expression.Location(), out discoveredErrors));
                    }
                }

                case EdmExpressionKind.Collection:
                {
                    IEdmCollectionExpression edmCollectionExpression = (IEdmCollectionExpression)expression;
                    if (edmCollectionExpression.DeclaredType == null)
                    {
                        return(edmCollectionExpression.TryAssertCollectionAsType(type, out discoveredErrors));
                    }
                    else
                    {
                        return(edmCollectionExpression.DeclaredType.TestTypeMatch(type, expression.Location(), out discoveredErrors));
                    }
                }

                case EdmExpressionKind.Path:
                {
                    return(((IEdmPathExpression)expression).TryAssertPathAsType(type, out discoveredErrors));
                }

                case EdmExpressionKind.ParameterReference:
                case EdmExpressionKind.FunctionReference:
                case EdmExpressionKind.PropertyReference:
                case EdmExpressionKind.ValueTermReference:
                case EdmExpressionKind.EntitySetReference:
                case EdmExpressionKind.EnumMemberReference:
                {
                    edmError         = new EdmError[1];
                    edmError[0]      = new EdmError(expression.Location(), EdmErrorCode.ExpressionNotValidForTheAssertedType, Strings.EdmModel_Validator_Semantic_ExpressionNotValidForTheAssertedType);
                    discoveredErrors = edmError;
                    return(false);
                }

                case EdmExpressionKind.If:
                {
                    return(((IEdmIfExpression)expression).TryAssertIfAsType(type, out discoveredErrors));
                }

                case EdmExpressionKind.AssertType:
                {
                    return(((IEdmAssertTypeExpression)expression).Type.TestTypeMatch(type, expression.Location(), out discoveredErrors));
                }

                case EdmExpressionKind.IsType:
                {
                    return(EdmCoreModel.Instance.GetBoolean(false).TestTypeMatch(type, expression.Location(), out discoveredErrors));
                }

                case EdmExpressionKind.FunctionApplication:
                {
                    IEdmApplyExpression edmApplyExpression = (IEdmApplyExpression)expression;
                    if (edmApplyExpression.AppliedFunction != null)
                    {
                        IEdmFunctionBase appliedFunction = edmApplyExpression.AppliedFunction as IEdmFunctionBase;
                        if (appliedFunction != null)
                        {
                            return(appliedFunction.ReturnType.TestTypeMatch(type, expression.Location(), out discoveredErrors));
                        }
                    }
                    discoveredErrors = Enumerable.Empty <EdmError>();
                    return(true);
                }

                case EdmExpressionKind.LabeledExpressionReference:
                {
                    return(((IEdmLabeledExpressionReferenceExpression)expression).ReferencedLabeledExpression.TryAssertType(type, out discoveredErrors));
                }

                case EdmExpressionKind.Labeled:
                {
                    return(((IEdmLabeledExpression)expression).Expression.TryAssertType(type, out discoveredErrors));
                }

                default:
                {
                    edmError         = new EdmError[1];
                    edmError[0]      = new EdmError(expression.Location(), EdmErrorCode.ExpressionNotValidForTheAssertedType, Strings.EdmModel_Validator_Semantic_ExpressionNotValidForTheAssertedType);
                    discoveredErrors = edmError;
                    return(false);
                }
                }
            }
        }
Exemplo n.º 6
0
        private List<PropertyValue> GetAnnotationValueList(EdmExpressionKind expressionKind, IEdmExpression expression)
        {
            List<PropertyValue> annotationValues = new List<PropertyValue>();

            switch (expressionKind)
            {
                case EdmExpressionKind.EnumMemberReference:
                    var enumReferenceExpression = expression as IEdmEnumMemberReferenceExpression;
                    if (null != enumReferenceExpression)
                    {
                        if (enumReferenceExpression.ReferencedEnumMember.Value.ValueKind == Microsoft.OData.Edm.Values.EdmValueKind.String)
                        {
                            var enumValue = enumReferenceExpression.ReferencedEnumMember.Value as EdmStringConstant;

                            if (null != enumValue)
                            {
                                annotationValues.Add(new PropertyValue(enumValue.Value));
                            }
                        }
                        else if (enumReferenceExpression.ReferencedEnumMember.Value.ValueKind == Microsoft.OData.Edm.Values.EdmValueKind.Integer)
                        {
                            var enumValue = enumReferenceExpression.ReferencedEnumMember.Value as EdmIntegerConstant;

                            if (null != enumValue)
                            {
                                annotationValues.Add(new PropertyValue(enumValue.Value.ToString()));
                            }
                        }
                    }
                    break;
                case EdmExpressionKind.Collection:
                    var collectionExpression = expression as IEdmCollectionExpression;
                    if (null != collectionExpression)
                    {
                        foreach (var element in collectionExpression.Elements)
                        {
                            var annotationValue = this.GetAnnotationValue(element.ExpressionKind, element);

                            if (null != annotationValue)
                            {
                                annotationValues.Add(annotationValue);
                            }
                        }
                    }
                    break;
                case EdmExpressionKind.Record:
                    var recordExpression = expression as IEdmRecordExpression;
                    if (null != recordExpression)
                    {
                        foreach (var property in recordExpression.Properties)
                        {
                            var annotationValue = this.GetAnnotationValue(property.Value.ExpressionKind, property.Value);

                            if (null != annotationValue)
                            {
                                annotationValue.Name = property.Name;
                                annotationValues.Add(annotationValue);
                            }
                        }
                    }
                    break;
                default:
                    var value = this.GetAnnotationValue(expressionKind, expression);
                    if (null != value)
                    {
                        annotationValues.Add(value);
                    }
                    break;
            }

            return annotationValues;
        }
Exemplo n.º 7
0
        private PropertyValue GetAnnotationValue(EdmExpressionKind expressionKind, IEdmExpression expression)
        {
            PropertyValue annotationValue = null;

            switch (expressionKind)
            {
                case EdmExpressionKind.StringConstant:
                    var stringExpression = expression as IEdmStringConstantExpression;
                    if (null != stringExpression)
                    {
                        annotationValue = new PropertyValue(stringExpression.Value.ToString());
                    }
                    break;
                case EdmExpressionKind.IntegerConstant:
                    var integerExpression = expression as IEdmIntegerConstantExpression;
                    if (null != integerExpression)
                    {
                        annotationValue = new PropertyValue(integerExpression.Value.ToString());
                    }
                    break;
                case EdmExpressionKind.Labeled:
                    {
                        IEdmLabeledExpression labeled = (IEdmLabeledExpression)expression;
                        return this.GetAnnotationValue(labeled.Expression.ExpressionKind, labeled.Expression);
                    }
            }

            return annotationValue;
        }
Exemplo n.º 8
0
 private List<PropertyValue> GetAnnotationValueList(EdmExpressionKind expressionKind, IEdmValueAnnotation valueAnnotation)
 {
     return this.GetAnnotationValueList(expressionKind, valueAnnotation.Value);
 }
Exemplo n.º 9
0
        private bool CheckForValueAnnotation(IEnumerable<IEdmVocabularyAnnotation> vocabularyAnnotations, EdmExpressionKind expressionKind, List<PropertyValue> values, string target)
        {
            bool annotationFounded = false;
            var valueAnnotations = vocabularyAnnotations.OfType<IEdmValueAnnotation>();
            List<PropertyValue> annotationValues;

            foreach (IEdmValueAnnotation valueAnnotation in valueAnnotations)
            {
                if (null != valueAnnotation && (null == target || valueAnnotation.Target.ToString().Equals(target)))
                {
                    annotationValues = GetAnnotationValueList(expressionKind, valueAnnotation);
                    annotationFounded = AreEquivalent(values, annotationValues);

                    if (annotationFounded)
                    {
                        break;
                    }
                }
            }

            return annotationFounded;
        }
Exemplo n.º 10
0
 private bool CheckForValueAnnotation(IEnumerable<IEdmVocabularyAnnotation> vocabularyAnnotations, EdmExpressionKind expressionKind, List<PropertyValue> values)
 {
     return this.CheckForValueAnnotation(vocabularyAnnotations, expressionKind, values, null);
 }
Exemplo n.º 11
0
 private static bool IsPropertyNonNullExpressionOrNonNullable(bool actualPropertyNullable, EdmExpressionKind checkPropertyExpression)
 {
     return (actualPropertyNullable == true && checkPropertyExpression != EdmExpressionKind.Null) || actualPropertyNullable == false;
 }
Exemplo n.º 12
0
        public void VisitExpression(IEdmExpression expression)
        {
            EdmExpressionKind expressionKind = expression.ExpressionKind;

            switch (expressionKind)
            {
            case EdmExpressionKind.None:
            {
                this.ProcessExpression(expression);
                return;
            }

            case EdmExpressionKind.BinaryConstant:
            {
                this.ProcessBinaryConstantExpression((IEdmBinaryConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.BooleanConstant:
            {
                this.ProcessBooleanConstantExpression((IEdmBooleanConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.DateTimeConstant:
            {
                this.ProcessDateTimeConstantExpression((IEdmDateTimeConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.DateTimeOffsetConstant:
            {
                this.ProcessDateTimeOffsetConstantExpression((IEdmDateTimeOffsetConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.DecimalConstant:
            {
                this.ProcessDecimalConstantExpression((IEdmDecimalConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.FloatingConstant:
            {
                this.ProcessFloatingConstantExpression((IEdmFloatingConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.GuidConstant:
            {
                this.ProcessGuidConstantExpression((IEdmGuidConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.IntegerConstant:
            {
                this.ProcessIntegerConstantExpression((IEdmIntegerConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.StringConstant:
            {
                this.ProcessStringConstantExpression((IEdmStringConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.TimeConstant:
            {
                this.ProcessTimeConstantExpression((IEdmTimeConstantExpression)expression);
                return;
            }

            case EdmExpressionKind.Null:
            {
                this.ProcessNullConstantExpression((IEdmNullExpression)expression);
                return;
            }

            case EdmExpressionKind.Record:
            {
                this.ProcessRecordExpression((IEdmRecordExpression)expression);
                return;
            }

            case EdmExpressionKind.Collection:
            {
                this.ProcessCollectionExpression((IEdmCollectionExpression)expression);
                return;
            }

            case EdmExpressionKind.Path:
            {
                this.ProcessPathExpression((IEdmPathExpression)expression);
                return;
            }

            case EdmExpressionKind.ParameterReference:
            {
                this.ProcessParameterReferenceExpression((IEdmParameterReferenceExpression)expression);
                return;
            }

            case EdmExpressionKind.FunctionReference:
            {
                this.ProcessFunctionReferenceExpression((IEdmFunctionReferenceExpression)expression);
                return;
            }

            case EdmExpressionKind.PropertyReference:
            {
                this.ProcessPropertyReferenceExpression((IEdmPropertyReferenceExpression)expression);
                return;
            }

            case EdmExpressionKind.ValueTermReference:
            {
                this.ProcessPropertyReferenceExpression((IEdmPropertyReferenceExpression)expression);
                return;
            }

            case EdmExpressionKind.EntitySetReference:
            {
                this.ProcessEntitySetReferenceExpression((IEdmEntitySetReferenceExpression)expression);
                return;
            }

            case EdmExpressionKind.EnumMemberReference:
            {
                this.ProcessEnumMemberReferenceExpression((IEdmEnumMemberReferenceExpression)expression);
                return;
            }

            case EdmExpressionKind.If:
            {
                this.ProcessIfExpression((IEdmIfExpression)expression);
                return;
            }

            case EdmExpressionKind.AssertType:
            {
                this.ProcessAssertTypeExpression((IEdmAssertTypeExpression)expression);
                return;
            }

            case EdmExpressionKind.IsType:
            {
                this.ProcessIsTypeExpression((IEdmIsTypeExpression)expression);
                return;
            }

            case EdmExpressionKind.FunctionApplication:
            {
                this.ProcessFunctionApplicationExpression((IEdmApplyExpression)expression);
                return;
            }

            case EdmExpressionKind.LabeledExpressionReference:
            {
                this.ProcessLabeledExpressionReferenceExpression((IEdmLabeledExpressionReferenceExpression)expression);
                return;
            }

            case EdmExpressionKind.Labeled:
            {
                this.ProcessLabeledExpression((IEdmLabeledExpression)expression);
                return;
            }
            }
            throw new InvalidOperationException(Strings.UnknownEnumVal_ExpressionKind(expression.ExpressionKind));
        }