示例#1
0
 public CsdlSemanticsValueAnnotation(CsdlSemanticsSchema schema, IEdmVocabularyAnnotatable targetContext, CsdlSemanticsAnnotations annotationsContext, CsdlValueAnnotation annotation, string externalQualifier)
     : base(schema, targetContext, annotationsContext, annotation, externalQualifier)
 {
 }
 public CsdlSemanticsValueTerm(CsdlSemanticsSchema context, CsdlValueTerm valueTerm) : base(valueTerm)
 {
     this.typeCache = new Cache <CsdlSemanticsValueTerm, IEdmTypeReference>();
     this.Context   = context;
     this.valueTerm = valueTerm;
 }
 public CsdlSemanticsLabeledExpression(string name, CsdlExpressionBase element, IEdmEntityType bindingContext, CsdlSemanticsSchema schema) : base(element)
 {
     this.expressionCache = new Cache <CsdlSemanticsLabeledExpression, IEdmExpression>();
     this.name            = name;
     this.sourceElement   = element;
     this.bindingContext  = bindingContext;
     this.schema          = schema;
 }
示例#4
0
 public CsdlSemanticsPrimitiveTypeReference(CsdlSemanticsSchema schema, CsdlPrimitiveTypeReference reference) : base(reference)
 {
     this.schema     = schema;
     this.Reference  = reference;
     this.definition = EdmCoreModel.Instance.GetPrimitiveType(this.Reference.Kind);
 }
示例#5
0
 public CsdlSemanticsNamedTypeReference(CsdlSemanticsSchema schema, CsdlNamedTypeReference reference)
     : base(reference)
 {
     this.schema    = schema;
     this.reference = reference;
 }
示例#6
0
 public CsdlSemanticsParameterReferenceExpression(CsdlParameterReferenceExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema)
     : base(schema, expression)
 {
     this.expression     = expression;
     this.bindingContext = bindingContext;
 }
示例#7
0
 public CsdlSemanticsEnumTypeDefinition(CsdlSemanticsSchema context, CsdlEnumType enumeration)
     : base(enumeration)
 {
     this.context     = context;
     this.enumeration = enumeration;
 }
示例#8
0
 public CsdlSemanticsTemporalTypeReference(CsdlSemanticsSchema schema, CsdlTemporalTypeReference reference)
     : base(schema, reference)
 {
 }
示例#9
0
 protected CsdlSemanticsExpression(CsdlSemanticsSchema schema, CsdlExpressionBase element)
     : base(element)
 {
     this.schema = schema;
 }
 public CsdlSemanticsLabeledExpressionReferenceExpression(CsdlLabeledExpressionReferenceExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema) : base(schema, expression)
 {
     this.elementCache   = new Cache <CsdlSemanticsLabeledExpressionReferenceExpression, IEdmLabeledExpression>();
     this.expression     = expression;
     this.bindingContext = bindingContext;
 }
示例#11
0
 public CsdlSemanticsEntityContainer(CsdlSemanticsSchema context, CsdlEntityContainer entityContainer)
     : base(entityContainer)
 {
     this.context         = context;
     this.entityContainer = entityContainer;
 }
示例#12
0
 public CsdlSemanticsCollectionTypeDefinition(CsdlSemanticsSchema schema, CsdlCollectionType collection)
     : base(collection)
 {
     this.collection = collection;
     this.schema     = schema;
 }
 public CsdlSemanticsBinaryTypeReference(CsdlSemanticsSchema schema, CsdlBinaryTypeReference reference)
     : base(schema, reference)
 {
 }
 public CsdlSemanticsFunctionReferenceExpression(CsdlFunctionReferenceExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema) : base(schema, expression)
 {
     this.referencedCache = new Cache <CsdlSemanticsFunctionReferenceExpression, IEdmFunction>();
     this.expression      = expression;
     this.bindingContext  = bindingContext;
 }
 public CsdlSemanticsDecimalTypeReference(CsdlSemanticsSchema schema, CsdlDecimalTypeReference reference)
     : base(schema, reference)
 {
 }
 public CsdlSemanticsDateTimeOffsetConstantExpression(CsdlConstantExpression expression, CsdlSemanticsSchema schema)
     : base(schema, expression)
 {
     this.expression = expression;
 }
 public CsdlSemanticsIsTypeExpression(CsdlIsTypeExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema)
     : base(schema, expression)
 {
     this.expression     = expression;
     this.bindingContext = bindingContext;
 }
示例#18
0
        internal static IEdmExpression WrapExpression(CsdlExpressionBase expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema)
        {
            if (expression != null)
            {
                switch (expression.ExpressionKind)
                {
                case EdmExpressionKind.AssertType:
                    return(new CsdlSemanticsAssertTypeExpression((CsdlAssertTypeExpression)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.DateTimeConstant:
                    return(new CsdlSemanticsDateTimeConstantExpression((CsdlConstantExpression)expression, schema));

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

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

                case EdmExpressionKind.EntitySetReference:
                    return(new CsdlSemanticsEntitySetReferenceExpression((CsdlEntitySetReferenceExpression)expression, bindingContext, schema));

                case EdmExpressionKind.EnumMemberReference:
                    return(new CsdlSemanticsEnumMemberReferenceExpression((CsdlEnumMemberReferenceExpression)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.FunctionReference:
                    return(new CsdlSemanticsFunctionReferenceExpression((CsdlFunctionReferenceExpression)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.ParameterReference:
                    return(new CsdlSemanticsParameterReferenceExpression((CsdlParameterReferenceExpression)expression, bindingContext, schema));

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

                case EdmExpressionKind.PropertyReference:
                    return(new CsdlSemanticsPropertyReferenceExpression((CsdlPropertyReferenceExpression)expression, bindingContext, schema));

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

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

                case EdmExpressionKind.TimeConstant:
                    return(new CsdlSemanticsTimeConstantExpression((CsdlConstantExpression)expression, schema));
                }
            }

            return(null);
        }
 public CsdlSemanticsStringTypeReference(CsdlSemanticsSchema schema, CsdlStringTypeReference reference) : base(schema, reference)
 {
 }
示例#20
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.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.DateTime:
                    case EdmPrimitiveTypeKind.DateTimeOffset:
                    case EdmPrimitiveTypeKind.Time:
                        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));
                    }
                }

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

            var typeExpression = type as CsdlExpressionTypeReference;

            if (typeExpression != null)
            {
                var rowType = typeExpression.TypeExpression as CsdlRowType;
                if (rowType != null)
                {
                    return(new CsdlSemanticsRowTypeExpression(typeExpression, new CsdlSemanticsRowTypeDefinition(schema, rowType)));
                }

                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);
        }
示例#21
0
 public CsdlSemanticsBinaryConstantExpression(CsdlConstantExpression expression, CsdlSemanticsSchema schema) : base(schema, expression)
 {
     this.valueCache  = new Cache <CsdlSemanticsBinaryConstantExpression, byte[]>();
     this.errorsCache = new Cache <CsdlSemanticsBinaryConstantExpression, IEnumerable <EdmError> >();
     this.expression  = expression;
 }
示例#22
0
        internal IEnumerable <IEdmVocabularyAnnotation> WrapInlineVocabularyAnnotations(CsdlSemanticsElement element, CsdlSemanticsSchema schema)
        {
            IEdmVocabularyAnnotatable vocabularyAnnotatableElement = element as IEdmVocabularyAnnotatable;

            if (vocabularyAnnotatableElement != null)
            {
                IEnumerable <CsdlVocabularyAnnotationBase> vocabularyAnnotations = element.Element.VocabularyAnnotations;
                if (vocabularyAnnotations.FirstOrDefault() != null)
                {
                    List <IEdmVocabularyAnnotation> wrappedAnnotations = new List <IEdmVocabularyAnnotation>();
                    foreach (CsdlVocabularyAnnotationBase 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>());
        }
示例#23
0
 public CsdlSemanticsAnnotations(CsdlSemanticsSchema context, CsdlAnnotations annotations)
 {
     this.context     = context;
     this.annotations = annotations;
 }
示例#24
0
 private IEdmVocabularyAnnotation WrapVocabularyAnnotation(CsdlVocabularyAnnotationBase annotation, CsdlSemanticsSchema schema, IEdmVocabularyAnnotatable targetContext, CsdlSemanticsAnnotations annotationsContext, string qualifier)
 {
     return(EdmUtil.DictionaryGetOrUpdate(
                this.wrappedAnnotations,
                annotation,
                ann =>
     {
         CsdlValueAnnotation valueAnnotation = ann as CsdlValueAnnotation;
         return
         valueAnnotation != null
                 ? (CsdlSemanticsVocabularyAnnotation) new CsdlSemanticsValueAnnotation(schema, targetContext, annotationsContext, valueAnnotation, qualifier)
                 : (CsdlSemanticsVocabularyAnnotation) new CsdlSemanticsTypeAnnotation(schema, targetContext, annotationsContext, (CsdlTypeAnnotation)annotation, qualifier);
     }));
 }
示例#25
0
 public CsdlSemanticsValueTerm(CsdlSemanticsSchema context, CsdlValueTerm valueTerm)
     : base(valueTerm)
 {
     this.Context   = context;
     this.valueTerm = valueTerm;
 }
示例#26
0
        private void AddSchema(CsdlSchema schema)
        {
            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;
                            }

                            derivedTypes.Add(structuredType);
                        }
                    }
                }

                RegisterElement(type);
            }

            foreach (CsdlSemanticsAssociation association in schemaWrapper.Associations)
            {
                RegistrationHelper.AddElement(association, association.Namespace + "." + association.Name, this.associationDictionary, CreateAmbiguousAssociationBinding);
            }

            foreach (IEdmFunction function in schemaWrapper.Functions)
            {
                RegisterElement(function);
            }

            foreach (IEdmValueTerm valueTerm in schemaWrapper.ValueTerms)
            {
                RegisterElement(valueTerm);
            }

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

            foreach (CsdlAnnotations schemaOutOfLineAnnotations in schema.OutOfLineAnnotations)
            {
                string target   = schemaOutOfLineAnnotations.Target;
                string replaced = schemaWrapper.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));
            }

            foreach (CsdlUsing used in schema.Usings)
            {
                this.SetNamespaceAlias(used.Namespace, used.Alias);
            }

            var edmVersion = this.GetEdmVersion();

            if (edmVersion == null || edmVersion < schema.Version)
            {
                this.SetEdmVersion(schema.Version);
            }
        }
 public CsdlSemanticsEntityTypeDefinition(CsdlSemanticsSchema context, CsdlEntityType entity)
     : base(context, entity)
 {
     this.entity = entity;
 }
示例#28
0
 protected CsdlSemanticsStructuredTypeDefinition(CsdlSemanticsSchema context, CsdlStructuredType type)
     : base(type)
 {
     this.context = context;
 }
 public CsdlSemanticsBinaryConstantExpression(CsdlConstantExpression expression, CsdlSemanticsSchema schema)
     : base(schema, expression)
 {
     this.expression = expression;
 }
示例#30
0
 public CsdlSemanticsAssociation(CsdlSemanticsSchema context, CsdlAssociation association)
     : base(association)
 {
     this.association = association;
     this.context     = context;
 }