Example #1
0
        private IEdmExpression ConvertAnnotationExpression(AnnotationExpression expression)
        {
            switch (expression.Kind)
            {
            case AnnotationExpressionKind.Null:
                return(EdmNullExpression.Instance);

            case AnnotationExpressionKind.Integer:
                return(new EdmIntegerConstant((long)expression.Value));

            case AnnotationExpressionKind.Float:
                return(new EdmFloatingConstant((long)expression.Value));

            case AnnotationExpressionKind.String:
                return(new EdmStringConstant((string)expression.Value));

            case AnnotationExpressionKind.Boolean:
                return(new EdmBooleanConstant((bool)expression.Value));

            case AnnotationExpressionKind.Path:
                return(new EdmPathExpression((string)expression.Value));

            case AnnotationExpressionKind.Object:
                return(new EdmRecordExpression(
                           from prop in expression.Properties
                           select new EdmPropertyConstructor(
                               prop.Name,
                               ConvertAnnotationExpression(prop.Value))
                           ));

            case AnnotationExpressionKind.Array:
                return(new EdmCollectionExpression(
                           from item in expression.Items
                           select ConvertAnnotationExpression(item)
                           ));

            default:
                throw new NotSupportedException($"Expression kind {expression.Kind}");
            }
        }
Example #2
0
 public ExpressionProperty(string name, AnnotationExpression value)
 {
     Name  = name;
     Value = value;
 }
Example #3
0
 public Annotation(string name, AnnotationExpression value, Position position = default)
 {
     Name  = name;
     Value = value;
 }