public static void SetCurrent(IMessagingScenarioFactory messagingScenarioFactory)
 {
     _messagingScenarioFactory.SetValue(() =>
     {
         _fallbackMessagingScenarioFactory = null;
         return messagingScenarioFactory;
     });
 }
 /// <summary>
 /// Sets the current instance of <see cref="IMessagingScenarioFactory"/> used for operations
 /// of the <see cref="MessagingScenarioFactory"/> class.
 /// </summary>
 /// <param name="messagingScenarioFactory">
 /// The instance of <see cref="IMessagingScenarioFactory"/> to be used for operations of the
 /// <see cref="MessagingScenarioFactory"/> class.
 /// </param>
 public static void SetCurrent(IMessagingScenarioFactory messagingScenarioFactory)
 {
     _messagingScenarioFactory.SetValue(() =>
     {
         _fallbackMessagingScenarioFactory = null;
         return(messagingScenarioFactory);
     });
 }
        private static IMessagingScenarioFactory CreateDefaultMessagingScenarioFactory()
        {
            try
            {
                IMessagingScenarioFactory value;

                return(TryGetFactoryFromConfig(out value) ? value : _fallbackMessagingScenarioFactory ?? ThrowNoMessagingScenarioFactoryFoundException());
            }
            finally
            {
                _fallbackMessagingScenarioFactory = null;
            }
        }
 private static bool TryGetFactoryFromConfig(out IMessagingScenarioFactory factory)
 {
     try
     {
         var rockMessagingConfiguration = (IRockMessagingConfiguration)ConfigurationManager.GetSection("rock.messaging");
         factory = rockMessagingConfiguration.MessagingScenarioFactory;
         return true;
     }
     catch (Exception)
     {
         factory = null;
         return false;
     }
 }
        private static bool TryGetFactoryFromConfig(out IMessagingScenarioFactory factory)
        {
            try
            {
                factory = BuildFactory();

                return(true);
            }
            catch (Exception)
            {
                factory = null;
                return(false);
            }
        }
 private static bool TryGetFactoryFromConfig(out IMessagingScenarioFactory factory)
 {
     try
     {
         var rockMessagingConfiguration = (IRockMessagingConfiguration)ConfigurationManager.GetSection("rock.messaging");
         factory = rockMessagingConfiguration.MessagingScenarioFactory;
         return(true);
     }
     catch (Exception)
     {
         factory = null;
         return(false);
     }
 }
        private static IMessagingScenarioFactory CreateDefaultMessagingScenarioFactory()
        {
            try
            {
                IMessagingScenarioFactory value;

                return
                    TryGetFactoryFromConfig(out value)
                        ? value
                        : _fallbackMessagingScenarioFactory;
            }
            finally
            {
                _fallbackMessagingScenarioFactory = null;
            }
        }
 internal static void SetFallback(IMessagingScenarioFactory messagingScenarioFactory)
 {
     _fallbackMessagingScenarioFactory = messagingScenarioFactory;
 }
 internal static void SetFallback(IMessagingScenarioFactory messagingScenarioFactory)
 {
     _fallbackMessagingScenarioFactory = messagingScenarioFactory;
 }