Exemple #1
0
 /// <summary>
 /// <para>Configures the global default <see cref="IHerculesSink"/> with given instance, which will be returned by all subsequent <see cref="Get"/> calls.</para>
 /// <para>By default, this method fails when trying to overwrite a previously configured instance. This behaviour can be changed with <paramref name="canOverwrite"/> parameter.</para>
 /// </summary>
 /// <exception cref="ArgumentNullException">Provided instance was <c>null</c>.</exception>
 /// <exception cref="InvalidOperationException">Attempted to overwrite previously configured instance.</exception>
 public static void Configure([NotNull] IHerculesSink herculesSink, bool canOverwrite = false)
 {
     if (!TryConfigure(herculesSink, canOverwrite))
     {
         throw new InvalidOperationException($"Can't overwrite existing configured Hercules sink implementation of type '{instance.GetType().Name}'.");
     }
 }