C# Класс Piranha.Data.Database

Helper class used to create an open and ready to use database connection using the DbProviderFactory and the connectionString section in the application settings.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
CurrentVersion int

Открытые методы

Метод Описание
CreateCommand ( IDbConnection conn, IDbTransaction tx, string sql, object args = null ) : IDbCommand

Creates a command on the given connection and sql statement and fills it with the given parameters.

Login ( string login, string password ) : bool

Logs in the given user when no HttpContext is available.

LoginSys ( ) : void

Logs in the default sys user.

Logout ( ) : void

Logs out the current user.

OpenConnection ( string name = "piranha" ) : IDbConnection

Gets the database connection from the current config.

OpenTransaction ( string name = "piranha" ) : IDbTransaction

Opens a connection and creates a transaction on it.

Приватные методы

Метод Описание
GetConnection ( string name ) : IDbConnection

Gets a connection from the current provider factory.

GetFactory ( string name ) : System.Data.Common.DbProviderFactory

Gets the current provider factory specified in the connection string section.

Описание методов

CreateCommand() публичный статический Метод

Creates a command on the given connection and sql statement and fills it with the given parameters.
public static CreateCommand ( IDbConnection conn, IDbTransaction tx, string sql, object args = null ) : IDbCommand
conn IDbConnection The connection
tx IDbTransaction
sql string The sql statement
args object The parameters
Результат IDbCommand

Login() публичный статический Метод

Logs in the given user when no HttpContext is available.
public static Login ( string login, string password ) : bool
login string Username
password string Password
Результат bool

LoginSys() публичный статический Метод

Logs in the default sys user.
public static LoginSys ( ) : void
Результат void

Logout() публичный статический Метод

Logs out the current user.
public static Logout ( ) : void
Результат void

OpenConnection() публичный статический Метод

Gets the database connection from the current config.
public static OpenConnection ( string name = "piranha" ) : IDbConnection
name string Optional name of the connection string to use
Результат IDbConnection

OpenTransaction() публичный статический Метод

Opens a connection and creates a transaction on it.
public static OpenTransaction ( string name = "piranha" ) : IDbTransaction
name string Optional name of the connection string to use
Результат IDbTransaction

Описание свойств

CurrentVersion публичное статическое свойство

Gets the current database version.
public static int CurrentVersion
Результат int