Click or drag to resize

ISession Interface

A live session with a Neo4j instance. Sessions serve two purposes. For one, they are an optimization. By keeping state on the database side, we can avoid re-transmitting certain metadata over and over. Sessions also serve a role in transaction isolation and ordering semantics. Neo4j requires "sticky sessions", meaning all requests within one session must always go to the same Neo4j instance. AsyncSession objects are not thread safe, if you want to run concurrent operations against the database, simply create multiple session objects.

Namespace:  Neo4j.Driver
Assembly:  Neo4j.Driver.Simple (in Neo4j.Driver.Simple.dll) Version: 4.1.0
Syntax
public interface ISession : IQueryRunner, 
	IDisposable

The ISession type exposes the following members.

Properties
  NameDescription
Public propertyLastBookmark
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.
Public propertySessionConfig
Gets the session configuration back
Top
Methods
  NameDescription
Public methodBeginTransaction
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 Run(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.
Public methodBeginTransaction(ActionTransactionConfigBuilder)
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 Run(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.
Public methodDispose (Inherited from IDisposable.)
Public methodReadTransactionT(FuncITransaction, T)
Execute given unit of work in a Read transaction.
Public methodReadTransactionT(FuncITransaction, T, ActionTransactionConfigBuilder)
Execute given unit of work in a Read transaction with a specific TransactionConfig.
Public methodRun(String)
Run a query and return a 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.
(Inherited from IQueryRunner.)
Public methodRun(Query)
Execute a query and return a result stream.
(Inherited from IQueryRunner.)
Public methodRun(String, IDictionaryString, Object)
Run a query and return a 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.
(Inherited from IQueryRunner.)
Public methodRun(String, Object)
Execute a query and return a result stream.
(Inherited from IQueryRunner.)
Public methodRun(String, ActionTransactionConfigBuilder)
Run a query with the specific TransactionConfig and return a 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.
Public methodRun(Query, ActionTransactionConfigBuilder)
Execute a query with the specific TransactionConfig and return a result stream.
Public methodRun(String, IDictionaryString, Object, ActionTransactionConfigBuilder)
Run a query with the specific TransactionConfig and return a 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.
Public methodWriteTransactionT(FuncITransaction, T)
Execute given unit of work in a Write transaction.
Public methodWriteTransactionT(FuncITransaction, T, ActionTransactionConfigBuilder)
Execute given unit of work in a Write transaction with a specific TransactionConfig.
Top
See Also