示例#1
0
        public async Task CreateQueuesForEndpoint()
        {
            var connectionString = @"Data Source=.\SqlExpress;Database=samples;Integrated Security=True";

            using (var sqlConnection = new SqlConnection(connectionString))
            {
                await sqlConnection.OpenAsync()
                .ConfigureAwait(false);

                await CreateEndpointQueues.CreateQueuesForEndpoint(
                    connection : sqlConnection,
                    schema : "dbo",
                    endpointName : "myendpoint")
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    connection : sqlConnection,
                    schema : "dbo",
                    queueName : "error")
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    connection : sqlConnection,
                    schema : "dbo",
                    queueName : "audit")
                .ConfigureAwait(false);
            }
        }
示例#2
0
        public void CreateQueuesForEndpoint()
        {
            var connectionString = @"Data Source=.\SqlExpress;Database=Snippets.SqlTransport;Integrated Security=True";

            SqlHelper.EnsureDatabaseExists(connectionString);
            using (var sqlConnection = new SqlConnection(connectionString))
            {
                sqlConnection.Open();
                CreateEndpointQueues.CreateQueuesForEndpoint(
                    connection: sqlConnection,
                    schema: "dbo",
                    endpointName: "myendpoint");

                QueueCreationUtils.CreateQueue(
                    connection: sqlConnection,
                    schema: "dbo",
                    queueName: "error");

                QueueCreationUtils.CreateQueue(
                    connection: sqlConnection,
                    schema: "dbo",
                    queueName: "audit");
            }
        }