Exemplo n.º 1
0
        public static string AsString(this SqlDataType value)
        {
            if (!Enum.IsDefined(value.GetType(), value))
            {
                throw new ArgumentOutOfRangeException("value");
            }

            return(value.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Writes the specified <see cref="SqlDataType"/> to the output stream.
        /// </summary>
        /// <param name="dataType">
        /// The <see cref="SqlDataType"/> to write to the output stream.
        /// </param>
        public void WriteDataType(SqlDataType dataType)
        {
            EnsureNotDisposed();
            Write(Settings.WriteDataTypesInLowerCase
                                ? dataType.Name.Name.ToLowerInvariant()
                                : dataType.Name.Name.ToUpperInvariant());

            // Write the data type parameters.
            if (dataType.GetType() == typeof(SqlScaledDataType))
            {
                WriteDataTypeParameters((SqlScaledDataType)dataType);
            }
            else if (dataType.GetType() == typeof(SqlSizedDataType))
            {
                WriteDataTypeParameters((SqlSizedDataType)dataType);
            }
            else if (dataType.GetType() == typeof(SqlPrecisionDataType))
            {
                WriteDataTypeParameters((SqlPrecisionDataType)dataType);
            }
        }