8000 LaunchDarkly.ClientSDK does not allow multiple instances · Issue #92 · launchdarkly/dotnet-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
LaunchDarkly.ClientSDK does not allow multiple instances #92
Open
@dlprows

Description

@dlprows

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0