The Mimer Provider Manager promotes the writing of portable applications. However, there may be times when a programmer would like to use provider specific features. The Mimer Provider Manager supports this by allowing the application to retrieve the underlying provider's object instance.
An advantage with this approach is that the programmer always knows when he/she is using proprietary features. When using providers directly, it is easy to use proprietary functionality without being aware of this. The documentation for providers in general do not mark features as being proprietary.
For each class that has a corresponding provider class there is a native method that returns the underlying object. The native method is named with the class name as a suffix. So the MpmTransaction class has a function called NativeTransaction, and the MpmCommand class has a function called NativeCommand and so on.
Suppose the application wants to use savepoints when using SQL Server, the code would look like this:
using Mimer.Mpm.Data;
using Mimer.Mpm.Data.Interfaces;
:
:
MpmConnect connect = new MpmConnect("Data Source Name=AdoSource");
MpmTransaction transaction = connect.BeginTransaction();
:
:
MpmDataSourceDescriptor dataSource = connect.DataSourceDescriptor;
if (dataSource.DbmsType == MpmDbmsTypes.SqlServer) {
//
// SQLServer specific actions
//
SqlTransaction sqltransaction = (SqlTransaction) transaction.NativeTransaction;
sqltransaction.Save("SavepointName");
}
Please note that the property DataSourceDescriptor on the MpmConnection object is null if the data source has not been determined yet by setting the ConnectionString property (done in the MpmConnection constructor in the example). In addition, the DBMS Type must have been set to SQL Server when the data source was defined.