本文整理汇总了C#中SqlConnection.GetInternalConnection方法的典型用法代码示例。如果您正苦于以下问题:C# SqlConnection.GetInternalConnection方法的具体用法?C# SqlConnection.GetInternalConnection怎么用?C# SqlConnection.GetInternalConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlConnection
的用法示例。
在下文中一共展示了SqlConnection.GetInternalConnection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsInternalConnectionOf
/// <summary>
/// Is this internal connection associated with the given SqlConnection
/// </summary>
/// <param name="connection"></param>
/// <returns></returns>
public bool IsInternalConnectionOf(SqlConnection connection)
{
if (connection == null)
throw new ArgumentNullException("connection");
return (_internalConnection == connection.GetInternalConnection());
}
示例2: ConnectionPoolWrapper
/// <summary>
/// Finds the connection pool for the given connection
/// NOTE: This only works for connections that are currently open
/// </summary>
/// <param name="connection"></param>
public ConnectionPoolWrapper(SqlConnection connection)
{
if (connection == null)
throw new ArgumentNullException("connection");
_connectionPool = ConnectionHelper.GetConnectionPool(connection.GetInternalConnection());
ConnectionString = connection.ConnectionString;
if (_connectionPool == null)
throw new ArgumentException("Provided connection does not have a connection pool", "connection");
}
示例3: InternalConnectionWrapper
/// <summary>
/// Gets the internal connection associated with the given SqlConnection
/// </summary>
/// <param name="connection">Live outer connection to grab the inner connection from</param>
/// <param name="supportKillByTSql">If true then we will query the server for this connection's SPID details (to be used in the KillConnectionByTSql method)</param>
public InternalConnectionWrapper(SqlConnection connection, bool supportKillByTSql = false)
{
if (connection == null)
throw new ArgumentNullException("connection");
_internalConnection = connection.GetInternalConnection();
ConnectionString = connection.ConnectionString;
if (supportKillByTSql)
{
// Save the SPID for later use
using (SqlCommand command = new SqlCommand("SELECT @@SPID", connection))
{
_spid = command.ExecuteScalar();
}
}
}
示例4: ContainsConnection
/// <summary>
/// Checks if the SqlConnection specified has an internal connection that belongs to this pool
/// </summary>
/// <param name="connection"></param>
/// <returns></returns>
public bool ContainsConnection(SqlConnection connection)
{
if (connection == null)
throw new ArgumentNullException("connection");
return (_connectionPool == ConnectionHelper.GetConnectionPool(connection.GetInternalConnection()));
}