Created
June 3, 2014 08:18
-
-
Save krk/e588d0c72c3386959d5e to your computer and use it in GitHub Desktop.
MiniProfiler DbDataAdapter DbCommand type mismatch exception workaround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProfiledDbProviderFactoryAlwaysProfiled : ProfiledDbProviderFactory | |
{ | |
private readonly DbProviderFactory _tail; | |
public ProfiledDbProviderFactoryAlwaysProfiled(DbProviderFactory tail) | |
: base(tail) | |
{ | |
_tail = tail; | |
} | |
public override DbCommand CreateCommand() | |
{ | |
DbCommand command = this._tail.CreateCommand(); | |
return new ProfiledDbCommand(command, null, MiniProfiler.Current); | |
} | |
public override DbConnection CreateConnection() | |
{ | |
DbConnection connection = this._tail.CreateConnection(); | |
return new ProfiledDbConnection(connection, MiniProfiler.Current); | |
} | |
public override DbDataAdapter CreateDataAdapter() | |
{ | |
DbDataAdapter dataAdapter = this._tail.CreateDataAdapter(); | |
return new ProfiledDbDataAdapter(dataAdapter, MiniProfiler.Current); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment