Link Search Menu Expand Document

DbField


An immutable class that holds the definition of a database column. Used extensively by the library internally.

List of Properties

NameDescription
NameThe column name.
IsPrimaryReturns true if the column is primary.
IsIdentityReturns true if the column is identity.
IsNullableReturns true if the column is nullable.
TypeThe equivalent .NET CLR type.
SizeThe column size.
PrecisionThe column precision.
ScaleThe column scale.
DatabaseTypeThe database type of the column.
ProviderThe database provider that created the instance.

The following example extracts database columns using IDbHelper.

using (var connection = new SqlConnection(connectionString))
{
    var helper = connection.GetDbHelper();
    var dbFields = helper.GetFields(connection, "[dbo].[Person]");
    // Do the stuffs for the 'dbFields' here
}

Avoid using this class directly in application code unless strictly necessary.