Readify/Neo4jClient — pull request #43 by wis3guy (2014-03-21 09:12:12+00:00)
Title: Extracted the ICypherGraphClient

Extracted the ```IGraphClient.Cypher``` proerty into a new ```ICypherGraphClient``` interface.

Having this interface will allow dependencies to be taken exclusively on the cypher route into Neo4J.

It also simplifies decoration (decorator pattern) of the ```GraphClient``` because it reduces the number of members that need to be implemented. My intended use:

``` c#
// Register the client in an IoC container
container.RegisterSingle()

// Register the decorator
container.RegisterDecorator(typeof(ICypherGraphClient), typeof(ConnectingCypherGraphClientDecorator ));

// Any dependent class
public class Consumer
{
ICypherGraphClient _client;

public Consumer(ICypherGraphClient client)
{
_client = client;
}

public void DoSomething()
{
var result = _client.Cypher.Match(...).Results;
...
}
}

// Lazy connecting decorator
public class ConnectingCypherGraphClientDecorator : ICypherGraphClient
{
ICypherGraphClient _client;
bool _connected;

public CypherGraphClientDecorator (ICypherGraphClient client)
{
_client = client;
}

public ICypherFluentQuery Cypher
{
get
{
if (!_connected)
_client.Connect();

return _client.Cypher;
}
}
}
```