Interface IAsyncSession
A live session with a Neo4j instance. Sessions serve a role in transaction isolation and ordering semantics. Within a session, transactions run sequentially one after another. Session objects are not thread safe, if you want to run concurrent operations against the database, simply create multiple session objects.
public interface IAsyncSession : IAsyncQueryRunner, IAsyncDisposable, IDisposable
- Inherited Members
- Extension Methods
Properties
- LastBookmark
Gets the bookmark received following the last successfully completed IAsyncTransaction. If no bookmark was received or if this transaction was rolled back, the bookmark value will not be changed.
- LastBookmarks
Gets the bookmark received following the last successfully completed IAsyncTransaction. If no bookmark was received or if this transaction was rolled back, the bookmark value will not be changed.
- SessionConfig
Gets the session configurations back
Methods
- BeginTransactionAsync()
Asynchronously begin a new transaction in this session using server default transaction configurations. A session can have at most one transaction running at a time, if you want to run multiple concurrent transactions, you should use multiple concurrent sessions. All data operations in Neo4j are transactional. However, for convenience we provide a RunAsync(Query) method directly on this session interface as well. When you use that method, your query automatically gets wrapped in a transaction. If you want to run multiple queries in the same transaction, you should wrap them in a transaction using this method.
- BeginTransactionAsync(Action<TransactionConfigBuilder>)
Asynchronously begin a new transaction with a specific TransactionConfig in this session. A session can have at most one transaction running at a time, if you want to run multiple concurrent transactions, you should use multiple concurrent sessions. All data operations in Neo4j are transactional. However, for convenience we provide a RunAsync(Query) method directly on this session interface as well. When you use that method, your query automatically gets wrapped in a transaction. If you want to run multiple queries in the same transaction, you should wrap them in a transaction using this method.
- CloseAsync()
Close all resources used in this Session. If any transaction is left open in this session without commit or rollback, then this method will rollback the transaction.
- ExecuteReadAsync(Func<IAsyncQueryRunner, Task>, Action<TransactionConfigBuilder>)
Asynchronously execute given unit of work as a transaction with a specific TransactionConfig.
- ExecuteReadAsync<TResult>(Func<IAsyncQueryRunner, Task<TResult>>, Action<TransactionConfigBuilder>)
Asynchronously execute given unit of work as a transaction with a specific TransactionConfig.
- ExecuteWriteAsync(Func<IAsyncQueryRunner, Task>, Action<TransactionConfigBuilder>)
Asynchronously execute given unit of work as a transaction with a specific TransactionConfig.
- ExecuteWriteAsync<TResult>(Func<IAsyncQueryRunner, Task<TResult>>, Action<TransactionConfigBuilder>)
Asynchronously execute given unit of work as a transaction with a specific TransactionConfig.
- ReadTransactionAsync(Func<IAsyncTransaction, Task>, Action<TransactionConfigBuilder>)
Asynchronously execute given unit of work in a Read transaction with a specific TransactionConfig.
- ReadTransactionAsync<T>(Func<IAsyncTransaction, Task<T>>, Action<TransactionConfigBuilder>)
Asynchronously execute given unit of work in a Read transaction with a specific TransactionConfig.
- RunAsync(Query, Action<TransactionConfigBuilder>)
Asynchronously execute a query with the specific TransactionConfig and return a task of result stream.
- RunAsync(string, Action<TransactionConfigBuilder>)
Asynchronously run a query with the specific TransactionConfig and return a task of result stream. This method accepts a String representing a Cypher query which will be compiled into a query object that can be used to efficiently execute this query multiple times. This method optionally accepts a set of parameters which will be injected into the query object query by Neo4j.
- RunAsync(string, IDictionary<string, object>, Action<TransactionConfigBuilder>)
Asynchronously run a query with the customized TransactionConfig and return a task of result stream. This method accepts a String representing a Cypher query which will be compiled into a query object that can be used to efficiently execute this query multiple times. This method optionally accepts a set of parameters which will be injected into the query object query by Neo4j.
- WriteTransactionAsync(Func<IAsyncTransaction, Task>, Action<TransactionConfigBuilder>)
Asynchronously execute given unit of work in a Write transaction with a specific TransactionConfig.
- WriteTransactionAsync<T>(Func<IAsyncTransaction, Task<T>>, Action<TransactionConfigBuilder>)
Asynchronously execute given unit of work in a Write transaction with a specific TransactionConfig.