Esempio n. 1
0
        private TypeUsage GetNewType(TypeUsage type)
        {
            if (TypeUtils.IsStructuredType(type))
            {
                return(this.GetTypeInfo(type).FlattenedTypeUsage);
            }
            TypeUsage elementType;

            if (TypeHelpers.TryGetCollectionElementType(type, out elementType))
            {
                TypeUsage newType = this.GetNewType(elementType);
                if (newType.EdmEquals((MetadataItem)elementType))
                {
                    return(type);
                }
                return(TypeHelpers.CreateCollectionTypeUsage(newType));
            }
            if (TypeUtils.IsEnumerationType(type))
            {
                return(TypeHelpers.CreateEnumUnderlyingTypeUsage(type));
            }
            if (TypeSemantics.IsStrongSpatialType(type))
            {
                return(TypeHelpers.CreateSpatialUnionTypeUsage(type));
            }
            return(type);
        }
Esempio n. 2
0
 /// <summary>
 ///     Factory method for creating a type usage for underlying union type of spatial type usage.
 /// </summary>
 /// <param name="spatialTypeUsage"> Spatial type usage used to create a union type usage of. </param>
 /// <returns> Type usage for the spatial union type of the correct topology. </returns>
 internal static TypeUsage CreateSpatialUnionTypeUsage(TypeUsage spatialTypeUsage)
 {
     DebugCheck.NotNull(spatialTypeUsage);
     Debug.Assert(TypeSemantics.IsStrongSpatialType(spatialTypeUsage), "spatialTypeUsage is not a strong spatial type");
     return(TypeUsage.Create(Helper.GetSpatialNormalizedPrimitiveType(spatialTypeUsage.EdmType), spatialTypeUsage.Facets));
 }