Mimer Provider Manager

Programming considerations

The Mimer Provider Manager works by passing all information through the plugin to the underlying provider (see picture in Architecture section). In some circumstances the Provider Manager does not know which plugin to use. Consider the following C# code:

    MpmCommand command = new MpmCommand("select * from tab1");
    command.CommandTimeout = 10;
    :
    :
    MpmConnection connection = new MpmConnection("Data Source Name=XyzSource");
    command.Connection = connection;

When the MpmCommand constructor executes the Provider Manager does not know which plugin will be used. Eventually a Connection is set on the MpmCommand object. At that point the Provider Manager passes information to the underlying provider. In the above example it would pass CommandText (set in the constructor) and CommandTimeout to the underlying provider.

This may have some implications for the application with regard to error handling. Suppose, in the above example that the underlying provider does not support CommandTimeout. Typically, the underlying provider would throw an exception when the CommandTimeout was set. The Mimer Provider Manager, however, does not know this when the CommandTimeout is set. Instead, the exception will be generated when the Connection property on the MpmCommand object is set.

Whenever the Provider Manager knows which underlying provider to use, it will pass all information directly to the underlying provider. Assuming again that the underlying provider does not support CommandTimeout, the exception will be thrown in the underlined code in the following two examples:

    MpmCommand command = new MpmCommand();
    MpmConnection connection = new MpmConnection("Data Source Name=XyzSource");
    
    command.CommandText = "select * from tab1";
    command.CommandTimeout = 10;
    command.Connection = connection;

In the second example the underlying provider is known when the CommandTimeout is assigned:

    MpmCommand command = new MpmCommand();
    MpmConnection connection = new MpmConnection("Data Source Name=XyzSource");
    
    command.Connection = connection;
    command.CommandText = "select * from tab1";
    command.CommandTimeout = 10;

Depending on how an application handles errors this may, or may not have an effect on the application. But you should be aware that exceptions that are thrown, may originate from earlier actions in the program. If you let the system know upfront which underlying provider to use, error handling will be the same as when accessing the provider directly.