示例#1
0
        public Task <IAsyncTransaction> BeginTransaction(IAsyncSession session, TContext context)
        {
            if (_useBookmark)
            {
                while (true)
                {
                    try
                    {
                        return(session.BeginTransactionAsync());
                    }
                    catch (TransientException)
                    {
                        context.BookmarkFailed();
                    }
                }
            }

            return(session.BeginTransactionAsync());
        }
        private static async Task CreateNodeInTx(IAsyncSession session, int id)
        {
            var tx = await session.BeginTransactionAsync();

            try
            {
                await tx.RunAsync("CREATE (a:Person {id: $id})", new { id });

                await tx.CommitAsync();
            }
            catch
            {
                await tx.RollbackAsync();

                throw;
            }
        }
 public async Task <IAsyncTransaction> BeginTransactionAsync()
 {
     return(await _session.BeginTransactionAsync());
 }