当前位置: 首页>>代码示例>>C#>>正文


C# SqlConnection.GetInternalConnection方法代码示例

本文整理汇总了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());
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:12,代码来源:InternalConnectionWrapper.cs

示例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");
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:16,代码来源:ConnectionPoolWrapper.cs

示例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();
                }
            }
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:22,代码来源:InternalConnectionWrapper.cs

示例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()));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:12,代码来源:ConnectionPoolWrapper.cs


注:本文中的SqlConnection.GetInternalConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。