Beispiel #1
0
        /// <inheritdoc />
        public async Task AddOrUpdateAsync(TEntity entity, CancellationToken cancellation = default(CancellationToken))
        {
            IAsyncStoreContracts.AddOrUpdateAsync(entity);

            cancellation.ThrowIfCancellationRequested();
            await this.store.AddOrUpdateAsync(entity, cancellation).DontMarshallContext();
        }
        /// <inheritdoc />
        public Task AddOrUpdateAsync <TEntity>(
            TEntity entity, CancellationToken cancellation = default(CancellationToken))
            where TEntity : class
        {
            IAsyncStoreContracts.AddOrUpdateAsync(entity);

            cancellation.ThrowIfCancellationRequested();
            return(this.connection.InsertOrReplaceAsync(entity, cancellation));
        }
Beispiel #3
0
        /// <inheritdoc />
        public async Task AddOrUpdateAsync <TEntity>(
            TEntity entity, CancellationToken cancellation = default(CancellationToken))
            where TEntity : class
        {
            IAsyncStoreContracts.AddOrUpdateAsync(entity);

            var store = await this.GetStoreAsync <TEntity>(cancellation).DontMarshallContext();

            await store.AddOrUpdateAsync(entity, cancellation).DontMarshallContext();
        }
        /// <inheritdoc />
        public async Task AddOrUpdateAsync <TEntity>(
            TEntity entity, CancellationToken cancellation = default(CancellationToken))
            where TEntity : class
        {
            IAsyncStoreContracts.AddOrUpdateAsync(entity);

            cancellation.ThrowIfCancellationRequested();
            using (await this.Lock.WriterLockAsync(cancellation).DontMarshallContext())
            {
                cancellation.ThrowIfCancellationRequested();
                await this.store.AddOrUpdateAsync(entity, cancellation).DontMarshallContext();
            }
        }