Ejemplo n.º 1
0
 private ValueTask <IAppConnection> ResolveTargetConnectionAsync(
     IProvidedMethodReference method,
     IAppConnection source)
 {
     if (method.ProvidedService.ConnectionId.HasValue)
     {
         var connectionId = method.ProvidedService.ConnectionId.Value;
         if (!_appLifecycleManager.TryGetOnlineConnection(connectionId, out var connection))
         {
             throw new InvalidOperationException($"The requested connection {connectionId} is not online");
         }
         return(new ValueTask <IAppConnection>(connection));
     }
     return(_appLifecycleManager.GetOrSpawnConnectionAsync(new[] { method.ProvidedService.ApplicationId }));
 }