Querying inside of a transaction (C#)

52 views
Skip to first unread message

Stanley Goldman

unread,
Aug 29, 2015, 5:04:00 PM8/29/15
to Neo4jClient
Hey all,

http://pastebin.com/5ej4smCh

I'm trying to understand why the following doesn't work inside of a transaction..

Using .NET Framework 4.5.2 and Neo4jClient 1.1.0.4

        [Test]
        public void TestInTransaction_Fails()
        {
            const string somestringvalue = "SomeStringValue";
            TransactionScope scope = null;
 
            try
            {
                scope = new TransactionScope();

                var testObject = new TestObject { SomeInteger = 456, SomeString = somestringvalue };
                _client.Cypher
                    .Create(string.Format("(t:{0} {{newTestObject}})", TestObject.Label))
                    .WithParam("newTestObject", testObject)
                    .ExecuteWithoutResults();
 
                var loadedObject = _client.Cypher.Match(string.Format("(t:{0})", TestObject.Label))
                            .Where((TestObject t) => t.SomeString == somestringvalue)
                            .Return(t => t.As<TestObject>())
                            .Results
                            .FirstOrDefault();
 
                Assert.IsNotNull(loadedObject);
                Assert.AreEqual(testObject.SomeString, loadedObject.SomeString);
            }
            finally
            {
                if (scope != null)
                {
                    scope.Dispose();
                }
            }
        }
 
But if I query for just a field of the User, it works. I left most of the code in the pastebin.

Thanks for the help.

-Stanley

Chris Skardon

unread,
Aug 30, 2015, 4:22:49 AM8/30/15
to neo4j...@googlegroups.com
Hi Stanley,

There was a pull request last night around this issue, it's in Nuget (1.1.0.5) but as of writing Nuget haven't indexed it - give it 10 mins and it should be there,

If you can give it a try and let us know if it's working for you.

Cheers

Chris

--
You received this message because you are subscribed to the Google Groups "Neo4jClient" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4jclient...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stanley Goldman

unread,
Aug 30, 2015, 7:02:12 AM8/30/15
to neo4j...@googlegroups.com
Yea, Ben Grabkowitz is a friend of mine, we were diagnosing the issue together.

-Cheers.

--
You received this message because you are subscribed to a topic in the Google Groups "Neo4jClient" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4jclient/OYlRWKbjfhs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to neo4jclient...@googlegroups.com.

Chris Skardon

unread,
Aug 30, 2015, 8:32:10 AM8/30/15
to neo4j...@googlegroups.com
Ace, well thank you both for the effort! I hope it works for you!
Reply all
Reply to author
Forward
0 new messages