public void Init() { CoverGraphDatabaseSettings settings = new CoverGraphDatabaseSettings() { DatabaseLogin = "******", DatabasePassword = "******", Url = "http://localhost:7474/db/data" }; CoverGraphDatabaseClientFactory factory = new CoverGraphDatabaseClientFactory(settings); _userRepository = new UserRepository(factory); }
public UserRepository(CoverGraphDatabaseClientFactory factory) { _client = factory.GetClient(); _client.Connect(); var count = _client.Cypher .Match("(n)") .Return <int>("count(n)").Results .FirstOrDefault(); if (count == 0) { _client.Cypher .CreateUniqueConstraint("n:User", "n.login"); } }