-
Couldn't load subscription status.
- Fork 69
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 details: 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.Reactivewhen 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#SupportsMultiDbAsyncis added for querying if the remote database supports multi-databases. - A new
IDriver#VerifyConnectivityAsyncmethod 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.Driverinstead of the oldNeo4j.Driver.V1. - The
Neo4j.Driverpackage contains only the asynchronous API. Synchronous session API has been moved to the namespaceNeo4j.Driver.Simple. - A new
neo4jscheme is added and designed to work with all possible 4.0 server deployments.boltscheme is still available for explicit direct connections with a single instance and/or a single member in a cluster. For 3.x servers,neo4jreplacesbolt+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#Sessionmethods now make use of a session option builder rather than method arguments. - Bookmark has changed from a
stringand/or a list of strings to aBookmarkobject. -
ITransaction#Successis replaced withITransaction#Commit. However unlikeITransaction#Successwhich only marks the transaction to be successful and then waits forITransaction#Disposeto actually perform the real commit,ITransaction#Commitcommits the transaction immediately. Similarly,ITransaction#Failureis 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#Disposewill roll back the transaction. -
Statementhas been renamed toQuery.IStatementResulthas been simplified toIResult. Similarly,IStatementResultCursorhas 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#Consumeand/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. -
LoadBalancingStrategyis removed fromConfigclass and the drivers always default toLeastConnectedStrategy. - The
IDriverLoggerhas been renamed toILogger. -
TrustStrategyis replaced withTrustManager.