Exemple #1
0
        public JsonRpcMiddleware(RequestDelegate next, IHttpContextAccessor httpContextAccessor, ILoggerFactory loggerFactory, IOptions <JsonRpcOptions> options)
        {
            _logger  = loggerFactory.CreateLogger <JsonRpcMiddleware>();
            _next    = next;
            _options = options.Value;

            var handler = new JsonRpcHandlerBuilder()
                          .UseSecurityExceptionHandler()
                          .UseBlobHandler()
                          .Build();

            _server = new JsonRpcServer(options.Value, handler, loggerFactory.CreateLogger <JsonRpcServer>());
        }
Exemple #2
0
        public JsonRpcMiddleware(RequestDelegate next, IOptions <JsonRpcOptions> options)
        {
            _next    = next;
            _options = options.Value;
            _server  = new JsonRpcServer(_options.Methods, _options.Behaviors);

            var container = new ServiceCollection();

            container.AddSingleton(_server);
            foreach (var behavior in _options.Behaviors)
            {
                behavior.ConfigureServices(container);
            }
            _rpcServices = container.BuildServiceProvider();
        }