/// <summary> /// Adds zero or more URL prefixes. /// </summary> /// <param name="this">The <see cref="WebServerOptions"/> on which this method is called.</param> /// <param name="urlPrefixes">An enumeration of URL prefixes to add.</param> /// <returns><paramref name="this"/> with every non-<see langword="null"/> element /// of <paramref name="urlPrefixes"/> added.</returns> /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception> /// <exception cref="InvalidOperationException">The configuration of <paramref name="this"/> is locked.</exception> /// <exception cref="ArgumentNullException"><paramref name="urlPrefixes"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentException"> /// <para>One or more of the elements of <paramref name="urlPrefixes"/> is the empty string.</para> /// <para>- or -</para> /// <para>One or more of the elements of <paramref name="urlPrefixes"/> is already registered.</para> /// </exception> public static WebServerOptions WithUrlPrefixes(this WebServerOptions @this, IEnumerable <string> urlPrefixes) { foreach (var urlPrefix in Validate.NotNull(nameof(urlPrefixes), urlPrefixes)) { @this.AddUrlPrefix(urlPrefix); } return(@this); }
/// <summary> /// Adds a URL prefix. /// </summary> /// <param name="this">The <see cref="WebServerOptions"/> on which this method is called.</param> /// <param name="urlPrefix">The URL prefix.</param> /// <returns><paramref name="this"/> with <paramref name="urlPrefix"/> added.</returns> /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception> /// <exception cref="InvalidOperationException">The configuration of <paramref name="this"/> is locked.</exception> /// <exception cref="ArgumentNullException"><paramref name="urlPrefix"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentException"> /// <para><paramref name="urlPrefix"/> is the empty string.</para> /// <para>- or -</para> /// <para><paramref name="urlPrefix"/> is already registered.</para> /// </exception> public static WebServerOptions WithUrlPrefix(this WebServerOptions @this, string urlPrefix) { @this.AddUrlPrefix(urlPrefix); return(@this); }