/// <summary> /// Applies an <see cref="ITopicNamingConvention"/> to a type <see cref="T"/> and returns the result, with an optional override. /// </summary> /// <param name="namingConvention">An <see cref="ITopicNamingConvention"/> to apply to the T</param> /// <param name="overrideTopicName">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 topic name will be determined using the supplied <see cref="ITopicNamingConvention"/>.</typeparam> /// <returns>A string that is either the override if supplied, or the <see cref="ITopicNamingConvention"/> applied to the <see cref="T"/></returns> /// <exception cref="ArgumentNullException"> /// <paramref name="namingConvention"/> is <see langword="null"/>. /// </exception> public static string Apply <T>(this ITopicNamingConvention namingConvention, string overrideTopicName) { if (namingConvention == null) { throw new ArgumentNullException(nameof(namingConvention)); } return(string.IsNullOrWhiteSpace(overrideTopicName) ? namingConvention.TopicName <T>() : overrideTopicName); }
/// <summary> /// Creates an ARN for a topic within the current account with the name from <see cref="T"/> by using the topic naming convention. /// </summary> /// <typeparam name="T">Message type</typeparam> /// <returns>The <see cref="TopicAddress"/> for this message type.</returns> public string GetTopicArnByConvention <T>() { return(GetTopicArn(_topicNamingConvention.TopicName <T>())); }