<PackageReference Include="System.Data.SqlClient" Version="4.8.4" />

SqlMetaData

public sealed class SqlMetaData
Specifies and retrieves metadata information from parameters and columns of SqlDataRecord objects. This class cannot be inherited.
public static long Max { get; }

Gets the length of text, ntext, and image data types.

Gets the comparison rules used for the column or parameter.

public DbType DbType { get; }

Gets the data type of the column or parameter.

public bool IsUniqueKey { get; }

Indicates if the column in the table-valued parameter is unique.

public long LocaleId { get; }

Gets the locale ID of the column or parameter.

public long MaxLength { get; }

Gets the maximum length of the column or parameter.

public string Name { get; }

Gets the name of the column or parameter.

public byte Precision { get; }

Gets the precision of the column or parameter.

public byte Scale { get; }

Gets the scale of the column or parameter.

public SortOrder SortOrder { get; }

Returns the sort order for a column.

public int SortOrdinal { get; }

Returns the ordinal of the sort column.

public SqlDbType SqlDbType { get; }

Gets the data type of the column or parameter.

public Type Type { get; }

Gets the common language runtime (CLR) type of a user-defined type (UDT).

public string TypeName { get; }

Gets the three-part name of the user-defined type (UDT) or the SQL Server type represented by the instance.

public bool UseServerDefault { get; }

Reports whether this column should use the default server value.

public string XmlSchemaCollectionDatabase { get; }

Gets the name of the database where the schema collection for this XML instance is located.

public string XmlSchemaCollectionName { get; }

Gets the name of the schema collection for this XML instance.

public string XmlSchemaCollectionOwningSchema { get; }

Gets the owning relational schema where the schema collection for this XML instance is located.

public SqlMetaData(string name, SqlDbType dbType)

Initializes a new instance of the SqlMetaData class with the specified column name and type.

public SqlMetaData(string name, SqlDbType dbType, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal)

Initializes a new instance of the SqlMetaData class with the specified column name, and default server. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column.

public SqlMetaData(string name, SqlDbType dbType, byte precision, byte scale)

Initializes a new instance of the SqlMetaData class with the specified column name, type, precision, and scale.

public SqlMetaData(string name, SqlDbType dbType, byte precision, byte scale, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal)

Initializes a new instance of the SqlMetaData class with the specified column name, type, precision, scale, and server default. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column.

public SqlMetaData(string name, SqlDbType dbType, long maxLength)

Initializes a new instance of the SqlMetaData class with the specified column name, type, and maximum length.

public SqlMetaData(string name, SqlDbType dbType, long maxLength, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal)

Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, and server default. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column.

public SqlMetaData(string name, SqlDbType dbType, long maxLength, byte precision, byte scale, long locale, SqlCompareOptions compareOptions, Type userDefinedType)

Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, precision, scale, locale ID, compare options, and user-defined type (UDT).

public SqlMetaData(string name, SqlDbType dbType, long maxLength, byte precision, byte scale, long localeId, SqlCompareOptions compareOptions, Type userDefinedType, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal)

Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, precision, scale, locale ID, compare options, and user-defined type (UDT). This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column.

public SqlMetaData(string name, SqlDbType dbType, long maxLength, long locale, SqlCompareOptions compareOptions)

Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, locale, and compare options.

public SqlMetaData(string name, SqlDbType dbType, long maxLength, long locale, SqlCompareOptions compareOptions, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal)

Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, locale, compare options, and server default. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column.

public SqlMetaData(string name, SqlDbType dbType, string database, string owningSchema, string objectName)

Initializes a new instance of the SqlMetaData class with the specified column name, type, database name, owning schema, and object name.

public SqlMetaData(string name, SqlDbType dbType, string database, string owningSchema, string objectName, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal)

Initializes a new instance of the SqlMetaData class with the specified column name, database name, owning schema, object name, and default server. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column.

public SqlMetaData(string name, SqlDbType dbType, Type userDefinedType)

Initializes a new instance of the SqlMetaData class with the specified column name, type, and user-defined type (UDT).

public SqlMetaData(string name, SqlDbType dbType, Type userDefinedType, string serverTypeName)

Initializes a new instance of the SqlMetaData class with the specified column name, user-defined type (UDT), and SQLServer type.

public SqlMetaData(string name, SqlDbType dbType, Type userDefinedType, string serverTypeName, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal)

Initializes a new instance of the SqlMetaData class with the specified column name, type, user-defined type, SQL Server type, and server default. This form of the constructor supports table-valued parameters by allowing you to specify if the column is unique in the table-valued parameter, the sort order for the column, and the ordinal of the sort column.

public static SqlMetaData InferFromValue(object value, string name)

Infers the metadata from the specified object and returns it as a SqlMetaData instance.

public bool Adjust(bool value)

Validates the specified Boolean value against the metadata, and adjusts the value if necessary.

public byte Adjust(byte value)

Validates the specified Byte value against the metadata, and adjusts the value if necessary.

public byte[] Adjust(byte[] value)

Validates the specified array of Byte values against the metadata, and adjusts the value if necessary.

public char Adjust(char value)

Validates the specified Char value against the metadata, and adjusts the value if necessary.

public char[] Adjust(char[] value)

Validates the specified array of Char values against the metadata, and adjusts the value if necessary.

public SqlBinary Adjust(SqlBinary value)

Validates the specified SqlBinary value against the metadata, and adjusts the value if necessary.

Validates the specified SqlBoolean value against the metadata, and adjusts the value if necessary.

public SqlByte Adjust(SqlByte value)

Validates the specified SqlByte value against the metadata, and adjusts the value if necessary.

public SqlBytes Adjust(SqlBytes value)

Validates the specified SqlBytes value against the metadata, and adjusts the value if necessary.

public SqlChars Adjust(SqlChars value)

Validates the specified SqlChars value against the metadata, and adjusts the value if necessary.

Validates the specified SqlDateTime value against the metadata, and adjusts the value if necessary.

Validates the specified SqlDecimal value against the metadata, and adjusts the value if necessary.

public SqlDouble Adjust(SqlDouble value)

Validates the specified SqlDouble value against the metadata, and adjusts the value if necessary.

public SqlGuid Adjust(SqlGuid value)

Validates the specified SqlGuid value against the metadata, and adjusts the value if necessary.

public SqlInt16 Adjust(SqlInt16 value)

Validates the specified SqlInt16 value against the metadata, and adjusts the value if necessary.

public SqlInt32 Adjust(SqlInt32 value)

Validates the specified SqlInt32 value against the metadata, and adjusts the value if necessary.

public SqlInt64 Adjust(SqlInt64 value)

Validates the specified SqlInt64 value against the metadata, and adjusts the value if necessary.

public SqlMoney Adjust(SqlMoney value)

Validates the specified SqlMoney value against the metadata, and adjusts the value if necessary.

public SqlSingle Adjust(SqlSingle value)

Validates the specified SqlSingle value against the metadata, and adjusts the value if necessary.

public SqlString Adjust(SqlString value)

Validates the specified SqlString value against the metadata, and adjusts the value if necessary.

public SqlXml Adjust(SqlXml value)

Validates the specified SqlXml value against the metadata, and adjusts the value if necessary.

public DateTime Adjust(DateTime value)

Validates the specified DateTime value against the metadata, and adjusts the value if necessary.

Validates the specified DateTimeOffset value against the metadata, and adjusts the value if necessary.

public decimal Adjust(decimal value)

Validates the specified Decimal value against the metadata, and adjusts the value if necessary.

public double Adjust(double value)

Validates the specified Double value against the metadata, and adjusts the value if necessary.

public Guid Adjust(Guid value)

Validates the specified Guid value against the metadata, and adjusts the value if necessary.

public short Adjust(short value)

Validates the specified Int16 value against the metadata, and adjusts the value if necessary.

public int Adjust(int value)

Validates the specified Int32 value against the metadata, and adjusts the value if necessary.

public long Adjust(long value)

Validates the specified Int64 value against the metadata, and adjusts the value if necessary.

public object Adjust(object value)

Validates the specified Object value against the metadata, and adjusts the value if necessary.

public float Adjust(float value)

Validates the specified Single value against the metadata, and adjusts the value if necessary.

public string Adjust(string value)

Validates the specified String value against the metadata, and adjusts the value if necessary.

public TimeSpan Adjust(TimeSpan value)

Validates the specified TimeSpan value against the metadata, and adjusts the value if necessary.