public RestServiceErrorHandler(Type[] typeList, Type handleType)
 {
     if (typeList != null && typeList.Length > 0)
     {
         foreach (var type in typeList)
         {
             if (type != null && !type.IsSubclassOf(typeof(Exception)))
             {
                 throw new ArgumentException("The type must derive from 'System.Exception'.", "type");
             }
         }
     }
     m_BizExceptionTypeList = typeList;
     if (handleType != null)
     {
         if (!typeof(IExceptionHandle).IsAssignableFrom(handleType))
         {
             throw new ArgumentException("The type must implement interface 'Nesoft.Utility.WCF.IExceptionHandle'.", "handleType");
         }
         m_ExceptionHandler = (IExceptionHandle)Activator.CreateInstance(handleType);
     }
     if (m_ExceptionHandler == null)
     {
         m_ExceptionHandler = new ExceptionHandler();
     }
 }
 public StandardServiceErrorHandler(Type[] typeList, Type handleType)
 {
     if (typeList != null && typeList.Length > 0)
     {
         foreach (var type in typeList)
         {
             if (type != null && !type.IsSubclassOf(typeof(Exception)))
             {
                 throw new ArgumentException("The type must derive from 'System.Exception'.", "type");
             }
         }
     }
     m_BizExceptionTypeList = typeList;
     if (handleType != null)
     {
         if (!typeof(IExceptionHandle).IsAssignableFrom(handleType))
         {
             throw new ArgumentException("The type must implement interface 'Nesoft.Utility.WCF.IExceptionHandle'.", "handleType");
         }
         m_ExceptionHandler = (IExceptionHandle)Activator.CreateInstance(handleType);
     }
     if (m_ExceptionHandler == null)
     {
         m_ExceptionHandler = new Soho.Utility.WCF.ExceptionHandler();
     }
 }
Esempio n. 3
0
 public Pipelines(
     IExceptionHandle <TRequest, TResponse> exceptionHandle,
     Queue <IRequestPipelineHandler <TRequest, TResponse> > queue)
 {
     _exceptionHandle = exceptionHandle;
     _queue           = queue;
 }
Esempio n. 4
0
        private IPipelineProfile <TRequest, TResponse> SetExceptionHandlerInner(
            IExceptionHandle <TRequest, TResponse> exceptionHandle)
        {
            _exceptionHandle = exceptionHandle;

            return(this);
        }
Esempio n. 5
0
        public static IExceptionHandle GetExceptionHandle(string handleName)
        {
            Sea2ExceptionHandle exceptionHandle = new Sea2ExceptionHandle();

            string[]         str    = exceptionHandle.type.Split(',');
            IExceptionHandle handle = Assembly.Load(str[1]).CreateInstance(str[0]) as IExceptionHandle;

            return(handle);
        }
Esempio n. 6
0
        /// <inheritdoc />
        public IPipelineProfile <TRequest, TResponse> SetExceptionHandler(
            IExceptionHandle <TRequest, TResponse> exceptionHandle)
        {
            if (exceptionHandle == null)
            {
                throw new ArgumentNullException(nameof(exceptionHandle));
            }

            return(SetExceptionHandlerInner(exceptionHandle));
        }
 public NEOperationBehavior(Type converterType, Type exceptionHandlerType)
 {
     if (converterType != null)
     {
         if (!typeof(IConvert).IsAssignableFrom(converterType))
         {
             throw new ArgumentException("类型" + converterType.FullName + "没有实现接口" + typeof(IConvert).FullName, "type");
         }
         m_Convertor = Activator.CreateInstance(converterType) as IConvert;
     }
     if (exceptionHandlerType != null)
     {
         if (!typeof(IExceptionHandle).IsAssignableFrom(exceptionHandlerType))
         {
             throw new ArgumentException("类型" + exceptionHandlerType.FullName + "没有实现接口" + typeof(IExceptionHandle).FullName, "type");
         }
         m_ExceptionHandler = Activator.CreateInstance(exceptionHandlerType) as IExceptionHandle;
     }
 }
 public NEOperationBehavior(Type converterType, Type exceptionHandlerType)
 {
     if (converterType != null)
     {
         if (!typeof(IConvert).IsAssignableFrom(converterType))
         {
             throw new ArgumentException("类型" + converterType.FullName + "没有实现接口" + typeof(IConvert).FullName, "type");
         }
         m_Convertor = Activator.CreateInstance(converterType) as IConvert;
     }
     if (exceptionHandlerType != null)
     {
         if (!typeof(IExceptionHandle).IsAssignableFrom(exceptionHandlerType))
         {
             throw new ArgumentException("类型" + exceptionHandlerType.FullName + "没有实现接口" + typeof(IExceptionHandle).FullName, "type");
         }
         m_ExceptionHandler = Activator.CreateInstance(exceptionHandlerType) as IExceptionHandle;
     }
 }
 public NEOperationBehavior(IConvert convertor, IExceptionHandle exceptionHandler)
 {
     m_Convertor        = convertor;
     m_ExceptionHandler = exceptionHandler;
 }
Esempio n. 10
0
 public NEOperationBehavior(IConvert convertor, IExceptionHandle exceptionHandler)
 {
     m_Convertor = convertor;
     m_ExceptionHandler = exceptionHandler;
 }
Esempio n. 11
0
 /// <summary>
 /// 构造方法
 /// 初始化各个对象以便就绪
 /// 只初始化交换机与基本属性,队列定义请重写Init方法进行操作
 /// </summary>
 /// <param name="channel">渠道</param>
 /// <param name="amqpQueue">AMQP队列信息</param>
 /// <param name="log">日志</param>
 /// <param name="exceptionHandle">异常处理</param>
 public RabbitConsumer(IModel channel, AmqpQueueInfo amqpQueue, ILogable log = null, IExceptionHandle exceptionHandle = null)
     : base(channel, amqpQueue, true, log)
 {
     this.exceptionHandle = exceptionHandle;
 }
Esempio n. 12
0
 /// <summary>
 /// 设置对象
 /// </summary>
 /// <param name="obj">对象</param>
 public void Set(IExceptionHandle obj)
 {
     this.exceptionHandle = obj;
 }
 public ESBMessageOperationInvoker(IOperationInvoker invoker, IExceptionHandle exceptionHandler)
 {
     m_Core = invoker;
     m_ExceptionHandler = exceptionHandler;
 }
Esempio n. 14
0
        /// <inheritdoc />
        public IPipelines <TRequest, TResponse> Create(IEnumerable <IRequestPipelineHandler <TRequest, TResponse> > handlers, IExceptionHandle <TRequest, TResponse> exceptionHandle)
        {
            if (handlers == null)
            {
                throw new ArgumentNullException(nameof(handlers));
            }
            if (exceptionHandle == null)
            {
                throw new ArgumentNullException(nameof(exceptionHandle));
            }

            var requestPipelineHandlers = new Queue <IRequestPipelineHandler <TRequest, TResponse> >(handlers);

            return(new Pipelines <TRequest, TResponse>(exceptionHandle, requestPipelineHandlers));
        }
Esempio n. 15
0
 public ESBMessageOperationInvoker(IOperationInvoker invoker, IExceptionHandle exceptionHandler)
 {
     m_Core             = invoker;
     m_ExceptionHandler = exceptionHandler;
 }