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

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

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

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

            // for some reason there is no overload that accepts a CancellationToken
            cancellation.ThrowIfCancellationRequested();
            return(this.connection.InsertOrIgnoreAsync(entity));
        }
        /// <inheritdoc />
        public async Task AddOrIgnoreAsync <TEntity>(
            TEntity entity, CancellationToken cancellation = default(CancellationToken))
            where TEntity : class
        {
            IAsyncStoreContracts.AddOrIgnoreAsync(entity);

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