3

How do I create an embedded Neo4j database in c#? I want to perform queries on this embedded database for testing and then discard it. Currently i'm using neo4jclient for performing queries on the database running on my system(localhost) but want to do this on an embedded database. How do I go about this?

This feature is present in Java in the following way:

GraphDatabaseFactory graphDbFactory = new GraphDatabaseFactory();
GraphDatabaseService graphDb = graphDbFactory
      .newEmbeddedDatabase("data/dbName");

Looking for something along these lines in c#.

Nitin Labhishetty
  • 1,290
  • 2
  • 21
  • 41
  • Why do you want to do that? Perhaps understanding your actual problem can help solve it? – Michael Hunger Jun 17 '15 at 20:12
  • I'm writing unit, integration tests for crud operations on the database. This involves adding and removing some data to the database. Don't want to risk messing around with data already present in a database, hence looking for an embedded db that can be used only for the purpose of testing. – Nitin Labhishetty Jun 17 '15 at 20:23
  • Did you manage to do this? I'm trying to achieve the same thing and I would love some guidance on where to start – Fran Casadome Oct 07 '16 at 03:47
  • I had to create a new instance of Neo4j purely for testing. Couldn't find a way to create an embedded db. – Nitin Labhishetty Oct 07 '16 at 06:44

1 Answers1

6

It's not possible to do that.

Neo4j is a Java application and you need JVM to run it.

What you can try is IKVM.NET to run Neo4j in the .NET VM and call those methods from C# code.

You mentioned you want to embedded db for integration testings. I suggest to start new instance of Neo4j as part of test run. Only for testing purposes.

MicTech
  • 42,457
  • 14
  • 62
  • 79
  • 1
    Mentioning the .NET client here is superfluous. The OP already mentioned using neo4jclient and attaching to an instance of Neo4j. This was strictly a question about using an embedded version from a .net app. – David Makogon Jun 17 '15 at 13:45