本文整理汇总了C#中IDbProfiler类的典型用法代码示例。如果您正苦于以下问题:C# IDbProfiler类的具体用法?C# IDbProfiler怎么用?C# IDbProfiler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDbProfiler类属于命名空间,在下文中一共展示了IDbProfiler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SimpleProfiledConnection
/// <summary>
/// Creates a simple profiled connection instance.
/// </summary>
/// <param name="connection">The database connection to wrap</param>
/// <param name="profiler">The profiler to use</param>
public SimpleProfiledConnection(IDbConnection connection, IDbProfiler profiler)
{
_connection = connection;
if (profiler != null)
{
_profiler = profiler;
}
}
示例2: ProfiledDbCommand
public ProfiledDbCommand(DbCommand command, DbConnection connection, IDbProfiler profiler)
{
if (command == null) throw new ArgumentNullException("command");
InternalCommand = command;
_connection = connection;
_profiler = profiler;
}
示例3: ProfiledDbDataReader
/// <summary>
/// Initialises a new instance of the <see cref="ProfiledDbDataReader"/> class.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="connection">The connection.</param>
/// <param name="profiler">The profiler.</param>
public ProfiledDbDataReader(DbDataReader reader, DbConnection connection, IDbProfiler profiler)
{
_reader = reader;
if (profiler != null)
{
_profiler = profiler;
}
}
示例4: ProfiledDbDataAdapter
/// <summary>
/// Initialises a new instance of the <see cref="ProfiledDbDataAdapter"/> class.
/// </summary>
/// <param name="wrappedAdapter">The wrapped adapter.</param>
/// <param name="profiler">The profiler.</param>
public ProfiledDbDataAdapter(IDbDataAdapter wrappedAdapter, IDbProfiler profiler = null)
{
if (wrappedAdapter == null)
{
throw new ArgumentNullException("wrappedAdapter");
}
_adapter = wrappedAdapter;
_profiler = profiler ?? MiniProfiler.Current;
}
示例5: ProfiledDbTransaction
public ProfiledDbTransaction(DbTransaction transaction, ProfiledDbConnection connection, IDbProfiler profiler)
{
if (transaction == null) throw new ArgumentNullException("transaction");
if (connection == null) throw new ArgumentNullException("connection");
InnerTransaction = transaction;
_connection = connection;
_profiler = profiler;
_connectionId = UniqueIdExtensions<DbConnection>.GetUniqueId(connection.InnerConnection).ToInt();
_profiler.TransactionBegan(connection.InnerConnection, NHProfilerContextProvider.GetLoggedDbConnection(this, _connectionId));
}
示例6: ProfiledDbDataReader
public ProfiledDbDataReader(DbDataReader reader, DbConnection connection, IDbProfiler profiler)
{
this.reader = reader;
db = connection;
if (profiler != null)
{
this.profiler = profiler;
}
}
示例7: ProfiledDbConnection
public ProfiledDbConnection(IDbConnection connection, IDbProfiler profiler, bool autoDisposeConnection=true)
{
var hasConn = connection as IHasDbConnection;
if (hasConn != null) connection = hasConn.DbConnection;
var dbConn = connection as DbConnection;
if (dbConn == null)
throw new ArgumentException(connection.GetType().GetOperationName() + " does not inherit DbConnection");
Init(dbConn, profiler, autoDisposeConnection);
}
示例8: SimpleProfiledDataReader
/// <summary>
/// Initialises a new instance of the <see cref="SimpleProfiledDataReader"/> class.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="profiler">The profiler.</param>
public SimpleProfiledDataReader(IDataReader reader, IDbProfiler profiler)
{
if (reader == null) throw new ArgumentNullException("reader");
_reader = reader;
if (profiler != null)
{
_profiler = profiler;
}
}
示例9: ProfiledDbConnection
public ProfiledDbConnection(IDbConnection connection, IDbProfiler profiler)
{
var hasConn = connection as IHasDbConnection;
if (hasConn != null) connection = hasConn.DbConnection;
var dbConn = connection as DbConnection;
if (dbConn == null)
throw new ArgumentException(connection.GetType().Name + " does not inherit DbConnection");
Init(dbConn, profiler);
}
示例10: ProfiledDbConnection
/// <summary>
/// Returns a new <see cref="ProfiledDbConnection"/> that wraps <paramref name="connection"/>,
/// providing query execution profiling. If profiler is null, no profiling will occur.
/// </summary>
/// <param name="connection">Your provider-specific flavor of connection, e.g. SqlConnection, OracleConnection</param>
/// <param name="profiler">The currently started <see cref="MiniProfiler"/> or null.</param>
public ProfiledDbConnection(DbConnection connection, IDbProfiler profiler)
{
if (connection == null) throw new ArgumentNullException("connection");
_conn = connection;
_conn.StateChange += StateChangeHandler;
if (profiler != null)
{
_profiler = profiler;
}
}
示例11: ProfiledDbCommand
public ProfiledDbCommand(DbCommand cmd, DbConnection conn, IDbProfiler profiler)
{
if (cmd == null) throw new ArgumentNullException("cmd");
_cmd = cmd;
_conn = conn;
if (profiler != null)
{
_profiler = profiler;
}
}
示例12: Init
private void Init(DbConnection connection, IDbProfiler profiler, bool autoDisposeConnection)
{
if (connection == null) throw new ArgumentNullException("connection");
this.autoDisposeConnection = autoDisposeConnection;
_conn = connection;
_conn.StateChange += StateChangeHandler;
if (profiler != null)
{
_profiler = profiler;
}
}
示例13: ProfiledSqlClientBatchingBatcher
public ProfiledSqlClientBatchingBatcher(ConnectionManager connectionManager, IInterceptor interceptor)
: base(connectionManager, interceptor)
{
this.batchSize = Factory.Settings.AdoBatchSize;
this.defaultTimeout = PropertiesHelper.GetInt32(global::NHibernate.Cfg.Environment.CommandTimeout, global::NHibernate.Cfg.Environment.Properties, -1);
this.currentBatch = this.CreateConfiguredBatch();
// we always create this, because we need to deal with a scenario in which
// the user change the logging configuration at runtime. Trying to put this
// behind an if(log.IsDebugEnabled) will cause a null reference exception
// at that point.
this.currentBatchCommandsLog = new StringBuilder().AppendLine("Batch commands:");
this.profiler = StackExchange.Profiling.MiniProfiler.Current as IDbProfiler;
}
示例14: ProfiledDbProviderFactory
/// <summary>
/// Initializes a <see cref="ProfiledDbProviderFactory"/>.
/// </summary>
/// <param name="dbProviderFactory">The <see cref="DbProviderFactory"/> to be profiled.</param>
/// <param name="dbProfiler">The <see cref="IDbProfiler"/>.</param>
public ProfiledDbProviderFactory(DbProviderFactory dbProviderFactory, IDbProfiler dbProfiler)
{
if (dbProviderFactory == null)
{
throw new ArgumentNullException("dbProviderFactory");
}
if (dbProfiler == null)
{
throw new ArgumentNullException("dbProfiler");
}
_dbProviderFactory = dbProviderFactory;
_dbProfiler = dbProfiler;
}
示例15: ProfiledDbDataReader
/// <summary>
/// Initializes a <see cref="ProfiledDbDataReader"/>.
/// </summary>
/// <param name="dataReader">The <see cref="IDataReader"/> to be profiled.</param>
/// <param name="dbProfiler">
/// The <see cref="IDbProfiler"/> which profiles the <see cref="IDataReader"/>
/// </param>
public ProfiledDbDataReader(IDataReader dataReader, IDbProfiler dbProfiler)
{
if (dataReader == null)
{
throw new ArgumentNullException("dataReader");
}
if (dbProfiler == null)
{
throw new ArgumentNullException("dbProfiler");
}
_dataReader = dataReader;
_dbDataReader = dataReader as DbDataReader;
_dbProfiler = dbProfiler;
}