DotNet4Neo4j / Neo4jClient

.NET client binding for Neo4j
https://www.nuget.org/packages/Neo4jClient
Microsoft Public License
430 stars 146 forks source link

Support Cypher transactions #14

Open mavadat opened 10 years ago

mavadat commented 10 years ago

Migrated From https://bitbucket.org/Readify/neo4jclient/issue/91/support-cypher-transactions

@tathamoddie created an issue 2013-04-24 http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html

Some thoughts: We should throw a NotSupportedException if they try to start a transaction where graphClient.Version < 2.0. We should throw a NotSupportedException if they try to invoke non-Cypher graph calls within a transaction

@mavadat In terms of API design how about the following basic API:

ITransaction IGraphClient.BeginTransaction();
void ITransaction.Commit();
void ITransaction.Rollback();
void KeepAlive(); //optional - to prevent transaction becoming orphan but comes with great responsibility
void ITransaction:IDisposable.Dispose(); //mainly for the "using" keyword
NodeReference<TNode> IGraphClient.Create<TNode>(
   TNode node,
   IEnumerable<IRelationshipAllowingParticipantNode<TNode>> relationships,
   ITransaction transaction = null);

Node<TNode> IGraphClient.Get<TNode>(NodeReference reference, ITransaction transaction = null);

Task<Node<TNode>> IGraphClient.GetAsync<TNode>(NodeReference reference, ITransaction transaction = null);

void IGraphClient.Update<TNode>(
   NodeReference<TNode> nodeReference,
   TNode replacementData,
   ITransaction transaction = null); //no option to update indexes

void IGraphClient.Delete(NodeReference reference, DeleteMode mode, ITransaction transaction);

RelationshipReference IGraphClient.CreateRelationship<TSourceNode, TRelationship>(
   NodeReference<TSourceNode> sourceNodeReference,
   TRelationship relationship,
   ITransaction transaction = null);

void IGraphClient.DeleteRelationship(RelationshipReference reference, ITransaction transaction = null);

void ICypherFluentQuery.Delete(string identities, ITransaction transaction = null);
void ICypherFluentQuery Relate(string relateText, ITransaction transaction = null);

Notice:

Thoughts? How can we improve this?

Related discussion impacting transaction support design: https://groups.google.com/forum/#!topic/neo4j/ZPjBW6wARI8

kumpikov commented 10 years ago

Any heads up on how far the transaction implementation has taken? I hope, it is something we can see soon.

tekiegirl commented 10 years ago

I hope that transactions will be supported soon, I don't really want to have to look at another library instead. Many thanks :)

dgmachado commented 9 years ago

Any heads up on how far the transaction implementation has taken? I hope, it is something we can see soon.