The current code access a non-public DataTable inside the providers factory to wrap the “normal” providers with MiniProfiler wrappers. This can´t be done at Medium Trust.
I tried and I didn´t find any other way to do this automatically. If it is impossible, we can consider a workaround change the connections strings and db factories at web.config.