コード例 #1
0
 public CsdlSemanticsOperation(CsdlSemanticsSchema context, CsdlOperation operation)
     : base(operation)
 {
     this.Context   = context;
     this.operation = operation;
 }
コード例 #2
0
 public CsdlSemanticsLabeledExpression(string name, CsdlExpressionBase element, IEdmEntityType bindingContext, CsdlSemanticsSchema schema)
     : base(element)
 {
     this.name           = name;
     this.sourceElement  = element;
     this.bindingContext = bindingContext;
     this.schema         = schema;
 }
コード例 #3
0
 public CsdlSemanticsEntityContainer(CsdlSemanticsSchema context, CsdlEntityContainer entityContainer)
     : base(entityContainer)
 {
     this.context         = context;
     this.entityContainer = entityContainer;
 }
コード例 #4
0
 public CsdlSemanticsCollectionTypeDefinition(CsdlSemanticsSchema schema, CsdlCollectionType collection)
     : base(collection)
 {
     this.collection = collection;
     this.schema     = schema;
 }
コード例 #5
0
 public CsdlSemanticsIsTypeExpression(CsdlIsTypeExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema)
     : base(schema, expression)
 {
     this.expression     = expression;
     this.bindingContext = bindingContext;
 }
コード例 #6
0
 public CsdlSemanticsComplexTypeDefinition(CsdlSemanticsSchema context, CsdlComplexType complex)
     : base(context, complex)
 {
     this.complex = complex;
 }
コード例 #7
0
 public CsdlSemanticsSpatialTypeReference(CsdlSemanticsSchema schema, CsdlSpatialTypeReference reference)
     : base(schema, reference)
 {
 }
コード例 #8
0
 public CsdlSemanticsNamedTypeReference(CsdlSemanticsSchema schema, CsdlNamedTypeReference reference)
     : base(reference)
 {
     this.schema    = schema;
     this.reference = reference;
 }
コード例 #9
0
 public CsdlSemanticsBinaryTypeReference(CsdlSemanticsSchema schema, CsdlBinaryTypeReference reference)
     : base(schema, reference)
 {
 }
コード例 #10
0
 public CsdlSemanticsTypeDefinitionDefinition(CsdlSemanticsSchema context, CsdlTypeDefinition typeDefinition)
     : base(typeDefinition)
 {
     this.context        = context;
     this.typeDefinition = typeDefinition;
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CsdlSemanticsAction"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="action">The action.</param>
 public CsdlSemanticsAction(CsdlSemanticsSchema context, CsdlAction action)
     : base(context, action)
 {
 }
コード例 #12
0
 public CsdlSemanticsEntityTypeDefinition(CsdlSemanticsSchema context, CsdlEntityType entity)
     : base(context, entity)
 {
     this.entity = entity;
 }
コード例 #13
0
 public CsdlSemanticsFunction(CsdlSemanticsSchema context, CsdlFunction function)
     : base(context, function)
 {
     this.function = function;
 }
コード例 #14
0
 public CsdlSemanticsAnnotationPathExpression(CsdlPathExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema) : base(expression, bindingContext, schema)
 {
 }
コード例 #15
0
        private void AddSchema(CsdlSchema schema, bool addAnnotations)
        {
            CsdlSemanticsSchema schemaWrapper = new CsdlSemanticsSchema(this, schema);

            this.schemata.Add(schemaWrapper);
            foreach (IEdmSchemaType type in schemaWrapper.Types)
            {
                CsdlSemanticsStructuredTypeDefinition structuredType = type as CsdlSemanticsStructuredTypeDefinition;
                if (structuredType != null)
                {
                    string baseTypeNamespace;
                    string baseTypeName;
                    string baseTypeFullName = ((CsdlNamedStructuredType)structuredType.Element).BaseTypeName;
                    if (baseTypeFullName != null)
                    {
                        EdmUtil.TryGetNamespaceNameFromQualifiedName(baseTypeFullName, out baseTypeNamespace, out baseTypeName);
                        if (baseTypeName != null)
                        {
                            List <IEdmStructuredType> derivedTypes;
                            if (!this.derivedTypeMappings.TryGetValue(baseTypeName, out derivedTypes))
                            {
                                derivedTypes = new List <IEdmStructuredType>();
                                this.derivedTypeMappings[baseTypeName] = derivedTypes;
                            }

                            // TODO: REF referenced derived types
                            derivedTypes.Add(structuredType);
                        }
                    }
                }

                RegisterElement(type);
            }

            foreach (IEdmOperation function in schemaWrapper.Operations)
            {
                RegisterElement(function);
            }

            foreach (IEdmTerm valueTerm in schemaWrapper.Terms)
            {
                RegisterElement(valueTerm);
            }

            foreach (IEdmEntityContainer container in schemaWrapper.EntityContainers)
            {
                RegisterElement(container);
            }

            if (!string.IsNullOrEmpty(schema.Alias))
            {
                this.SetNamespaceAlias(schema.Namespace, schema.Alias);
            }

            if (addAnnotations)
            {
                foreach (CsdlAnnotations schemaOutOfLineAnnotations in schema.OutOfLineAnnotations)
                {
                    string target   = schemaOutOfLineAnnotations.Target;
                    string replaced = this.ReplaceAlias(target);
                    if (replaced != null)
                    {
                        target = replaced;
                    }

                    List <CsdlSemanticsAnnotations> annotations;
                    if (!this.outOfLineAnnotations.TryGetValue(target, out annotations))
                    {
                        annotations = new List <CsdlSemanticsAnnotations>();
                        this.outOfLineAnnotations[target] = annotations;
                    }

                    annotations.Add(new CsdlSemanticsAnnotations(schemaWrapper, schemaOutOfLineAnnotations));
                }
            }

            var edmVersion = this.GetEdmVersion();

            if (edmVersion == null || edmVersion < schema.Version)
            {
                this.SetEdmVersion(schema.Version);
            }
        }
 public CsdlSemanticsNavigationPropertyPathExpression(CsdlPathExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema)
     : base(expression, bindingContext, schema)
 {
 }
コード例 #17
0
 protected CsdlSemanticsStructuredTypeDefinition(CsdlSemanticsSchema context, CsdlStructuredType type)
     : base(type)
 {
     this.context = context;
 }
コード例 #18
0
 public CsdlSemanticsTerm(CsdlSemanticsSchema context, CsdlTerm valueTerm)
     : base(valueTerm)
 {
     this.Context = context;
     this.term    = valueTerm;
 }
コード例 #19
0
 public CsdlSemanticsEnumTypeDefinition(CsdlSemanticsSchema context, CsdlEnumType enumeration)
     : base(enumeration)
 {
     this.Context     = context;
     this.enumeration = enumeration;
 }
コード例 #20
0
 protected CsdlSemanticsExpression(CsdlSemanticsSchema schema, CsdlExpressionBase element)
     : base(element)
 {
     this.schema = schema;
 }
 public CsdlSemanticsDateTimeOffsetConstantExpression(CsdlConstantExpression expression, CsdlSemanticsSchema schema)
     : base(schema, expression)
 {
     this.expression = expression;
 }
コード例 #22
0
        internal static IEdmExpression WrapExpression(CsdlExpressionBase expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema)
        {
            if (expression != null)
            {
                switch (expression.ExpressionKind)
                {
                case EdmExpressionKind.Cast:
                    return(new CsdlSemanticsCastExpression((CsdlCastExpression)expression, bindingContext, schema));

                case EdmExpressionKind.BinaryConstant:
                    return(new CsdlSemanticsBinaryConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.BooleanConstant:
                    return(new CsdlSemanticsBooleanConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.Collection:
                    return(new CsdlSemanticsCollectionExpression((CsdlCollectionExpression)expression, bindingContext, schema));

                case EdmExpressionKind.DateTimeOffsetConstant:
                    return(new CsdlSemanticsDateTimeOffsetConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.DecimalConstant:
                    return(new CsdlSemanticsDecimalConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.EnumMember:
                    return(new CsdlSemanticsEnumMemberExpression((CsdlEnumMemberExpression)expression, bindingContext, schema));

                case EdmExpressionKind.FloatingConstant:
                    return(new CsdlSemanticsFloatingConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.Null:
                    return(new CsdlSemanticsNullExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.FunctionApplication:
                    return(new CsdlSemanticsApplyExpression((CsdlApplyExpression)expression, bindingContext, schema));

                case EdmExpressionKind.GuidConstant:
                    return(new CsdlSemanticsGuidConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.If:
                    return(new CsdlSemanticsIfExpression((CsdlIfExpression)expression, bindingContext, schema));

                case EdmExpressionKind.IntegerConstant:
                    return(new CsdlSemanticsIntConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.IsType:
                    return(new CsdlSemanticsIsTypeExpression((CsdlIsTypeExpression)expression, bindingContext, schema));

                case EdmExpressionKind.LabeledExpressionReference:
                    return(new CsdlSemanticsLabeledExpressionReferenceExpression((CsdlLabeledExpressionReferenceExpression)expression, bindingContext, schema));

                case EdmExpressionKind.Labeled:
                    return(schema.WrapLabeledElement((CsdlLabeledExpression)expression, bindingContext));

                case EdmExpressionKind.Path:
                    return(new CsdlSemanticsPathExpression((CsdlPathExpression)expression, bindingContext, schema));

                case EdmExpressionKind.PropertyPath:
                    return(new CsdlSemanticsPropertyPathExpression((CsdlPropertyPathExpression)expression, bindingContext, schema));

                case EdmExpressionKind.NavigationPropertyPath:
                    return(new CsdlSemanticsNavigationPropertyPathExpression((CsdlNavigationPropertyPathExpression)expression, bindingContext, schema));

                case EdmExpressionKind.Record:
                    return(new CsdlSemanticsRecordExpression((CsdlRecordExpression)expression, bindingContext, schema));

                case EdmExpressionKind.StringConstant:
                    return(new CsdlSemanticsStringConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.DurationConstant:
                    return(new CsdlSemanticsDurationConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.DateConstant:
                    return(new CsdlSemanticsDateConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.TimeOfDayConstant:
                    return(new CsdlSemanticsTimeOfDayConstantExpression((CsdlConstantExpression)expression, schema));

                case EdmExpressionKind.AnnotationPath:
                    return(new CsdlSemanticsAnnotationPathExpression((CsdlAnnotationPathExpression)expression, bindingContext, schema));
                }
            }

            return(null);
        }
コード例 #23
0
 public CsdlSemanticsStringTypeReference(CsdlSemanticsSchema schema, CsdlStringTypeReference reference)
     : base(schema, reference)
 {
 }
コード例 #24
0
        internal static IEdmTypeReference WrapTypeReference(CsdlSemanticsSchema schema, CsdlTypeReference type)
        {
            var typeReference = type as CsdlNamedTypeReference;

            if (typeReference != null)
            {
                var primitiveReference = typeReference as CsdlPrimitiveTypeReference;
                if (primitiveReference != null)
                {
                    switch (primitiveReference.Kind)
                    {
                    case EdmPrimitiveTypeKind.Boolean:
                    case EdmPrimitiveTypeKind.Byte:
                    case EdmPrimitiveTypeKind.Date:
                    case EdmPrimitiveTypeKind.Double:
                    case EdmPrimitiveTypeKind.Guid:
                    case EdmPrimitiveTypeKind.Int16:
                    case EdmPrimitiveTypeKind.Int32:
                    case EdmPrimitiveTypeKind.Int64:
                    case EdmPrimitiveTypeKind.SByte:
                    case EdmPrimitiveTypeKind.Single:
                    case EdmPrimitiveTypeKind.Stream:
                        return(new CsdlSemanticsPrimitiveTypeReference(schema, primitiveReference));

                    case EdmPrimitiveTypeKind.Binary:
                        return(new CsdlSemanticsBinaryTypeReference(schema, (CsdlBinaryTypeReference)primitiveReference));

                    case EdmPrimitiveTypeKind.DateTimeOffset:
                    case EdmPrimitiveTypeKind.Duration:
                    case EdmPrimitiveTypeKind.TimeOfDay:
                        return(new CsdlSemanticsTemporalTypeReference(schema, (CsdlTemporalTypeReference)primitiveReference));

                    case EdmPrimitiveTypeKind.Decimal:
                        return(new CsdlSemanticsDecimalTypeReference(schema, (CsdlDecimalTypeReference)primitiveReference));

                    case EdmPrimitiveTypeKind.String:
                        return(new CsdlSemanticsStringTypeReference(schema, (CsdlStringTypeReference)primitiveReference));

                    case EdmPrimitiveTypeKind.Geography:
                    case EdmPrimitiveTypeKind.GeographyPoint:
                    case EdmPrimitiveTypeKind.GeographyLineString:
                    case EdmPrimitiveTypeKind.GeographyPolygon:
                    case EdmPrimitiveTypeKind.GeographyCollection:
                    case EdmPrimitiveTypeKind.GeographyMultiPolygon:
                    case EdmPrimitiveTypeKind.GeographyMultiLineString:
                    case EdmPrimitiveTypeKind.GeographyMultiPoint:
                    case EdmPrimitiveTypeKind.Geometry:
                    case EdmPrimitiveTypeKind.GeometryPoint:
                    case EdmPrimitiveTypeKind.GeometryLineString:
                    case EdmPrimitiveTypeKind.GeometryPolygon:
                    case EdmPrimitiveTypeKind.GeometryCollection:
                    case EdmPrimitiveTypeKind.GeometryMultiPolygon:
                    case EdmPrimitiveTypeKind.GeometryMultiLineString:
                    case EdmPrimitiveTypeKind.GeometryMultiPoint:
                        return(new CsdlSemanticsSpatialTypeReference(schema, (CsdlSpatialTypeReference)primitiveReference));
                    }
                }
                else
                {
                    CsdlUntypedTypeReference csdlUntypedTypeReference = typeReference as CsdlUntypedTypeReference;
                    if (csdlUntypedTypeReference != null)
                    {
                        return(new CsdlSemanticsUntypedTypeReference(schema, csdlUntypedTypeReference));
                    }

                    if (schema.FindType(typeReference.FullName) is IEdmTypeDefinition)
                    {
                        return(new CsdlSemanticsTypeDefinitionReference(schema, typeReference));
                    }
                }

                return(new CsdlSemanticsNamedTypeReference(schema, typeReference));
            }

            var typeExpression = type as CsdlExpressionTypeReference;

            if (typeExpression != null)
            {
                var collectionType = typeExpression.TypeExpression as CsdlCollectionType;
                if (collectionType != null)
                {
                    return(new CsdlSemanticsCollectionTypeExpression(typeExpression, new CsdlSemanticsCollectionTypeDefinition(schema, collectionType)));
                }

                var entityReferenceType = typeExpression.TypeExpression as CsdlEntityReferenceType;
                if (entityReferenceType != null)
                {
                    return(new CsdlSemanticsEntityReferenceTypeExpression(typeExpression, new CsdlSemanticsEntityReferenceTypeDefinition(schema, entityReferenceType)));
                }
            }

            return(null);
        }
コード例 #25
0
 public CsdlSemanticsTemporalTypeReference(CsdlSemanticsSchema schema, CsdlTemporalTypeReference reference)
     : base(schema, reference)
 {
 }
コード例 #26
0
        internal IEnumerable <IEdmVocabularyAnnotation> WrapInlineVocabularyAnnotations(CsdlSemanticsElement element, CsdlSemanticsSchema schema)
        {
            IEdmVocabularyAnnotatable vocabularyAnnotatableElement = element as IEdmVocabularyAnnotatable;

            if (vocabularyAnnotatableElement != null)
            {
                IEnumerable <CsdlAnnotation> vocabularyAnnotations = element.Element.VocabularyAnnotations;
                if (vocabularyAnnotations.FirstOrDefault() != null)
                {
                    List <IEdmVocabularyAnnotation> wrappedAnnotations = new List <IEdmVocabularyAnnotation>();
                    foreach (CsdlAnnotation vocabularyAnnotation in vocabularyAnnotations)
                    {
                        IEdmVocabularyAnnotation vocabAnnotation = this.WrapVocabularyAnnotation(vocabularyAnnotation, schema, vocabularyAnnotatableElement, null, vocabularyAnnotation.Qualifier);
                        vocabAnnotation.SetSerializationLocation(this, EdmVocabularyAnnotationSerializationLocation.Inline);
                        wrappedAnnotations.Add(vocabAnnotation);
                    }

                    return(wrappedAnnotations);
                }
            }

            return(Enumerable.Empty <IEdmVocabularyAnnotation>());
        }
コード例 #27
0
 public CsdlSemanticsFunctionImport(CsdlSemanticsEntityContainer container, CsdlFunctionImport functionImport, IEdmFunction backingfunction)
     : base(container, functionImport, backingfunction)
 {
     this.csdlSchema     = container.Context;
     this.functionImport = functionImport;
 }
コード例 #28
0
 private IEdmVocabularyAnnotation WrapVocabularyAnnotation(CsdlAnnotation annotation, CsdlSemanticsSchema schema, IEdmVocabularyAnnotatable targetContext, CsdlSemanticsAnnotations annotationsContext, string qualifier)
 {
     return(EdmUtil.DictionaryGetOrUpdate(
                this.wrappedAnnotations,
                annotation,
                ann => new CsdlSemanticsVocabularyAnnotation(schema, targetContext, annotationsContext, ann, qualifier)));
 }
コード例 #29
0
 public CsdlSemanticsBinaryConstantExpression(CsdlConstantExpression expression, CsdlSemanticsSchema schema)
     : base(schema, expression)
 {
     this.expression = expression;
 }
コード例 #30
0
 public CsdlSemanticsDecimalTypeReference(CsdlSemanticsSchema schema, CsdlDecimalTypeReference reference)
     : base(schema, reference)
 {
 }