コード例 #1
0
        // 4. Implement the interface explicitly.

        #region IEnsuranceHandler Members

        void IEnsuranceHandler.Handle( Constraint constraint, string message, params object[] args )
        {
            // 5. Do your logging.
            if ( _log.IsErrorEnabled )
            {
                _log.Error( constraint.ToString() );
                _log.WarnFormat( message, args );
            }
        }
コード例 #2
0
        // 5. Implement the interface explicitly.

        void IEnsuranceHandler.Handle( Constraint constraint, string message, params object[] args )
        {
            // 5. Do your logging.
            try
            {
                if ( _log.IsErrorEnabled )
                {
                    _log.Error( constraint.ToString() );
                    _log.WarnFormat( message, args );
                }
            }
            finally
            {
                // 6. ALWAYS pass the call onto your successor.
                IEnsuranceResponsibilityChainLink handler = _successor;
                if ( handler != null )
                {
                    handler.Handle( constraint, message, args );
                }
            }
        }