Enterprise Library Data Access Application Block
7.0-rc1
The Data Access Application Block abstracts the actual database you are using, and exposes a collection of methods that make it easy to access that database and to perform common tasks.
|
Base class for Data Accessors that execute a DbCommand. More...
Public Member Functions | |
override IEnumerable< TResult > | EndExecute (IAsyncResult asyncResult) |
Complete an operation started by DataAccessor<TResult>.BeginExecute. More... | |
abstract IEnumerable< TResult > | Execute (params object[] parameterValues) |
Execute the database operation synchronously, returning the IEnumerable<TResult> sequence containing the resulting objects. More... | |
abstract IAsyncResult | BeginExecute (AsyncCallback callback, object state, params object[] parameterValues) |
Begin executing the database object asynchronously, returning a IAsyncResult object that can be used to retrieve the result set after the operation completes. More... | |
Protected Member Functions | |
CommandAccessor (Database database, IRowMapper< TResult > rowMapper) | |
Initialized the CommandAccessor<TResult> with a database instance and a Row Mapper. More... | |
CommandAccessor (Database database, IResultSetMapper< TResult > resultSetMapper) | |
Initialized the CommandAccessor<TResult> with a database instance and a Row Mapper. More... | |
IEnumerable< TResult > | Execute (DbCommand command) |
Executes the command and returns an enumerable of TResult . The enumerable returned by this method uses deferred loading to return the results. More... | |
IAsyncResult | BeginExecute (DbCommand command, IParameterMapper parameterMapper, AsyncCallback callback, object state, object[] parameterValues) |
Helper method to kick off execution of an asynchronous database operation. This method handles the boilerplate of setting up the parameters and invoking the operation on the database with the right options. More... | |
void | GuardAsyncAllowed () |
Checks if the current Database object supports asynchronous operations, and throws InvalidOperationException if not. More... | |
Properties | |
Database | Database [get] |
The database object this accessor is wrapped around. More... | |
Base class for Data Accessors that execute a DbCommand.
TResult | The element type this accessor will return. |
|
protected |
Initialized the CommandAccessor<TResult> with a database instance and a Row Mapper.
database | The Database used to execute the DbCommand. |
rowMapper | The IRowMapper<TResult> that will be used to convert the returned data to clr type TResult . |
ArgumentNullException | rowMapper is null. |
|
protected |
Initialized the CommandAccessor<TResult> with a database instance and a Row Mapper.
database | The Database used to execute the DbCommand. |
resultSetMapper | The IResultSetMapper<TResult> that will be used to convert the returned set to an enumerable of clr type TResult . |
ArgumentNullException | database or resultSetMapper are null. |
|
pure virtualinherited |
Begin executing the database object asynchronously, returning a IAsyncResult object that can be used to retrieve the result set after the operation completes.
callback | Callback to execute when the operation's results are available. May be null if you don't wish to use a callback. |
state | Extra information that will be passed to the callback. May be null. |
parameterValues | Parameters to pass to the database. |
This operation will throw if the underlying Database object does not support asynchronous operation.
InvalidOperationException | The underlying database does not support asynchronous operation. |
Implemented in Microsoft.Practices.EnterpriseLibrary.Data.SqlStringAccessor< TResult >, and Microsoft.Practices.EnterpriseLibrary.Data.SprocAccessor< TResult >.
|
protected |
Helper method to kick off execution of an asynchronous database operation. This method handles the boilerplate of setting up the parameters and invoking the operation on the database with the right options.
command | The DbCommand to execute. |
parameterMapper | The IParameterMapper to use to set the parameter values. |
callback | Callback to execute when the operation's result is available. |
state | State to pass to the callback. |
parameterValues | Input parameter values. |
|
virtual |
Complete an operation started by DataAccessor<TResult>.BeginExecute.
Implements Microsoft.Practices.EnterpriseLibrary.Data.DataAccessor< TResult >.
|
protected |
Executes the command and returns an enumerable of TResult . The enumerable returned by this method uses deferred loading to return the results.
command | The command that will be executed. |
|
pure virtualinherited |
Execute the database operation synchronously, returning the IEnumerable<TResult> sequence containing the resulting objects.
parameterValues | Parameters to pass to the database. |
Implemented in Microsoft.Practices.EnterpriseLibrary.Data.SqlStringAccessor< TResult >, and Microsoft.Practices.EnterpriseLibrary.Data.SprocAccessor< TResult >.
|
protected |
Checks if the current Database object supports asynchronous operations, and throws InvalidOperationException if not.
InvalidOperationException | The database does not support asynchronous operations. |
|
getprotected |
The database object this accessor is wrapped around.