Exemplo n.º 1
0
 public CsdlSemanticsRowTypeDefinition(CsdlSemanticsSchema context, CsdlRowType row) : base(context, row)
 {
     this.row = row;
 }
Exemplo n.º 2
0
        internal static IEdmTypeReference WrapTypeReference(CsdlSemanticsSchema schema, CsdlTypeReference type)
        {
            CsdlNamedTypeReference reference = type as CsdlNamedTypeReference;

            if (reference != null)
            {
                CsdlPrimitiveTypeReference reference2 = reference as CsdlPrimitiveTypeReference;
                if (reference2 != null)
                {
                    switch (reference2.Kind)
                    {
                    case EdmPrimitiveTypeKind.Binary:
                        return(new CsdlSemanticsBinaryTypeReference(schema, (CsdlBinaryTypeReference)reference2));

                    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, reference2));

                    case EdmPrimitiveTypeKind.DateTime:
                    case EdmPrimitiveTypeKind.DateTimeOffset:
                    case EdmPrimitiveTypeKind.Time:
                        return(new CsdlSemanticsTemporalTypeReference(schema, (CsdlTemporalTypeReference)reference2));

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

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

                    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)reference2));
                    }
                }
                return(new CsdlSemanticsNamedTypeReference(schema, reference));
            }
            CsdlExpressionTypeReference expressionUsage = type as CsdlExpressionTypeReference;

            if (expressionUsage != null)
            {
                CsdlRowType typeExpression = expressionUsage.TypeExpression as CsdlRowType;
                if (typeExpression != null)
                {
                    return(new CsdlSemanticsRowTypeExpression(expressionUsage, new CsdlSemanticsRowTypeDefinition(schema, typeExpression)));
                }
                CsdlCollectionType collection = expressionUsage.TypeExpression as CsdlCollectionType;
                if (collection != null)
                {
                    return(new CsdlSemanticsCollectionTypeExpression(expressionUsage, new CsdlSemanticsCollectionTypeDefinition(schema, collection)));
                }
                CsdlEntityReferenceType entityTypeReference = expressionUsage.TypeExpression as CsdlEntityReferenceType;
                if (entityTypeReference != null)
                {
                    return(new CsdlSemanticsEntityReferenceTypeExpression(expressionUsage, new CsdlSemanticsEntityReferenceTypeDefinition(schema, entityTypeReference)));
                }
            }
            return(null);
        }