Ejemplo n.º 1
0
 public static async Task Load(this IGameContextReadOnly ctx, IReadOnlyCollection <Guid> gameIds)
 {
     foreach (var id in gameIds)
     {
         await ctx.Load(id).ConfigureAwait(false);
     }
 }
Ejemplo n.º 2
0
 public static Game FindGame(this IGameContextReadOnly gc, Guid id)
 {
     try {
         gc.Load(id).Wait();
         return(gc.Games.Find(id));
     } catch (NotFoundException ex) {
         throw new RequestedGameNotFoundException($"Game with id {id} not found", ex);
     }
 }
Ejemplo n.º 3
0
 public static Task <Game> FindGameOrThrowAsync(this IGameContextReadOnly gc, IHaveGameId request)
 => Wrap(async() => {
     await gc.Load(request.GameId).ConfigureAwait(false);
     return(await gc.Games.FindOrThrowAsync(request.GameId).ConfigureAwait(false));
 }, request.GameId);
Ejemplo n.º 4
0
 public static Task <Game> FindGameOrThrowAsync(this IGameContextReadOnly gc, Guid id) => Wrap(async() => {
     await gc.Load(id).ConfigureAwait(false);
     return(await gc.Games.FindOrThrowAsync(id).ConfigureAwait(false));
 }, id);
Ejemplo n.º 5
0
 public static Task Load(this IGameContextReadOnly ctx, params Guid[] gameIds)
 => Load(ctx, (IReadOnlyCollection <Guid>)gameIds);