Create multiple instances of IGremlinQuerySource #1164
Unanswered
banchmaxedgedenergy
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everybody,
I have a requirement to create several instances of IGremlinQuerySource, each instance should work with different graph, the db uri and db name can be the same, however the graph name should differ.
I checked code, and found that IGremlinQuerySource instance is created of type QuerySource in ServiceCollectionExtensions.cs class (src/Core.AspNet/Extensions/ServiceCollectionExtensions.cs), as a part of AddGremlinq() method, where internally AddSingleton<>() registration in DI is done.
So there is no way to create several instances that uses different environment settings, since it's singleton. At the same time, one of the tests (test/Core.AspNet.Tests/ProviderConfigurationSectionTests.cs) shows how to specify and the choose different db settings. However it affects only one instance (since as I mentioned, IGremlinQuerySource is declared as a singleton).
My idea is to alter AddGremlinq() to pass configuration name to this method, and then register named instance of IGremlinQuerySource... But two questions disturb me:
Thank you and kind regards!
Beta Was this translation helpful? Give feedback.
All reactions