private async Task Dispatch(object command, Connection connection, Type baseInteface) { var type = baseInteface.MakeGenericType(command.GetType()); if (command is IReWorkSystemMessage && !_activator.HasRegistration(type)) { return; } var instance = _activator.GetInstance(type); var method = type.GetMethod("Handle"); if (method != null) { await(Task) method.Invoke(instance, new[] { command, connection }); } }
private IConnectionManager Start() { return(_activator.GetInstance <IConnectionManager>()); }