I need to connect to my memgraph server (runs through docker), but any basic example I try ends up with a null reference exception when running any query.
The code I am using is:
public async void DatabaseConnectionTest()
{
IDriver driver = GraphDatabase.Driver("bolt://127.0.0.1:7687", AuthTokens.None);
IAsyncSession session = driver.AsyncSession();
try
{
IResultCursor cursor = await session.RunAsync("CREATE (n: TestNode) RETURN n");
await cursor.ConsumeAsync();
}
catch(Exception e)
{
Console.WriteLine($"Exception {e.Message}");
}
finally
{
await session.CloseAsync();
}
await driver.DisposeAsync();
}
When trying to run this code, I get a "NullReferenceException" to this line:
IResultCursor cursor = await session.RunAsync("CREATE (n: TestNode) RETURN n");
Am I doing something completely wrong? What am I missing.
Thanks in advance!