示例#1
0
        /// <summary>
        /// AddIdBarrierAsync
        /// </summary>
        /// <param name="clientId"></param>
        /// <param name="serverId"></param>
        /// <returns></returns>
        /// <exception cref="DatabaseException"></exception>
        public async Task AddIdBarrierAsync(long clientId, long serverId)
        {
            IdBarrier idBarrier = new IdBarrier {
                ClientId = clientId, ServerId = serverId
            };

            await _database.AddAsync(idBarrier, "", null).ConfigureAwait(false);
        }
示例#2
0
        /// <summary>
        /// AddIdBarrierAsync
        /// </summary>
        /// <param name="clientIds"></param>
        /// <param name="servierIds"></param>
        /// <param name="transactionContext"></param>
        /// <returns></returns>
        /// <exception cref="DatabaseException"></exception>
        public async Task AddIdBarrierAsync(IList <long> clientIds, IEnumerable <long> servierIds, TransactionContext transactionContext)
        {
            List <IdBarrier> idBarriers = new List <IdBarrier>();

            int num = 0;

            foreach (long servierId in servierIds)
            {
                IdBarrier idBarrier = new IdBarrier {
                    ClientId = clientIds[num++], ServerId = servierId
                };

                idBarriers.Add(idBarrier);
            }

            await _database.BatchAddAsync(idBarriers, "", transactionContext).ConfigureAwait(false);
        }