Refine Service Api a bit
This commit is contained in:
@ -16,9 +16,9 @@ public class JRpcServer<TContext>
|
||||
this.Services = new Dictionary<string, JRpcService<TContext>>();
|
||||
}
|
||||
|
||||
public void AddService(string name, JRpcService<TContext> service)
|
||||
public void AddService(JRpcService<TContext> service)
|
||||
{
|
||||
this.Services.Add(name, service);
|
||||
this.Services.Add(service.Name, service);
|
||||
}
|
||||
|
||||
public JRpcServerSession<TContext> GetSession(JRpcTransport transport, TContext context)
|
||||
@ -184,8 +184,11 @@ public class JRpcServerSession<TContext>
|
||||
|
||||
public abstract class JRpcService<TContext>
|
||||
{
|
||||
public abstract string Name { get; }
|
||||
|
||||
public HashSet<string> Functions = new HashSet<string>();
|
||||
|
||||
|
||||
protected void RegisterFunction(string name)
|
||||
{
|
||||
this.Functions.Add(name);
|
||||
|
Reference in New Issue
Block a user