-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathCompositeHandlersManager.cs
67 lines (56 loc) · 2.28 KB
/
CompositeHandlersManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.Reactive.Disposables;
namespace OmniSharp.Extensions.JsonRpc
{
public class CompositeHandlersManager : IHandlersManager
{
private readonly IHandlersManager _parent;
private readonly CompositeDisposable _compositeDisposable = new CompositeDisposable();
public CompositeHandlersManager(IHandlersManager parent) => _parent = parent;
public IEnumerable<IHandlerDescriptor> Descriptors => _parent.Descriptors;
public IDisposable Add(IJsonRpcHandler handler, JsonRpcHandlerOptions options)
{
var result = _parent.Add(handler, options);
_compositeDisposable.Add(result);
return result;
}
public IDisposable Add(string method, IJsonRpcHandler handler, JsonRpcHandlerOptions options)
{
var result = _parent.Add(method, handler, options);
_compositeDisposable.Add(result);
return result;
}
public IDisposable Add(JsonRpcHandlerFactory factory, JsonRpcHandlerOptions options)
{
var result = _parent.Add(factory, options);
_compositeDisposable.Add(result);
return result;
}
public IDisposable Add(string method, JsonRpcHandlerFactory factory, JsonRpcHandlerOptions options)
{
var result = _parent.Add(factory, options);
_compositeDisposable.Add(result);
return result;
}
public IDisposable Add(Type handlerType, JsonRpcHandlerOptions options)
{
var result = _parent.Add(handlerType, options);
_compositeDisposable.Add(result);
return result;
}
public IDisposable Add(string method, Type handlerType, JsonRpcHandlerOptions options)
{
var result = _parent.Add(method, handlerType, options);
_compositeDisposable.Add(result);
return result;
}
public IDisposable AddLink(string sourceMethod, string destinationMethod)
{
var result = _parent.AddLink(sourceMethod,destinationMethod);
_compositeDisposable.Add(result);
return result;
}
public CompositeDisposable GetDisposable() => _compositeDisposable;
}
}