Class DataAccessCore Class

Namespace :CA.Blocks.DataAccess

Assembly : CA.Blocks.DataAccess.dll

This class provides the abstract implementation for the Code Associate Data Access Block. The Abstract implementation is build upon utilizing common System.Data methods and interfacing out the Specific DBCommand using the IDbCommand interface. In doing this all specializations built on top of this class will behave in the same manor. This class is abstract and cannot be created.

Inheritance :

New Class Constructors

Protected MethodDataAccessCore(CA.Blocks.DataAccess.DI.IDataAccessConfig, CA.Blocks.DataAccess.Translator.DbRowToObject.Interfaces.IDbRowTranslatorProvider) This is a protected constructor which must be called by the inheriting class, it will use config.Resolver to resolve the connectionStringKey to a valid connection string

Method Methods

Protected Method WrapUp(System.Data.IDbConnection, System.Boolean)

The WrapUp procedure is called when completing a database call. It will establish whether or not to close the connection pending the variable closeConnection which would have been passed back from the PrepCommand. The PrepCommand and WrapUp work in tandem when executing commands though this common class.

Abstract Method TraceDbStatement(System.Data.IDbCommand)
Abstract Method TraceDbError(System.Data.IDbCommand, System.Data.Common.DbException)
Abstract Method TraceGenralError(System.Data.IDbCommand, System.Exception)
Abstract Method GetDataAdapter(System.Data.IDbCommand)
Abstract Method PrepCommand(System.Data.IDbCommand)

The Prep Command is abstract method that must be implemented by the providers. The method will create the the provider specific connection setting the connection string, Opening the connection, set any context on the connection the assign the connection to the command for execution, it will also and indicate to the blocks if the connection should be closed on complete execution. In most cases it is best to close the connection, at the provider will managed the connection pool.

Abstract Method IsTransientError(System.Data.Common.DbException)
Protected Method ExecuteNonQuery(System.Data.IDbCommand)

Will execute a value sql query that does not return any results back to the client. This is typically Data modification statements such as insert , update or delete or catalog operations such as creating tables, indexes etc

Protected Method ExecuteDataSet(System.Data.IDbCommand)

Executes the command into a new Dataset

Protected Method ExecuteDataSet(System.Data.IDbCommand, System.Data.DataSet, System.String)
Protected Method ExecuteDataTable(System.Data.IDbCommand)
Protected Method ExecuteDataRow(System.Data.IDbCommand)
Protected Method ExecuteScalar(System.Data.IDbCommand)
Protected Method ExecuteScalarAs(System.Data.IDbCommand)
Protected Method ExecuteScalarWithConvertAs(System.Data.IDbCommand)
Protected Method ExecuteScalarAsString(System.Data.IDbCommand, System.String)

This will execute the cmd to a ScalarValue and convert the ScalarValue to string value, There is a overload top control the value of the null passed back.

Protected Method ExecuteScalarAsInt(System.Data.IDbCommand, System.Int32)
Protected Method ExecuteScalarAsShort(System.Data.IDbCommand, System.Int16)
Protected Method ExecuteScalarAsByte(System.Data.IDbCommand, System.Byte)
Protected Method ExecuteScalarAsLong(System.Data.IDbCommand, System.Int64)
Protected Method ExecuteScalarAsGuid(System.Data.IDbCommand, System.Guid)
Protected Method ExecuteScalarAsGuid(System.Data.IDbCommand)
Protected Method ExecuteReader(System.Data.IDbCommand)
Protected Method ExecuteObject(System.Data.IDbCommand)
Protected Method ExecuteObjectList(System.Data.IDbCommand)
Protected Method ExecuteTo(System.Data.IDbCommand)
Protected Method ExecuteToListOf(System.Data.IDbCommand)
Protected Method TranslateToListOf(System.Data.DataTable)

Property Properties

Protected PropertyConnectionStringSystem.String