public static async Task Load(this IGameContextReadOnly ctx, IReadOnlyCollection <Guid> gameIds) { foreach (var id in gameIds) { await ctx.Load(id).ConfigureAwait(false); } }
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); } }
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);
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);
public static Task Load(this IGameContextReadOnly ctx, params Guid[] gameIds) => Load(ctx, (IReadOnlyCollection <Guid>)gameIds);