C# Class Passive.DynamicDatabase

A class that wraps your database in Dynamic Funtime
显示文件 Open project: Talljoe/Passive Class Usage Examples

Public Methods

Method Description
DynamicDatabase ( ) : System

Initializes a new instance of the DynamicDatabase class.

DynamicDatabase ( DatabaseDialect dialect, string connectionStringName = "" ) : System

Initializes a new instance of the DynamicDatabase class.

DynamicDatabase ( DatabaseDialect dialect, string connectionString, string providerName ) : System

Initializes a new instance of the DynamicDatabase class.

DynamicDatabase ( string connectionStringName ) : System

Initializes a new instance of the DynamicDatabase class.

DynamicDatabase ( string connectionStringName, IEnumerable databaseDetectors ) : System

Initializes a new instance of the DynamicDatabase class.

DynamicDatabase ( string connectionString, string providerName ) : System

Initializes a new instance of the DynamicDatabase class.

DynamicDatabase ( string connectionString, string providerName, IEnumerable databaseDetectors ) : System

Initializes a new instance of the DynamicDatabase class.

Execute ( ) : int

Executes a series of DBCommands

Execute ( IEnumerable commands, bool transaction = false ) : int

Executes a series of DBCommands optionally in a transaction

Execute ( string sql ) : int

Executes a single DBCommand

ExecuteTransaction ( ) : int

Executes a series of DBCommands in a transaction

Fetch ( DynamicCommand command ) : IList

Runs a query against the database.

Fetch ( string sql ) : IList

Runs a query against the database.

GetTable ( string tableName, string primaryKeyField = "" ) : DynamicModel

Gets a table in the database.

OpenConnection ( ) : DbConnection

Returns a database connection.

Query ( DynamicCommand command ) : IEnumerable

Enumerates the reader yielding the results

Query ( string sql ) : IEnumerable

Enumerates the reader yielding the result

Scalar ( DynamicCommand command ) : object

Returns a single result

Scalar ( string sql ) : object

Returns a single result

Private Methods

Method Description
CreateDbCommand ( DynamicCommand command, DbTransaction tx = null, DbConnection connection = null ) : DbCommand
Initialize ( string connectionString, string providerName, IEnumerable databaseDetectors = null ) : void

Method Details

DynamicDatabase() public method

Initializes a new instance of the DynamicDatabase class.
public DynamicDatabase ( ) : System
return System

DynamicDatabase() public method

Initializes a new instance of the DynamicDatabase class.
public DynamicDatabase ( DatabaseDialect dialect, string connectionStringName = "" ) : System
dialect Passive.Dialect.DatabaseDialect The dialect.
connectionStringName string Name of the connection string.
return System

DynamicDatabase() public method

Initializes a new instance of the DynamicDatabase class.
public DynamicDatabase ( DatabaseDialect dialect, string connectionString, string providerName ) : System
dialect Passive.Dialect.DatabaseDialect The dialect.
connectionString string Database connection string
providerName string Invariant name of the database provider
return System

DynamicDatabase() public method

Initializes a new instance of the DynamicDatabase class.
public DynamicDatabase ( string connectionStringName ) : System
connectionStringName string Name of the connection string.
return System

DynamicDatabase() public method

Initializes a new instance of the DynamicDatabase class.
public DynamicDatabase ( string connectionStringName, IEnumerable databaseDetectors ) : System
connectionStringName string Name of the connection string.
databaseDetectors IEnumerable Classes used to probe the database.
return System

DynamicDatabase() public method

Initializes a new instance of the DynamicDatabase class.
public DynamicDatabase ( string connectionString, string providerName ) : System
connectionString string Database connection string
providerName string Invariant name of the database provider
return System

DynamicDatabase() public method

Initializes a new instance of the DynamicDatabase class.
public DynamicDatabase ( string connectionString, string providerName, IEnumerable databaseDetectors ) : System
connectionString string Database connection string
providerName string Invariant name of the database provider
databaseDetectors IEnumerable Classes used to probe the database.
return System

Execute() public method

Executes a series of DBCommands
public Execute ( ) : int
return int

Execute() public method

Executes a series of DBCommands optionally in a transaction
public Execute ( IEnumerable commands, bool transaction = false ) : int
commands IEnumerable
transaction bool
return int

Execute() public method

Executes a single DBCommand
public Execute ( string sql ) : int
sql string
return int

ExecuteTransaction() public method

Executes a series of DBCommands in a transaction
public ExecuteTransaction ( ) : int
return int

Fetch() public method

Runs a query against the database.
public Fetch ( DynamicCommand command ) : IList
command DynamicCommand
return IList

Fetch() public method

Runs a query against the database.
public Fetch ( string sql ) : IList
sql string
return IList

GetTable() public method

Gets a table in the database.
public GetTable ( string tableName, string primaryKeyField = "" ) : DynamicModel
tableName string
primaryKeyField string
return DynamicModel

OpenConnection() public method

Returns a database connection.
public OpenConnection ( ) : DbConnection
return System.Data.Common.DbConnection

Query() public method

Enumerates the reader yielding the results
public Query ( DynamicCommand command ) : IEnumerable
command DynamicCommand
return IEnumerable

Query() public method

Enumerates the reader yielding the result
public Query ( string sql ) : IEnumerable
sql string
return IEnumerable

Scalar() public method

Returns a single result
public Scalar ( DynamicCommand command ) : object
command DynamicCommand
return object

Scalar() public method

Returns a single result
public Scalar ( string sql ) : object
sql string
return object