public MultipleUpdatesRawMiddleware(RequestDelegate next, RawDb db) { _next = next; _db = db; }
public FortunesRawMiddleware(RequestDelegate next, RawDb db, HtmlEncoder htmlEncoder) { _next = next; _db = db; _htmlEncoder = htmlEncoder; }
public SingleQueryRawMiddleware(RequestDelegate next, RawDb db) { _next = next; _db = db; }
static async Task <World[]> LoadUncachedQueries(ConcurrentRandom random, int id, int i, int count, RawDb rawdb, World[] result) { using (var db = new NpgsqlConnection(rawdb._connectionString)) { await db.OpenAsync(); var(cmd, idParameter) = rawdb.CreateReadCommand(db, random); using (cmd) { Func <ICacheEntry, Task <CachedWorld> > create = async(entry) => { return(await rawdb.ReadSingleRow(cmd)); }; var cacheKeys = _cacheKeys; var key = cacheKeys[id]; idParameter.TypedValue = id; for (; i < result.Length; i++) { var data = await rawdb._cache.GetOrCreateAsync <CachedWorld>(key, create); result[i] = data; id = random.Next(1, 10001); idParameter.TypedValue = id; key = cacheKeys[id]; } } } return(result); }