Exemplo n.º 1
0
        public ErrorHandlerServerCallInterceptorFactory(
            IMarshallerFactory marshallerFactory,
            Func <IServiceProvider, IServerErrorHandler> errorHandlerFactory)
        {
            marshallerFactory.AssertNotNull(nameof(marshallerFactory));

            _marshallerFactory   = marshallerFactory;
            _errorHandlerFactory = errorHandlerFactory;
        }
Exemplo n.º 2
0
        public ServerCallErrorInterceptor(
            IServerErrorHandler errorHandler,
            IMarshallerFactory marshallerFactory)
        {
            errorHandler.AssertNotNull(nameof(errorHandler));
            marshallerFactory.AssertNotNull(nameof(marshallerFactory));

            _errorHandler      = errorHandler;
            _marshallerFactory = marshallerFactory;
        }
Exemplo n.º 3
0
        public ClientCallErrorInterceptor(
            IClientErrorHandler errorHandler,
            IMarshallerFactory marshallerFactory,
            ILogger?logger)
        {
            errorHandler.AssertNotNull(nameof(errorHandler));
            marshallerFactory.AssertNotNull(nameof(marshallerFactory));

            ErrorHandler      = errorHandler;
            MarshallerFactory = marshallerFactory;
            _logger           = logger;
        }
Exemplo n.º 4
0
        public static byte[] SerializeHeader(this IMarshallerFactory factory, object value)
        {
            factory.AssertNotNull(nameof(factory));
            value.AssertNotNull(nameof(value));

            if (value is byte[] buffer)
            {
                return(buffer);
            }

            return(typeof(MarshallerFactoryExtensions)
                   .StaticMethod(nameof(SerializeInternal))
                   .MakeGenericMethod(value.GetType())
                   .CreateDelegate <Func <IMarshallerFactory, object, byte[]> >()
                   .Invoke(factory, value));
        }