Beispiel #1
0
        /// <summary>
        ///   It returns the namespace name from a give set of connection string properties.
        /// </summary>
        ///
        /// <param name="connectionString">The connection string to be parsed.</param>
        ///
        /// <returns>The namespace name for a given connection string.</returns>
        ///
        private static string ParseNamespaceName(string connectionString)
        {
            string fqdn = ConnectionStringTokenParser.ParseTokenAndReturnValue(connectionString, "Endpoint");

            if (!string.IsNullOrEmpty(fqdn))
            {
                return(ConnectionStringTokenParser.ParseNamespaceName(fqdn));
            }

            return(null);
        }
 /// <summary>
 ///   Parses a well-formed connection string to extract the shared access key.
 /// </summary>
 /// <param name="connectionString"></param>
 ///
 /// <returns>The fully qualified namespace contained in the connection string if the connection string is well-formed; otherwise, a <see cref="InvalidOperationException" /> is thrown.</returns>
 ///
 private static string ParseSharedAccessKey(string connectionString) =>
 ConnectionStringTokenParser.ParseTokenAndReturnValue(connectionString, "SharedAccessKey");
 /// <summary>
 ///   Parses a well-formed connection string to extract the fully qualified namespace.
 /// </summary>
 ///
 /// <param name="connectionString">The connection string to parse.</param>
 ///
 /// <returns>The fully qualified namespace contained in the connection string if the connection string is well-formed; otherwise, a <see cref="InvalidOperationException" /> is thrown.</returns>
 ///
 private static string ParseFullyQualifiedNamespace(string connectionString) =>
 new Uri(ConnectionStringTokenParser.ParseTokenAndReturnValue(connectionString, "Endpoint")).Host;