C# Class Adf.Base.Data.SqlProvider

Represents database provider that is used for SqlServer database. Provides functionality for connecting to a SQL Server database, managing transaction and generating SQLCommand.
Inheritance: IDataProvider
Datei anzeigen Open project: NLADP/ADF

Public Methods

Method Description
Commit ( DataSources source ) : void

Commit the transaction for the database specified.

DestroyConnection ( DataSources source ) : void

Destroy any connection and reset all the transactions on the specified database.

GetAdapter ( ) : IDbDataAdapter

Create a new instance of the System.Data.SqlClient.SqlDataAdapter class.

GetCommand ( DataSources datasource, IDbConnection connection, IAdfQuery query ) : IDbCommand

Provides information about SQL command generated by the connection of System.Data.IDbConnection and query of IAdfQuery.

GetConnection ( DataSources source ) : IDbConnection

Specifies the connection from the connection list or create a new connection if it is not yet defined.

GetTransaction ( DataSources source ) : IDbTransaction

Get a transaction object from the transactions list. If none present a null value will be returned.

HandleException ( Exception exception, DataSources datasource, IAdfQuery query ) : void

Handles exceptions thrown when excequring queries.

ResetTransaction ( DataSources source ) : void

Reset all database transaction for the specified database.

Rollback ( DataSources source ) : void

Rolls back a transaction from a pending state.

SetTransaction ( DataSources source, IDbTransaction transaction ) : void

Add a transaction for a specific database to the transactions list.

SetUpAdapter ( DataSources datasource, IDbConnection connection, IAdfQuery query ) : IDbDataAdapter

Provides information to setup the data adapter by the connection of System.Data.IDbConnection.

StartTransaction ( DataSources source ) : IDbTransaction

Provides information to start a transaction to be performed at a data source.

Update ( IDbDataAdapter adapter ) : int

Updates the selected rows from the dataset.

Protected Methods

Method Description
CreateConnection ( DataSources source ) : IDbConnection

Creates a new SQL Server database connection based on the connection string specified in the data source.

SetConnection ( DataSources dataSource, IDbConnection connection ) : void

Adds a connection to the connection list.

Private Methods

Method Description
GetWhereParameters ( IAdfQuery query ) : IEnumerable

Returns the Where clauses of the given IAdfQuery and the possible contained sub-queries.

Method Details

Commit() public method

Commit the transaction for the database specified.
An error occurred while trying to commit the transaction. The transaction has already been committed or rolled back.-or- The connection is broken.
public Commit ( DataSources source ) : void
source Adf.Core.Data.DataSources The used to get the data source name.
return void

CreateConnection() protected static method

Creates a new SQL Server database connection based on the connection string specified in the data source.
protected static CreateConnection ( DataSources source ) : IDbConnection
source Adf.Core.Data.DataSources The data source containing the connection string.
return IDbConnection

DestroyConnection() public method

Destroy any connection and reset all the transactions on the specified database.
public DestroyConnection ( DataSources source ) : void
source Adf.Core.Data.DataSources The used to get the data source name.
return void

GetAdapter() public method

Create a new instance of the System.Data.SqlClient.SqlDataAdapter class.
public GetAdapter ( ) : IDbDataAdapter
return IDbDataAdapter

GetCommand() public method

Provides information about SQL command generated by the connection of System.Data.IDbConnection and query of IAdfQuery.
public GetCommand ( DataSources datasource, IDbConnection connection, IAdfQuery query ) : IDbCommand
datasource Adf.Core.Data.DataSources
connection IDbConnection The represents an open connection to a data source.
query IAdfQuery The whose SQL command information is to be retrieved.
return IDbCommand

GetConnection() public method

Specifies the connection from the connection list or create a new connection if it is not yet defined.
public GetConnection ( DataSources source ) : IDbConnection
source Adf.Core.Data.DataSources The that indicates the connection.
return IDbConnection

GetTransaction() public method

Get a transaction object from the transactions list. If none present a null value will be returned.
public GetTransaction ( DataSources source ) : IDbTransaction
source Adf.Core.Data.DataSources The used to get the data source name.
return IDbTransaction

HandleException() public method

Handles exceptions thrown when excequring queries.
public HandleException ( Exception exception, DataSources datasource, IAdfQuery query ) : void
exception System.Exception
datasource Adf.Core.Data.DataSources
query IAdfQuery
return void

ResetTransaction() public static method

Reset all database transaction for the specified database.
public static ResetTransaction ( DataSources source ) : void
source Adf.Core.Data.DataSources The used to get the data source name.
return void

Rollback() public method

Rolls back a transaction from a pending state.
An error occurred while trying to rollback the transaction. The transaction has already been committed or rolled back.-or- The connection is broken.
public Rollback ( DataSources source ) : void
source Adf.Core.Data.DataSources The used to get the data source name.
return void

SetConnection() protected static method

Adds a connection to the connection list.
protected static SetConnection ( DataSources dataSource, IDbConnection connection ) : void
dataSource Adf.Core.Data.DataSources The data source that is used to indicate the connection.
connection IDbConnection The connection to set.
return void

SetTransaction() public static method

Add a transaction for a specific database to the transactions list.
public static SetTransaction ( DataSources source, IDbTransaction transaction ) : void
source Adf.Core.Data.DataSources The used to get the data source name.
transaction IDbTransaction The represents a transaction to be performed at a data source.
return void

SetUpAdapter() public method

Provides information to setup the data adapter by the connection of System.Data.IDbConnection.
public SetUpAdapter ( DataSources datasource, IDbConnection connection, IAdfQuery query ) : IDbDataAdapter
datasource Adf.Core.Data.DataSources
connection IDbConnection The represents an open connection to a data source.
query IAdfQuery The whose SQL information is to be retrieved.
return IDbDataAdapter

StartTransaction() public method

Provides information to start a transaction to be performed at a data source.
An error occurred while trying to start the transaction.
public StartTransaction ( DataSources source ) : IDbTransaction
source Adf.Core.Data.DataSources The used to get the data source name.
return IDbTransaction

Update() public method

Updates the selected rows from the dataset.
public Update ( IDbDataAdapter adapter ) : int
adapter IDbDataAdapter The dataadapter to use.
return int