Link Search Menu Expand Document

StatementBuilderMapper


A mapper class for the IStatementBuilder-based class. The mapping can be made based on the type of the target RDBMS data provider. Please visit the Database Setting for more information.

Methods

Below are the methods available from this class.

  • Add - adds a mapping between the IStatementBuilder and the type of the DbConnection.
  • Clear - clears all the existing mappings of the statement builders.
  • Get - gets the existing mapped IStatementBuilder object based on the type of the DbConnection.
  • Remove - removed the existing mapped IStatementBuilder object based on the type of the DbConnection.

Usability

To add a mapping, simply call the Add() method.

StatementBuilderMapper.Add<SqlConnection>(new OptimizedSqlServerStatementBuilder(), true);

An exception will be thrown if the mapping is already exists and you passed a false value in the force argument.

To get the mapping, use the Get() method.

var statementBuilder = StatementBuilderMapper.Get<SqlConnection>();

To remove the mapping, use the Remove() method.

StatementBuilderMapper.Remove<SqlConnection>();