-
Notifications
You must be signed in to change notification settings - Fork 70
Migrating from 1.7 to 4.0
grant lodge edited this page Feb 16, 2023
·
3 revisions
This page is for users who would like to migrate their 1.7 driver to 4.0. The following sections serve as a quick look at what have been added and/or changed in 4.0 .NET driver. For more information, also checkout our Driver Migration Guide.
- Upcoming version is now named as 4.0.0 instead of 2.0.0 to better align with server versions.
- Bolt V4.0 is implemented in the 4.0.0 driver.
- Reactive API is available under namespace
Neo4j.Driver.Reactive
when using together with Neo4j 4.0 databases. - Multi-databases support is added. Database can be selected for each session on creation
with
SessionConfig#ForDatabase
. - A new feature detection method
IDriver#SupportsMultiDbAsync
is added for querying if the remote database supports multi-databases. - A new
IDriver#VerifyConnectivityAsync
method is introduced for verify the availability of remote DBMS.
- Encrypted is turned off by default. When encryption is explicitly enabled, the default trust mode is to trust the certificates that are trusted by underlying operating system, and hostname verification is enforced by default.
- v1 is removed from drivers' package name. All public APIs are under the namespace
Neo4j.Driver
instead of the oldNeo4j.Driver.V1
. - The
Neo4j.Driver
package contains only the asynchronous API. Synchronous session API has been moved to the namespaceNeo4j.Driver.Simple
. - A new
neo4j
scheme is added and designed to work with all possible 4.0 server deployments.bolt
scheme is still available for explicit direct connections with a single instance and/or a single member in a cluster. For 3.x servers,neo4j
replacesbolt+routing
. - Asynchronous methods have been extracted out and put in interfaces prefixed with
IAsync
, whereas synchronous methods are kept under the old interface but live in packageNeo4j.Driver.Simple
. This change ensures that blocking and no-blocking APIs can never be mixed together. -
IDriver#Session
methods now make use of a session option builder rather than method arguments. - Bookmark has changed from a
string
and/or a list of strings to aBookmark
object. -
ITransaction#Success
is replaced withITransaction#Commit
. However unlikeITransaction#Success
which only marks the transaction to be successful and then waits forITransaction#Dispose
to actually perform the real commit,ITransaction#Commit
commits the transaction immediately. Similarly,ITransaction#Failure
is replaced withITransaction#Rollback
. A transaction in 4.0 can only be committed OR rolled back once. If a transaction is not committed explicitly usingITransaction#Commit
,ITransaction#Dispose
will roll back the transaction. -
Statement
has been renamed toQuery
.IStatementResult
has been simplified toIResult
. Similarly,IStatementResultCursor
has been renamed toIResultCursor
. - A result can only be consumed once. A result is consumed if either the query result has been discarded by
invoking
IResult#Consume
and/or the outer scope where the result is created, such as a transaction or a session, has been closed. Attempts to access consumed results will be responded with aResultConsumedException
. -
LoadBalancingStrategy
is removed fromConfig
class and the drivers always default toLeastConnectedStrategy
. - The
IDriverLogger
has been renamed toILogger
. -
TrustStrategy
is replaced withTrustManager
.