Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            #region Create the required objects

            LoggingConfiguration loggingConfiguration = BuildLoggingConfig();
            LogWriter            logWriter            = new LogWriter(loggingConfiguration);
            //Logger.SetLogWriter(logWriter, false);

            // Create the default ExceptionManager object from the configuration settings.
            //ExceptionPolicyFactory policyFactory = new ExceptionPolicyFactory();
            //exManager = policyFactory.CreateManager();

            // Create the default ExceptionManager object programatically
            exManager = BuildExceptionManagerConfig(logWriter);

            // Create an ExceptionPolicy to illustrate the static HandleException method
            ExceptionPolicy.SetExceptionManager(exManager);


            #endregion

            #region Main menu routines

            var app = new MenuDrivenApplication("Exception Handling Block Developer's Guide Examples",
                                                DefaultNoExceptionShielding,
                                                WithWrapExceptionShielding,
                                                WithWrapExceptionShieldingStatic,
                                                WithReplaceExceptionShielding,
                                                LoggingTheException,
                                                ShieldingExceptionsInWCF,
                                                ExecutingCodeAroundException,
                                                ProvidingAdminAssistance);

            app.Run();

            #endregion
        }
Ejemplo n.º 2
0
    static void Main(string[] args)
    {
      #region Create the required objects

      LoggingConfiguration loggingConfiguration = BuildLoggingConfig();
      LogWriter logWriter = new LogWriter(loggingConfiguration);
      //Logger.SetLogWriter(logWriter, false);

      // Create the default ExceptionManager object from the configuration settings.
      //ExceptionPolicyFactory policyFactory = new ExceptionPolicyFactory();
      //exManager = policyFactory.CreateManager();

      // Create the default ExceptionManager object programatically
      exManager = BuildExceptionManagerConfig(logWriter);

      // Create an ExceptionPolicy to illustrate the static HandleException method
      ExceptionPolicy.SetExceptionManager(exManager);


      #endregion

      #region Main menu routines

      var app = new MenuDrivenApplication("Exception Handling Block Developer's Guide Examples",
          DefaultNoExceptionShielding,
          WithWrapExceptionShielding,
          WithWrapExceptionShieldingStatic,
          WithReplaceExceptionShielding,
          LoggingTheException,
          ShieldingExceptionsInWCF,
          ExecutingCodeAroundException,
          ProvidingAdminAssistance);

      app.Run();

      #endregion
    }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            #region Resolve the required object

            // Resolve the default ExceptionManager object from the container.
            exManager = EnterpriseLibraryContainer.Current.GetInstance<ExceptionManager>();

            #endregion

            #region Main menu routines

            var app = new MenuDrivenApplication("Exception Handling Block Developer's Guide Examples",
                DefaultNoExceptionShielding,
                WithWrapExceptionShielding,
                WithReplaceExceptionShielding,
                LoggingTheException,
                ShieldingExceptionsInWCF,
                ExecutingCodeAroundException,
                ProvidingAdminAssistance);

            app.Run();

            #endregion
        }