Esempio n. 1
0
        public async Task <TryValue <SerializedSkyIslandMapChunk> > TryGetAsync(
            ChunkOverheadKey key, CancellationToken cancellation = default(CancellationToken))
        {
            IChunkStoreContracts.TryGetAsync(key);

            var tryEntity = await this.store.WhereAsync <SkyIslandMapChunkEntity>(
                entity => entity.X == key.Index.X && entity.Y == key.Index.Y,
                cancellation).SingleOrNoneAsync().DontMarshallContext();

            return(tryEntity.Select(entity => new SerializedSkyIslandMapChunk(key, entity.SerializedData)));
        }
Esempio n. 2
0
        /// <inheritdoc />
        public Task AddOrUpdateAllAsync(
            IEnumerable <SerializedSkyIslandMapChunk> chunks,
            CancellationToken cancellation = default(CancellationToken))
        {
            IChunkStoreContracts.AddOrUpdateAllAsync(chunks);

            var entities = chunks.Select(chunk => new SkyIslandMapChunkEntity()
            {
                ChunkKey       = chunk.Key,
                SerializedData = chunk.SerializedData,
            });

            return(this.store.AddOrUpdateAllAsync(entities, cancellation));
        }