cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Cant get HelloWorld running in .Net App

CodeCase
Node Link

Hi and thank you for neo4j,

we would like to use it in Version 4.x inside a Windows App.

So I decided to start with the tutorial from https://neo4j.com/developer/dotnet/#dotnet-driver

but getting an errormessage and cant find any informations how to fix that:

'IDriver' does not contain a definition for 'Session' and no accessible extension method 'Session'

for the following code:

using (var session = _driver.Session())

Are there any news for neo4j 4.0.0 that not working with the old (1.7) documentation?
Same on Stackoverflow: https://stackoverflow.com/questions/59581789/why-does-idriver-not-contain-a-definition-for-session-w...

Thank you and best regrads

1 ACCEPTED SOLUTION

CodeCase
Node Link

Works with:


        IDriver driver = GraphDatabase.Driver("neo4j://localhost:7687", AuthTokens.Basic("username", "pasSW0rd"));
        IAsyncSession session = driver.AsyncSession(o => o.WithDatabase("neo4j"));
        try
        {
            IResultCursor cursor = await session.RunAsync("CREATE (n) RETURN n");
            await cursor.ConsumeAsync();
        }
        finally
        {
            await session.CloseAsync();
        }

        await driver.CloseAsync();

View solution in original post

1 REPLY 1

CodeCase
Node Link

Works with:


        IDriver driver = GraphDatabase.Driver("neo4j://localhost:7687", AuthTokens.Basic("username", "pasSW0rd"));
        IAsyncSession session = driver.AsyncSession(o => o.WithDatabase("neo4j"));
        try
        {
            IResultCursor cursor = await session.RunAsync("CREATE (n) RETURN n");
            await cursor.ConsumeAsync();
        }
        finally
        {
            await session.CloseAsync();
        }

        await driver.CloseAsync();