You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
LaunchDarkly.ClientSDK does not allow for multiple instances to be able to connect to multiple environments or get flags from multiple projects
Describe the solution you'd like
I would like to be able to instantiate multiple LDClient instances.
At a glance, it looks like there are no static properties that would cause complications if you could just instantiate multiple instances.
The only problem appears to be because of the built in singleton pattern, but if there were public methods to instantiate a non-singleton instance, then it would be pretty clear to the user that they were intentionally creating an instance that won't be accessible from the built in singleton pattern
Describe alternatives you've considered
there may be some hacky reflection to bypass the Init/CreateInstance methods and call the constructor directly. But that would be error prone
Additional context
The text was updated successfully, but these errors were encountered:
Thank you @dlprows for taking the time to write this feature request. We are moving in the direction of all SDKs supporting N many instantiations and moving away from the singleton pattern. I will make sure we have this request logged in our backlog.
Is your feature request related to a problem? Please describe.
LaunchDarkly.ClientSDK does not allow for multiple instances to be able to connect to multiple environments or get flags from multiple projects
Describe the solution you'd like
I would like to be able to instantiate multiple LDClient instances.
The LdClient.CreateInstance method specifically throws an exception if you try to instantiate multiple instances
https://github.com/launchdarkly/dotnet-core/blob/main/pkgs/sdk/client/src/LdClient.cs#L624
At a glance, it looks like there are no static properties that would cause complications if you could just instantiate multiple instances.
The only problem appears to be because of the built in singleton pattern, but if there were public methods to instantiate a non-singleton instance, then it would be pretty clear to the user that they were intentionally creating an instance that won't be accessible from the built in singleton pattern
Describe alternatives you've considered
there may be some hacky reflection to bypass the Init/CreateInstance methods and call the constructor directly. But that would be error prone
Additional context
The text was updated successfully, but these errors were encountered: