DbSettingMapper
A mapper class for the IDbSetting-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 is the list of methods.
Name | Description |
---|---|
Add | Adds a mapping between the IDbSetting and the type of the DbConnection . |
Clear | Clears all the existing mappings of the database settings. |
Get | Gets the existing mapped IDbSetting object based on the type of the DbConnection . |
Remove | Removes the existing mapped IDbSetting object based on the type of the DbConnection . |
Usability
To add a mapping, simply call the Add()
method.
DbSettingMapper.Add<SqlConnection>(new MyCustomSqlServerDbSetting(), true);
An exception will be thrown if the mapping is already exists and you passed a
false
value in theforce
argument.
To get the mapping, use the Get()
method.
var dbSetting = DbSettingMapper.Get<SqlConnection>();
To remove the mapping, use the Remove()
method.
DbSettingMapper.Remove<SqlConnection>();