Microsoft.WindowsAzure.Commands.Utilities.ServiceBus.ServiceBusClientExtensions.CreateNamespace C# (CSharp) Method

CreateNamespace() public method

public CreateNamespace ( string name, string location, NamespaceType type, bool createACSNamespace = false ) : Microsoft.WindowsAzure.Commands.Utilities.ServiceBus.ExtendedServiceBusNamespace
name string
location string
type NamespaceType
createACSNamespace bool
return Microsoft.WindowsAzure.Commands.Utilities.ServiceBus.ExtendedServiceBusNamespace
        public virtual ExtendedServiceBusNamespace CreateNamespace(string name, string location, NamespaceType type, bool createACSNamespace = false)
        {
            location = string.IsNullOrEmpty(location) ? GetDefaultLocation() : location;

            if (!Regex.IsMatch(name, ServiceBusConstants.NamespaceNamePattern))
            {
                throw new ArgumentException(string.Format(Resources.InvalidNamespaceName, name), "Name");
            }

            ServiceBusClient.Namespaces.CreateNamespace(name, new ServiceBusNamespaceCreateParameters { Region = location, CreateACSNamespace = createACSNamespace, NamespaceType = type});

            // Wait until the namespace is activated
            while (!IsActiveNamespace(name))
            {
                Thread.Sleep(SleepDuration);
            }

            return GetExtendedServiceBusNamespace(name);
        }