C# Class 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.
Afficher le fichier Open project: PiranhaCMS/Piranha

Méthodes publiques

Свойство Type Description
CurrentVersion int

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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.

Method Details

CreateCommand() public static méthode

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
Résultat IDbCommand

Login() public static méthode

Logs in the given user when no HttpContext is available.
public static Login ( string login, string password ) : bool
login string Username
password string Password
Résultat bool

LoginSys() public static méthode

Logs in the default sys user.
public static LoginSys ( ) : void
Résultat void

Logout() public static méthode

Logs out the current user.
public static Logout ( ) : void
Résultat void

OpenConnection() public static méthode

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
Résultat IDbConnection

OpenTransaction() public static méthode

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
Résultat IDbTransaction

Property Details

CurrentVersion public_oe static_oe property

Gets the current database version.
public static int CurrentVersion
Résultat int