예제 #1
0
        private static IEdmPrimitiveTypeReference Nullable(this IEdmPrimitiveTypeReference typeReference, bool isNullable)
        {
            if (typeReference.IsBinary())
            {
                var binary = typeReference.AsBinary();
                return(new EdmBinaryTypeReference(typeReference.PrimitiveDefinition(), isNullable, binary.IsUnbounded, binary.MaxLength));
            }
            else if (typeReference.IsDecimal())
            {
                var decimalRef = typeReference.AsDecimal();
                return(new EdmDecimalTypeReference(typeReference.PrimitiveDefinition(), isNullable, decimalRef.Precision, decimalRef.Scale));
            }
            else if (typeReference.IsTemporal())
            {
                var temporal = typeReference.AsTemporal();
                return(new EdmTemporalTypeReference(typeReference.PrimitiveDefinition(), isNullable, temporal.Precision));
            }
            else if (typeReference.IsString())
            {
                var stringRef = typeReference.AsString();
                return(new EdmStringTypeReference(typeReference.PrimitiveDefinition(), isNullable, stringRef.IsUnbounded, stringRef.MaxLength, stringRef.IsUnicode));
            }

            return(new EdmPrimitiveTypeReference(typeReference.PrimitiveDefinition(), isNullable));
        }