Beispiel #1
0
        public override void Initialize(ConfigurationView configurationView)
        {
            ExceptionHandlingConfigurationView exceptionHandlingConfigurationView = (ExceptionHandlingConfigurationView)configurationView;
            CustomHandlerData data = (CustomHandlerData)exceptionHandlingConfigurationView.GetExceptionHandlerData(CurrentPolicyName, CurrentExceptionTypeName, ConfigurationName);

            if (data.Attributes["TestProperty"] != null)
            {
                testProperty = data.Attributes["TestProperty"];
            }
        }
        private void SetupEnvironment()
        {
            ExceptionHandlerData exceptionHandlerData = exceptionHandlingConfigurationView.GetExceptionHandlerData(CurrentPolicyName, CurrentExceptionTypeName, ConfigurationName);

            ArgumentValidation.CheckExpectedType(exceptionHandlerData, typeof(LoggingExceptionHandlerData));

            InitProperties((LoggingExceptionHandlerData)exceptionHandlerData);

            Type formatterType = Type.GetType(formatterTypeName, true);

            Type[] types = new Type[] { typeof(TextWriter), typeof(Exception) };
            constructor = formatterType.GetConstructor(types);
            if (constructor == null)
            {
                throw new ExceptionHandlingException(
                          SR.MissingConstructor(formatterType.AssemblyQualifiedName)
                          );
            }

            this.writer = new LogWriter(exceptionHandlingConfigurationView.ConfigurationContext);
        }