Neo4jClient 1.1.0.1

Originally posted on: http://geekswithblogs.net/cskardon/archive/2015/08/07/neo4jclient-1.1.0.1.aspx

Big milestone this one, Neo4jClient now supports Transactions, Authentication and some other little changes.

Transaction info is all here: https://github.com/Readify/Neo4jClient/wiki/Transactions

You can find the connecting stuff here (at the bottom):

https://github.com/Readify/Neo4jClient/wiki/connecting

And the other big(ish) change is the change to make the ‘CollectAs’ method return the class type specified (<T>) instead of Node<T>.

Big thanks for this go to Arturo Sevilla (https://github.com/arturosevilla) for the original Pull request that has been merged in.

There’ll be more info in a while. But for now, download the new version via nuget: https://www.nuget.org/packages/Neo4jClient and have graphy fun!

Ternary operators don’t work with nullable value types?

I’ve got the following situation:

DateTime? myDt = (DateTime) row["Column"];

This fails when retrieving a DBNull value, so we check for that:

DateTime? myDT = (row["Column"] == DBNull.Value) ? null : (DateTime) row["Column"];

This won’t compile, however doing:


DateTime? myDT;
if(row["Column"] == DBNull.Value)
myDT = null;
else
myDT = row["Column"];

works fine, now, I realise I can simplify that statement, but, for the purposes of this post, it is a closer match to the ternary operator.

Why won’t the ternary op work with the value type? It works perfectly with a string…

Production LINQ!

I’m happy today as I’ve written my first bit of Production LINQ code in the form of LINQ-to-XML.
It’s not the most complicated bit of code – only a grabbing of data from a file, but it does do what it says on the tin – uses C# 3.0 and (unfortunately) causes Resharper to complain on a constant basis 🙂