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.
파일 보기 프로젝트 열기: PiranhaCMS/Piranha

공개 프로퍼티들

프로퍼티 타입 설명
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