Database

Column Definitions

Methods for defining the data type and properties of database columns when using GPAL to create tables or define schema.

Methods for defining the data type and properties of database columns when using GPAL to create tables or define schema.

The column definition methods (WithIntegerColumn, WithVarCharColumn, WithDecimalColumn, etc.) are used when GPAL is generating CREATE TABLE statements or defining column metadata for an operation. Each method accepts a column name and returns the database object for chaining. WithColumnLength sets the maximum length for character columns. WithColumnPrecision and WithColumnScale set precision and scale for decimal and numeric columns. Supported column types are Integer, Decimal, Float, Money, Char, NChar, VarChar, NVarChar, Text, NText, Datetime, Time, Timestamp, Image, and structured table columns - there is no dedicated boolean/bit column type.

Examples

GPAL Fluent: High-level fluent C# API

//Column definition methods are chained in the order the columns should appear in the schema. WithColumnLength, WithColumnPrecision, and WithColumnScale apply to the most recently defined column.

// Define a table schema GPAL.Database .WithConnectionString(connStr) .WithIntegerColumn("Id") .WithNVarCharColumn("Name") .WithColumnLength(100) .WithNVarCharColumn("Email") .WithColumnLength(255) .WithDecimalColumn("Balance") .WithColumnPrecision(18) .WithColumnScale(2) .Create .Execute(out _);