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.
|
Represents a call to the database using SQL that will return an enumerable of TResult . More...
Public Member Functions | |
SqlStringAccessor (Database database, string sqlString, IRowMapper< TResult > rowMapper) | |
Creates a new instance of SqlStringAccessor<TResult> that works for a specific database and uses rowMapper to convert the returned rows to CLR type TResult . More... | |
SqlStringAccessor (Database database, string sqlString, IResultSetMapper< TResult > resultSetMapper) | |
Creates a new instance of SqlStringAccessor<TResult> that works for a specific database and uses resultSetMapper to convert the returned set to an enumerable of CLR type TResult . More... | |
SqlStringAccessor (Database database, string sqlString, IParameterMapper parameterMapper, IRowMapper< TResult > rowMapper) | |
Creates a new instance of SqlStringAccessor<TResult> that works for a specific database and uses rowMapper to convert the returned rows to CLR type TResult . The parameterMapper will be used to interpret the parameters passed to the Execute method. More... | |
SqlStringAccessor (Database database, string sqlString, IParameterMapper parameterMapper, IResultSetMapper< TResult > resultSetMapper) | |
Creates a new instance of SqlStringAccessor<TResult> that works for a specific database and uses resultSetMapper to convert the returned set to an enumerable of CLR type TResult . The parameterMapper will be used to interpret the parameters passed to the Execute method. More... | |
override IEnumerable< TResult > | Execute (params object[] parameterValues) |
Executes the SQL query and returns an enumerable of TResult . The enumerable returned by this method uses deferred loading to return the results. More... | |
override IAsyncResult | BeginExecute (AsyncCallback callback, object state, params object[] parameterValues) |
Begin executing the SQL query asynchronously. Only supported if the underlying Database object supports asynchronous operations. More... | |
override IEnumerable< TResult > | EndExecute (IAsyncResult asyncResult) |
Complete an operation started by DataAccessor<TResult>.BeginExecute. More... | |
Protected Member Functions | |
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... | |
Represents a call to the database using SQL that will return an enumerable of TResult .
TResult | The element type that will be used to consume the result set. |
Microsoft.Practices.EnterpriseLibrary.Data.SqlStringAccessor< TResult >.SqlStringAccessor | ( | Database | database, |
string | sqlString, | ||
IRowMapper< TResult > | rowMapper | ||
) |
Creates a new instance of SqlStringAccessor<TResult> that works for a specific database and uses rowMapper to convert the returned rows to CLR type TResult .
database | The Database used to execute the SQL. |
sqlString | The SQL that will be executed. |
rowMapper | The IRowMapper<TResult> that will be used to convert the returned data to clr type TResult . |
Microsoft.Practices.EnterpriseLibrary.Data.SqlStringAccessor< TResult >.SqlStringAccessor | ( | Database | database, |
string | sqlString, | ||
IResultSetMapper< TResult > | resultSetMapper | ||
) |
Creates a new instance of SqlStringAccessor<TResult> that works for a specific database and uses resultSetMapper to convert the returned set to an enumerable of CLR type TResult .
database | The Database used to execute the SQL. |
sqlString | The SQL that will be executed. |
resultSetMapper | The IResultSetMapper<TResult> that will be used to convert the returned set to an enumerable of clr type TResult . |
Microsoft.Practices.EnterpriseLibrary.Data.SqlStringAccessor< TResult >.SqlStringAccessor | ( | Database | database, |
string | sqlString, | ||
IParameterMapper | parameterMapper, | ||
IRowMapper< TResult > | rowMapper | ||
) |
Creates a new instance of SqlStringAccessor<TResult> that works for a specific database and uses rowMapper to convert the returned rows to CLR type TResult . The parameterMapper will be used to interpret the parameters passed to the Execute method.
database | The Database used to execute the SQL. |
sqlString | The SQL that will be executed. |
parameterMapper | The IParameterMapper that will be used to interpret the parameters passed to the Execute method. |
rowMapper | The IRowMapper<TResult> that will be used to convert the returned data to clr type TResult . |
ArgumentException | sqlString is null or empty. |
ArgumentNullException | parameterMapper is null. |
Microsoft.Practices.EnterpriseLibrary.Data.SqlStringAccessor< TResult >.SqlStringAccessor | ( | Database | database, |
string | sqlString, | ||
IParameterMapper | parameterMapper, | ||
IResultSetMapper< TResult > | resultSetMapper | ||
) |
Creates a new instance of SqlStringAccessor<TResult> that works for a specific database and uses resultSetMapper to convert the returned set to an enumerable of CLR type TResult . The parameterMapper will be used to interpret the parameters passed to the Execute method.
database | The Database used to execute the SQL. |
sqlString | The SQL that will be executed. |
parameterMapper | The IParameterMapper that will be used to interpret the parameters passed to the Execute method. |
resultSetMapper | The IResultSetMapper<TResult> that will be used to convert the returned set to an enumerable of clr type TResult . |
ArgumentException | sqlString is null or empty. |
ArgumentNullException | parameterMapper is null. |
|
virtual |
Begin executing the SQL query asynchronously. Only supported if the underlying Database object supports asynchronous operations.
callback | Asynchronous callback to execute when the result of the query is available. May be null if no callback is desired. |
state | Extra arbitrary state information to pass to the callback. May be null. |
parameterValues | Parameters to pass to the sql query. |
Implements Microsoft.Practices.EnterpriseLibrary.Data.DataAccessor< TResult >.
|
protectedinherited |
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. |
|
virtualinherited |
Complete an operation started by DataAccessor<TResult>.BeginExecute.
Implements Microsoft.Practices.EnterpriseLibrary.Data.DataAccessor< TResult >.
|
protectedinherited |
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. |
|
virtual |
Executes the SQL query and returns an enumerable of TResult . The enumerable returned by this method uses deferred loading to return the results.
parameterValues | Values that will be interpret by an IParameterMapper and function as parameters to the Transact SQL query. |
Implements Microsoft.Practices.EnterpriseLibrary.Data.DataAccessor< TResult >.
|
protectedinherited |
Checks if the current Database object supports asynchronous operations, and throws InvalidOperationException if not.
InvalidOperationException | The database does not support asynchronous operations. |
|
getprotectedinherited |
The database object this accessor is wrapped around.