Exemplo n.º 1
0
 public T OnNotification <TParams>(string method, Func <TParams, Task> handler, JsonRpcHandlerOptions options = null) =>
 OnNotification <TParams>(method, (value, cancellationToken) => handler(value), options);
 public sealed override T AddHandler <THandler>(string method, JsonRpcHandlerOptions options = null) => AddHandler(method, typeof(THandler), options);
 public sealed override T AddHandler(string method, Type type, JsonRpcHandlerOptions options = null)
 {
     Handlers.Add(JsonRpcHandlerDescription.Named(method, type, options));
     return((T)(object)this);
 }
 public IDisposable Add(Type handlerType, JsonRpcHandlerOptions options) => Add(_resolverContext.Resolve(handlerType) as IJsonRpcHandler, options);
 public sealed override T AddHandler(JsonRpcHandlerFactory handlerFunc, JsonRpcHandlerOptions options = null)
 {
     Handlers.Add(JsonRpcHandlerDescription.Named(null, handlerFunc, options));
     return((T)(object)this);
 }
 public IDisposable Add(IJsonRpcHandler handler, JsonRpcHandlerOptions options)
 {
     return(Add(GetMethodName(handler.GetType()), handler, options));
 }
 public IDisposable Add(JsonRpcHandlerFactory factory, JsonRpcHandlerOptions options) => Add(factory(_resolverContext), options);
 public abstract T AddHandler <THandler>(THandler handler, JsonRpcHandlerOptions options = null) where THandler : IJsonRpcHandler;
 public abstract T AddHandler <THandler>(string method, JsonRpcHandlerOptions options = null) where THandler : IJsonRpcHandler;
 public abstract T AddHandler(string method, Func <IServiceProvider, IJsonRpcHandler> handlerFunc, JsonRpcHandlerOptions options = null);
 public abstract T AddHandler <THandler>(Func <IServiceProvider, THandler> handlerFunc, JsonRpcHandlerOptions options = null) where THandler : IJsonRpcHandler;
 public abstract T AddHandler(string method, IJsonRpcHandler handler, JsonRpcHandlerOptions options = null);
 public T OnNotification(string method, Func <CancellationToken, Task> handler, JsonRpcHandlerOptions options = null)
 {
     return(AddHandler(method, _ => new DelegatingNotificationHandler <Unit>(_.GetRequiredService <ISerializer>(), (unit, token) => handler(token)), options));
 }
Exemplo n.º 14
0
 public T OnNotification(string method, Func <Task> handler, JsonRpcHandlerOptions options = null) => OnNotification(method, cancellationToken => handler(), options);
 public T OnJsonNotification(string method, Func <JToken, Task> handler, JsonRpcHandlerOptions options = null)
 {
     return(OnJsonNotification(method, (value, cancellationToken) => handler(value), options));
 }
 public abstract T AddHandler(Type type, JsonRpcHandlerOptions options = null);
 public T OnNotification <TParams>(string method, Action <TParams, CancellationToken> handler, JsonRpcHandlerOptions options = null)
 {
     return(OnNotification <TParams>(method, (value, cancellationToken) => {
         handler(value, cancellationToken);
         return Task.CompletedTask;
     }, options));
 }
 public abstract T AddHandler(string method, Type type, JsonRpcHandlerOptions options = null);
 public IDisposable Add(IJsonRpcHandler handler, JsonRpcHandlerOptions options) => Add(_handlerTypeDescriptorProvider.GetMethodName(handler.GetType()), handler, options);
 public T OnJsonRequest(string method, Func <JToken, Task <JToken> > handler, JsonRpcHandlerOptions options = null)
 {
     return(OnJsonRequest(method, (request, ct) => handler(request), options));
 }
 public IDisposable Add(string method, JsonRpcHandlerFactory factory, JsonRpcHandlerOptions options) => Add(method, factory(_resolverContext), options);
 public T OnRequest <TResponse>(string method, Func <Task <TResponse> > handler, JsonRpcHandlerOptions options = null)
 {
     return(OnRequest <Unit, TResponse>(method, (value, cancellationToken) => handler(), options));
 }
 public IDisposable Add(string method, Type handlerType, JsonRpcHandlerOptions options) => Add(method, _resolverContext.Resolve(handlerType) as IJsonRpcHandler, options);
 public T OnRequest <TParams>(string method, Func <TParams, CancellationToken, Task> handler, JsonRpcHandlerOptions options = null)
 {
     return(AddHandler(method, _ => new DelegatingRequestHandler <TParams>(_.GetRequiredService <ISerializer>(), handler), options));
 }
 public sealed override T AddHandler <THandler>(JsonRpcHandlerOptions options = null) => AddHandler(typeof(THandler), options);
 public T OnRequest <TParams>(string method, Func <CancellationToken, Task> handler, JsonRpcHandlerOptions options = null)
 {
     return(OnRequest <TParams>(method, (value, cancellationToken) => handler(cancellationToken), options));
 }
 public sealed override T AddHandler(Type type, JsonRpcHandlerOptions options = null)
 {
     Handlers.Add(JsonRpcHandlerDescription.Infer(type, options));
     return((T)(object)this);
 }
 public T OnJsonNotification(string method, Func <JToken, CancellationToken, Task> handler, JsonRpcHandlerOptions options = null)
 {
     return(AddHandler(method, _ => new DelegatingJsonNotificationHandler(handler), options));
 }
 public JsonRpcHandlerTypeDescription(string method, Type handlerType, JsonRpcHandlerOptions options) : base(options)
 {
     Method      = method;
     HandlerType = handlerType;
 }
Exemplo n.º 30
0
 public T OnNotification <TParams>(string method, Func <TParams, CancellationToken, Task> handler, JsonRpcHandlerOptions options = null) => AddHandler(
     method, _ => new DelegatingNotificationHandler <TParams>(_.GetRequiredService <ISerializer>(), handler), options
     );