Show / Hide Table of Contents

Class GPALDatabase

Class to define database usage. Currently only used for input from a table, sql or stored procedure.
Instantiated with GPAL.Database

Inheritance
System.Object
GPALDatabase
Implements
IGPALDatabase
IAllowColumnLength
IAllowPrecsionScaleAndSettings
IAllowDatabaseSettings
IAllowColumnPrecision
IAllowColumnScale
IAllowParametersAndActions
IAllowDatabaseActions
IAllowParametersAndUsing
IAllowDatabaseUsing
IAllowParametersAndInto
IAllowParameters
IAllowDatabaseInto
IAllowDatabaseExecute
IAllowToGPALObject<IGPALDatabase>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: GenerallyPositive
Assembly: GPAL.dll
Syntax
public class GPALDatabase : IGPALDatabase, IAllowColumnLength, IAllowPrecsionScaleAndSettings, IAllowDatabaseSettings, IAllowColumnPrecision, IAllowColumnScale, IAllowParametersAndActions, IAllowDatabaseActions, IAllowParametersAndUsing, IAllowDatabaseUsing, IAllowParametersAndInto, IAllowParameters, IAllowDatabaseInto, IAllowDatabaseExecute, IAllowToGPALObject<IGPALDatabase>

Properties

BeginTransaction

Declaration
public IAllowParametersAndActions BeginTransaction { get; }
Property Value
Type Description
IAllowParametersAndActions

ClearParameters

If you have already defined parameter objectss on a GPAL.Database, you can clear them and add new parameter objects;

Declaration
public IAllowParameters ClearParameters { get; }
Property Value
Type Description
IAllowParameters

Commit

Declaration
public IAllowDatabaseActions Commit { get; }
Property Value
Type Description
IAllowDatabaseActions

Create

Declaration
public IAllowParametersAndUsing Create { get; }
Property Value
Type Description
IAllowParametersAndUsing

Delete

Declaration
public IAllowParametersAndUsing Delete { get; }
Property Value
Type Description
IAllowParametersAndUsing

Read

Declaration
public IAllowParametersAndInto Read { get; }
Property Value
Type Description
IAllowParametersAndInto

Rollback

Declaration
public IAllowDatabaseActions Rollback { get; }
Property Value
Type Description
IAllowDatabaseActions

Tokens

The rows/columns returned from the database.
Tokens are loaded upon calling any [Append/FillIn/Insert]FromDatabase method.
Intended for debugging only.

Declaration
public IGPALGrid<string> Tokens { get; }
Property Value
Type Description
IGPALGrid<System.String>

A GPALGrid of tokens

Update

Declaration
public IAllowParametersAndUsing Update { get; }
Property Value
Type Description
IAllowParametersAndUsing

Methods

Execute(out Int32)

Declaration
public IAllowParametersAndActions Execute(out int rowCount)
Parameters
Type Name Description
System.Int32 rowCount
Returns
Type Description
IAllowParametersAndActions

IntoDataTable(out DataTable)

Declaration
public IAllowDatabaseExecute IntoDataTable(out DataTable dataTable)
Parameters
Type Name Description
System.Data.DataTable dataTable
Returns
Type Description
IAllowDatabaseExecute

IntoGrid(out IGPALGrid<String>)

Declaration
public IAllowDatabaseExecute IntoGrid(out IGPALGrid<string> dataGrid)
Parameters
Type Name Description
IGPALGrid<System.String> dataGrid
Returns
Type Description
IAllowDatabaseExecute

ToGPALObject()

Declaration
public IGPALDatabase ToGPALObject()
Returns
Type Description
IGPALDatabase

Using(IGPALGrid<String>)

Declaration
public IAllowDatabaseExecute Using(IGPALGrid<string> parametersGrid)
Parameters
Type Name Description
IGPALGrid<System.String> parametersGrid
Returns
Type Description
IAllowDatabaseExecute

Using(DataTable)

Declaration
public IAllowDatabaseExecute Using(DataTable dataTable)
Parameters
Type Name Description
System.Data.DataTable dataTable
Returns
Type Description
IAllowDatabaseExecute

WithCharColumn(String)

Define a Char column

Declaration
public IAllowColumnLength WithCharColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowColumnLength

Fluent interface to define more database settings

WithColumnLength(Int32)

Declaration
public IAllowDatabaseSettings WithColumnLength(int length)
Parameters
Type Name Description
System.Int32 length
Returns
Type Description
IAllowDatabaseSettings

WithColumnPrecision(Int32)

Declaration
public IAllowPrecsionScaleAndSettings WithColumnPrecision(int columnPrecision)
Parameters
Type Name Description
System.Int32 columnPrecision
Returns
Type Description
IAllowPrecsionScaleAndSettings

WithColumnScale(Int32)

Declaration
public IAllowPrecsionScaleAndSettings WithColumnScale(int columnScale)
Parameters
Type Name Description
System.Int32 columnScale
Returns
Type Description
IAllowPrecsionScaleAndSettings

WithConnectionString(String)

Set the connectrion string used to connect to the database.
If no connection string is provided, GPAL will construct one from the server and database name, and if supplied, username and password.

Declaration
public IAllowDatabaseSettings WithConnectionString(string connectionString)
Parameters
Type Name Description
System.String connectionString

The connection string

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

Examples
Database database = (Database)GPAL.Database
    .WithServerName(@"HORNET\SqlServer")
    .WithDatabaseName("GPAL")
    .WithTableName("TestInput")
    .WithRowCount(4);

WithCreateAs(String)

Declaration
public IAllowDatabaseSettings WithCreateAs(string sqlCommand)
Parameters
Type Name Description
System.String sqlCommand
Returns
Type Description
IAllowDatabaseSettings

WithDatabaseName(String)

Set the database instance name.
Used with database servername and [optional] usename/password to construct a connection string.

Declaration
public IAllowDatabaseSettings WithDatabaseName(string databaseName)
Parameters
Type Name Description
System.String databaseName
Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
    .WithServerName(@"HORNET\SqlServer")
    .WithDatabaseName("GPAL")
    .WithTableName("TestInput")
    .WithRowCount(4);

WithDatabaseType(Enums.DatabaseType)

Set the type of database GPAL is interacting with.
Currently only SQL Server is supported. (Do not need to specify)

Declaration
public IAllowDatabaseSettings WithDatabaseType(Enums.DatabaseType databaseType)
Parameters
Type Name Description
Enums.DatabaseType databaseType

The database type, MySql, PostGres, SqlServer [default]

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
    .WithServerName(@"HORNET\SqlServer")
    .WithDatabaseName("GPAL")
    .WithDatabaseType(DatabaseType.MySql)
    .WithTableName("TestInput")
    .WithRowCount(4);

WithDatetimeColumn(String)

Define a DateTime column

Declaration
public IAllowDatabaseSettings WithDatetimeColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithDecimalColumn(String)

Define a Decimal column

Declaration
public IAllowPrecsionScaleAndSettings WithDecimalColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowPrecsionScaleAndSettings

Fluent interface to define more database settings

WithDeleteAs(String)

Declaration
public IAllowDatabaseSettings WithDeleteAs(string sqlCommand)
Parameters
Type Name Description
System.String sqlCommand
Returns
Type Description
IAllowDatabaseSettings

WithErrorCallback(GPALDatabase.CallOnError)

Declaration
public IAllowDatabaseSettings WithErrorCallback(GPALDatabase.CallOnError callOnError)
Parameters
Type Name Description
GPALDatabase.CallOnError callOnError
Returns
Type Description
IAllowDatabaseSettings

WithFloatColumn(String)

Define a Float column [Double/Real]

Declaration
public IAllowDatabaseSettings WithFloatColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithImageColumn(String)

Define an Image column

Declaration
public IAllowDatabaseSettings WithImageColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithIntegerColumn(String)

Define an Integer column

Declaration
public IAllowDatabaseSettings WithIntegerColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithMoneyColumn(String)

Define a Money column

Declaration
public IAllowDatabaseSettings WithMoneyColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithNCharColumn(String)

Define an NChar column

Declaration
public IAllowColumnLength WithNCharColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowColumnLength

Fluent interface to define more database settings

WithNTextColumn(String)

Define a NText column

Declaration
public IAllowColumnLength WithNTextColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowColumnLength

Fluent interface to define more database settings

WithNVarCharColumn(String)

Define an NVarChar column

Declaration
public IAllowColumnLength WithNVarCharColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowColumnLength

Fluent interface to define more database settings

WithParameter(String)

Add a parameter to the parameters list.

Declaration
public IAllowParametersAndActions WithParameter(string parameter)
Parameters
Type Name Description
System.String parameter

The stored procedure parameter

Returns
Type Description
IAllowParametersAndActions

Fluent interface to define more database settings

WithParameterGrid(IGPALGrid<String>)

Add a parameter to the parameters list.

Declaration
public IAllowParametersAndActions WithParameterGrid(IGPALGrid<string> parametersGrid)
Parameters
Type Name Description
IGPALGrid<System.String> parametersGrid
Returns
Type Description
IAllowParametersAndActions

Fluent interface to define more database settings

WithParameterName(String)

Add a parameter name to the parameter names list.
CAVEAT: we need to know the type of parameter, this gets as tedious as the columns

Declaration
public IAllowDatabaseSettings WithParameterName(string parameterName)
Parameters
Type Name Description
System.String parameterName

The stored procedure parameter

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithPassword(String)

Set the password used to connect to the database.
If no connection string is provided, GPAL will construct one from the server and database name, and if supplied, username and password.

Declaration
public IAllowDatabaseSettings WithPassword(string password)
Parameters
Type Name Description
System.String password
Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithReadAs(String)

Declaration
public IAllowDatabaseSettings WithReadAs(string sqlCommand)
Parameters
Type Name Description
System.String sqlCommand
Returns
Type Description
IAllowDatabaseSettings

WithRowCount(Int32)

Set the numbers of rows to select from the table.

Declaration
public IAllowDatabaseSettings WithRowCount(int rowCount)
Parameters
Type Name Description
System.Int32 rowCount
Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
    .WithServerName(@"HORNET\SqlServer")
    .WithDatabaseName("GPAL")
    .WithTableName("TestInput")
    .WithRowCount(4);

WithServerName(String)

Set the database servername.
Used with databasename and [optional] usename/password to construct a connection string.

Declaration
public IAllowDatabaseSettings WithServerName(string serverName)
Parameters
Type Name Description
System.String serverName

The server name

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
    .WithServerName(@"HORNET\SqlServer")
    .WithDatabaseName("GPAL")
    .WithTableName("TestInput")
    .WithRowCount(4);

WithSQLCommand(String)

The SQL command to execute for the input data grid (tokens)

Declaration
public IAllowDatabaseSettings WithSQLCommand(string sqlCommand)
Parameters
Type Name Description
System.String sqlCommand

The SQL command to run

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithStoredProcedure(String)

The stored procedure to execute for the input data grid (tokens)

Declaration
public IAllowDatabaseSettings WithStoredProcedure(string storedProcedure)
Parameters
Type Name Description
System.String storedProcedure
Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithTableColumn(String)

Declaration
public IAllowDatabaseSettings WithTableColumn(string columnName)
Parameters
Type Name Description
System.String columnName
Returns
Type Description
IAllowDatabaseSettings

WithTableName(String)

Set the table name to query for input.
If no SQL command or stored procedure is defined, then GPAL will query the table supplied to get input data.
Use .WithRowCount to set the number of rows to select.

Declaration
public IAllowDatabaseSettings WithTableName(string tableName)
Parameters
Type Name Description
System.String tableName

The table name

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
    .WithServerName(@"HORNET\SqlServer")
    .WithDatabaseName("GPAL")
    .WithTableName("TestInput")
    .WithRowCount(4);

WithTextColumn(String)

Define a Text column

Declaration
public IAllowColumnLength WithTextColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowColumnLength

Fluent interface to define more database settings

WithTimeColumn(String)

Define a Time column

Declaration
public IAllowDatabaseSettings WithTimeColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithTimestampColumn(String)

Define a Timestamp column

Declaration
public IAllowDatabaseSettings WithTimestampColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithUDTTName(String)

Declaration
public IAllowDatabaseSettings WithUDTTName(string typeName)
Parameters
Type Name Description
System.String typeName
Returns
Type Description
IAllowDatabaseSettings

WithUpdateAs(String)

Declaration
public IAllowDatabaseSettings WithUpdateAs(string sqlCommand)
Parameters
Type Name Description
System.String sqlCommand
Returns
Type Description
IAllowDatabaseSettings

WithUsername(String)

Set the username used to connect to the database.
If no connection string is provided, GPAL will construct one from the server and database name, and if supplied, username and password.

Declaration
public IAllowDatabaseSettings WithUsername(string username)
Parameters
Type Name Description
System.String username
Returns
Type Description
IAllowDatabaseSettings

Fluent interface to define more database settings

WithVarCharColumn(String)

Define a VarChar column

Declaration
public IAllowColumnLength WithVarCharColumn(string columnName)
Parameters
Type Name Description
System.String columnName

The column name

Returns
Type Description
IAllowColumnLength

Fluent interface to define more database settings

Implements

IGPALDatabase
IAllowColumnLength
IAllowPrecsionScaleAndSettings
IAllowDatabaseSettings
IAllowColumnPrecision
IAllowColumnScale
IAllowParametersAndActions
IAllowDatabaseActions
IAllowParametersAndUsing
IAllowDatabaseUsing
IAllowParametersAndInto
IAllowParameters
IAllowDatabaseInto
IAllowDatabaseExecute
IAllowToGPALObject<TResult>
In This Article
Back to top Generated by DocFX