/// <summary> /// Applies an <see cref="IQueueNamingConvention"/> to a type <see cref="T"/> and returns the result, with an optional override. /// </summary> /// <param name="namingConvention">An <see cref="IQueueNamingConvention"/> to apply to the T</param> /// <param name="overrideQueueName">An override that will be returned instead of the naming convention /// if the override is not null or whitespace.</param> /// <typeparam name="T">A type from which a queue name will be determined using the supplied <see cref="IQueueNamingConvention"/>.</typeparam> /// <returns>A string that is either the override if supplied, or the <see cref="IQueueNamingConvention"/> applied to the <see cref="T"/></returns> /// <exception cref="ArgumentNullException"> /// <paramref name="namingConvention"/> is <see langword="null"/>. /// </exception> public static string Apply <T>(this IQueueNamingConvention namingConvention, string overrideQueueName) { if (namingConvention == null) { throw new ArgumentNullException(nameof(namingConvention)); } return(string.IsNullOrWhiteSpace(overrideQueueName) ? namingConvention.QueueName <T>() : overrideQueueName); }
/// <summary> /// Creates a <see cref="Uri"/> for a queue within the current account with the name from <see cref="T"/> by using the queue naming convention. /// </summary> /// <typeparam name="T">Message type</typeparam> /// <returns>The <see cref="Uri"/> for this message type.</returns> public Uri GetQueueUriByConvention <T>() { return(GetQueueUri(_queueNamingConvention.QueueName <T>())); }