Example #1
0
    public static Task <TEntity> GetOrNullAsync <TKey, TEntity>(
        this IAsyncStore store, TKey key, CancellationToken cancellation = default(CancellationToken))
        where TEntity : class, IKeyed <TKey>
    {
        GetMethodContracts(store, key);

        return(store.WhereAsync((TEntity entity) => entity.Key.Equals(key)).SingleOrDefaultAsync());
    }
        public MigratedAsyncStore(IAsyncStoreMigrator migrator, IAsyncStore store)
        {
            Contracts.Requires.That(migrator != null);
            Contracts.Requires.That(store != null);

            this.store          = store;
            this.Initialization = migrator.MigrateAsync();
        }
Example #3
0
    public static Task AddOrIgnoreAllAsync <TEntity>(
        this IAsyncStore store, CancellationToken cancellation, params TEntity[] entities)
        where TEntity : class
    {
        AllMethodContracts(store, entities);

        return(store.AddOrIgnoreAllAsync(entities, cancellation));
    }
Example #4
0
    public static Task <TryValue <TEntity> > TryGetAsync <TKey, TEntity>(
        this IAsyncStore <TEntity> store, TKey key, CancellationToken cancellation = default(CancellationToken))
        where TEntity : class, IKeyed <TKey>
    {
        GetMethodContracts(store, key);

        return(store.WhereAsync(entity => entity.Key.Equals(key)).SingleOrNoneAsync());
    }
        public LockedAsyncStore(IAsyncStore store)
        {
            Contracts.Requires.That(store != null);

            this.store = store;
        }
        public KeyValueStore(IAsyncStore <TEntity> store)
        {
            Contracts.Requires.That(store != null);

            this.store = store;
        }
Example #7
0
        public SkyIslandMapChunkStore(IAsyncStore store)
        {
            Contracts.Requires.That(store != null);

            this.store = store;
        }
        public VoxelGridChunkStore(IAsyncStore store)
        {
            Contracts.Requires.That(store != null);

            this.store = store;
        }
Example #9
0
 public static Task AddOrIgnoreAllAsync <TEntity>(this IAsyncStore store, params TEntity[] entities)
     where TEntity : class => store.AddOrIgnoreAllAsync(CancellationToken.None, entities);
Example #10
0
 private static void AllMethodContracts <TEntity>(this IAsyncStore <TEntity> store, TEntity[] entities)
     where TEntity : class
 {
     Contracts.Requires.That(store != null);
     Contracts.Requires.That(entities.AllAndSelfNotNull());
 }
Example #11
0
 private static void GetMethodContracts <TKey, TEntity>(this IAsyncStore <TEntity> store, TKey key)
     where TEntity : class, IKeyed <TKey>
 {
     Contracts.Requires.That(store != null);
     Contracts.Requires.That(key != null);
 }
Example #12
0
 private static void GetMethodContracts <TKey>(this IAsyncStore store, TKey key)
 {
     Contracts.Requires.That(store != null);
     Contracts.Requires.That(key != null);
 }
Example #13
0
 public static Task RemoveAllAsync <TEntity>(
     this IAsyncStore <TEntity> store, params TEntity[] entities)
     where TEntity : class => store.RemoveAllAsync(CancellationToken.None, entities);
Example #14
0
 public ManagerBase(IAsyncStore <T, TKey> store)
 {
     Store = store;
 }