Sâu Lười
Sâu Lười

Reputation: 21

How to connect gremlin to .net as sql server?

I have a code below, it connects asp.net to gremlin. But every time I create a service, I continue to create like this code. Is there a way to create a separate file and then just call a function called this connection? Like the sql server side. I tried by creating json file. Then configure it to call it on, but I can't do it. And the code below, it has not yet optimized connection, because every time I turn off the computer, the data is lost and it is not saved. Because it can't call that database name. Is there any way? Give me the sample code. Thanks .

public class ProjectService : IProjectService
    {
        private readonly GremlinClient _client;
        private readonly GraphTraversalSource _g;

        public ProjectService()
        {
            _client = new GremlinClient(new GremlinServer(GremlinDBContext.HOST_NAME, GremlinDBContext.PORT));
            _g = Traversal().WithRemote(new DriverRemoteConnection(_client));
        }
    }

Upvotes: 0

Views: 118

Answers (1)

stephen mallette
stephen mallette

Reputation: 46226

While there is an approach to configuring the driver with a file in Java, other language variants, like .NET do not. There should be more consistency there. There is an open issue that looks to better address this issue: TINKERPOP-2379.

That said, I would offer that you not create one GremlinClient for your application and make it available to all your service implementations, or perhaps even one _g really.

it has not yet optimized connection, because every time I turn off the computer, the data is lost and it is not saved.

I've addressed your data persistence problems in other questions: here and here

Upvotes: 1

Related Questions