Link Search Menu Expand Document

DbField


An immutable class that holds the definition of the database columns. This class is hugely used internally in the library.

List of Properties

Below is the list of properties.

NameDescription
NameThe name of the column.
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 size of the column from the database.
PrecisionThe precision of the column from the database.
ScaleThe scale of the column from the database.
DatabaseTypeThe type of the column from the database.
ProviderThe database provider who created the instance.

Below is the way on how to extract the 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
}

We suggest to avoid using this class in any of your development, unless very necessary.