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


C# SqlConnection.GetConversationGroupsCount方法代码示例

本文整理汇总了C#中System.Data.SqlClient.SqlConnection.GetConversationGroupsCount方法的典型用法代码示例。如果您正苦于以下问题:C# SqlConnection.GetConversationGroupsCount方法的具体用法?C# SqlConnection.GetConversationGroupsCount怎么用?C# SqlConnection.GetConversationGroupsCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.SqlClient.SqlConnection的用法示例。


在下文中一共展示了SqlConnection.GetConversationGroupsCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResourcesReleasabilityTest

        public void ResourcesReleasabilityTest(int changesCount)
        {
            using (var sqlConnection = new SqlConnection(TEST_CONNECTION_STRING))
            {
                sqlConnection.Open();

                int sqlConversationEndpointsCount = sqlConnection.GetUnclosedConversationEndpointsCount();
                int sqlConversationGroupsCount = sqlConnection.GetConversationGroupsCount();
                int sqlServiceQueuesCount = sqlConnection.GetServiceQueuesCount();
                int sqlServicesCount = sqlConnection.GetServicesCount();

                NotificationTest(changesCount, false);

                // Microsoft SqlDependency REMOVES queue and service after use.
                Assert.AreEqual(sqlServicesCount, sqlConnection.GetServicesCount());
                Assert.AreEqual(
                    sqlServiceQueuesCount,
                    sqlConnection.GetServiceQueuesCount());

                // Microsoft SqlDependency KEEPS conversation group and endpoint in DB after use.
                // This behavior leads to GIANT memory leaks in SQL Server.
                Assert.AreNotEqual(
                    sqlConversationGroupsCount,
                    sqlConnection.GetConversationGroupsCount());
                Assert.AreNotEqual(
                    sqlConversationEndpointsCount,
                    sqlConnection.GetUnclosedConversationEndpointsCount());
            }
        }
开发者ID:tridipkolkata,项目名称:ServiceBrokerListener,代码行数:29,代码来源:SqlDependencyTest.cs

示例2: ResourcesReleasabilityTest

        public void ResourcesReleasabilityTest(int changesCount)
        {
            using (var sqlConnection = new SqlConnection(ADMIN_TEST_CONNECTION_STRING))
            {
                sqlConnection.Open();

                int sqlConversationEndpointsCount = sqlConnection.GetUnclosedConversationEndpointsCount();
                int sqlConversationGroupsCount = sqlConnection.GetConversationGroupsCount();
                int sqlServiceQueuesCount = sqlConnection.GetServiceQueuesCount();
                int sqlServicesCount = sqlConnection.GetServicesCount();
                int sqlTriggersCount = sqlConnection.GetTriggersCount();
                int sqlProceduresCount = sqlConnection.GetProceduresCount();

                using (SqlDependencyEx sqlDependency = new SqlDependencyEx(
                            TEST_CONNECTION_STRING,
                            TEST_DATABASE_NAME,
                            TEST_TABLE_NAME, "temp"))
                {
                    sqlDependency.Start();

                    // Make sure we've created one queue, sevice, trigger and two procedures.
                    Assert.AreEqual(sqlServicesCount + 1, sqlConnection.GetServicesCount());
                    Assert.AreEqual(
                        sqlServiceQueuesCount + 1,
                        sqlConnection.GetServiceQueuesCount());
                    Assert.AreEqual(sqlTriggersCount + 1, sqlConnection.GetTriggersCount());
                    Assert.AreEqual(sqlProceduresCount + 2, sqlConnection.GetProceduresCount());

                    MakeTableInsertDeleteChanges(changesCount);

                    // Wait a little bit to process all changes.
                    Thread.Sleep(1000);
                }

                // Make sure we've released all resources.
                Assert.AreEqual(sqlServicesCount, sqlConnection.GetServicesCount());
                Assert.AreEqual(
                    sqlConversationGroupsCount,
                    sqlConnection.GetConversationGroupsCount());
                Assert.AreEqual(
                    sqlServiceQueuesCount,
                    sqlConnection.GetServiceQueuesCount());
                Assert.AreEqual(
                    sqlConversationEndpointsCount,
                    sqlConnection.GetUnclosedConversationEndpointsCount());
                Assert.AreEqual(sqlTriggersCount, sqlConnection.GetTriggersCount());
                Assert.AreEqual(sqlProceduresCount, sqlConnection.GetProceduresCount());
            }
        }
开发者ID:tridipkolkata,项目名称:ServiceBrokerListener,代码行数:49,代码来源:SqlDependencyExTest.cs


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