LaunchDarkly OpenFeature provider for the Server-Side SDK for .NET
Search Results for

    Show / Hide Table of Contents

    Class Provider

    An OpenFeature OpenFeature.FeatureProvider which enables the use of the LaunchDarkly Server-Side SDK for .NET with OpenFeature.

    Inheritance
    object
    FeatureProvider
    Provider
    Inherited Members
    FeatureProvider.GetProviderHooks()
    FeatureProvider.GetEventChannel()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: LaunchDarkly.OpenFeature.ServerProvider
    Assembly: LaunchDarkly.OpenFeature.ServerProvider.dll
    Syntax
    public sealed class Provider : FeatureProvider
    Examples

    var provider = new Provider(Configuration.Builder("my-sdk-key").Build());

    OpenFeature.Api.Instance.SetProvider(provider);

    var client = OpenFeature.Api.Instance.GetClient();

    Constructors

    | Edit this page View Source

    Provider(Configuration)

    Construct a new instance of the provider with the given configuration.

    Declaration
    public Provider(Configuration config)
    Parameters
    Type Name Description
    Configuration config

    A client configuration object

    | Edit this page View Source

    Provider(string)

    Construct a new instance of the provider with the given SDK key.

    Declaration
    public Provider(string sdkKey)
    Parameters
    Type Name Description
    string sdkKey

    The SDK key

    Methods

    | Edit this page View Source

    GetClient()

    Get the underlying client instance.

    If the initialization/shutdown features of OpenFeature are being used, then the returned client instance may be shutdown if the provider has been removed from the OpenFeature API instance.

    This client instance can be used to take advantage of features which are not part of OpenFeature. For instance using migration flags.

    Declaration
    public ILdClient GetClient()
    Returns
    Type Description
    ILdClient

    The LaunchDarkly client instance

    | Edit this page View Source

    GetMetadata()

    Metadata describing the provider.

    Declaration
    public override Metadata GetMetadata()
    Returns
    Type Description
    Metadata

    OpenFeature.Model.Metadata

    Overrides
    OpenFeature.FeatureProvider.GetMetadata()
    | Edit this page View Source

    InitializeAsync(EvaluationContext, CancellationToken)

    This method is called before a provider is used to evaluate flags. Providers can overwrite this method, if they have special initialization needed prior being called for flag evaluation. When this method completes, the provider will be considered ready for use.

    Declaration
    public override Task InitializeAsync(EvaluationContext context, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    EvaluationContext context

    OpenFeature.Model.EvaluationContext

    CancellationToken cancellationToken

    The CancellationToken to cancel any async side effects.

    Returns
    Type Description
    Task

    A task that completes when the initialization process is complete.

    Overrides
    FeatureProvider.InitializeAsync(EvaluationContext, CancellationToken)
    Remarks

    Providers not implementing this method will be considered ready immediately.

    | Edit this page View Source

    ResolveBooleanValueAsync(string, bool, EvaluationContext, CancellationToken)

    Resolves a boolean feature flag

    Declaration
    public override Task<ResolutionDetails<bool>> ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string flagKey

    Feature flag key

    bool defaultValue

    Default value

    EvaluationContext context

    OpenFeature.Model.EvaluationContext

    CancellationToken cancellationToken

    The CancellationToken.

    Returns
    Type Description
    Task<ResolutionDetails<bool>>

    OpenFeature.Model.ResolutionDetails<T>

    Overrides
    FeatureProvider.ResolveBooleanValueAsync(string, bool, EvaluationContext, CancellationToken)
    | Edit this page View Source

    ResolveDoubleValueAsync(string, double, EvaluationContext, CancellationToken)

    Resolves a double feature flag

    Declaration
    public override Task<ResolutionDetails<double>> ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string flagKey

    Feature flag key

    double defaultValue

    Default value

    EvaluationContext context

    OpenFeature.Model.EvaluationContext

    CancellationToken cancellationToken

    The CancellationToken.

    Returns
    Type Description
    Task<ResolutionDetails<double>>

    OpenFeature.Model.ResolutionDetails<T>

    Overrides
    FeatureProvider.ResolveDoubleValueAsync(string, double, EvaluationContext, CancellationToken)
    | Edit this page View Source

    ResolveIntegerValueAsync(string, int, EvaluationContext, CancellationToken)

    Resolves a integer feature flag

    Declaration
    public override Task<ResolutionDetails<int>> ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string flagKey

    Feature flag key

    int defaultValue

    Default value

    EvaluationContext context

    OpenFeature.Model.EvaluationContext

    CancellationToken cancellationToken

    The CancellationToken.

    Returns
    Type Description
    Task<ResolutionDetails<int>>

    OpenFeature.Model.ResolutionDetails<T>

    Overrides
    FeatureProvider.ResolveIntegerValueAsync(string, int, EvaluationContext, CancellationToken)
    | Edit this page View Source

    ResolveStringValueAsync(string, string, EvaluationContext, CancellationToken)

    Resolves a string feature flag

    Declaration
    public override Task<ResolutionDetails<string>> ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string flagKey

    Feature flag key

    string defaultValue

    Default value

    EvaluationContext context

    OpenFeature.Model.EvaluationContext

    CancellationToken cancellationToken

    The CancellationToken.

    Returns
    Type Description
    Task<ResolutionDetails<string>>

    OpenFeature.Model.ResolutionDetails<T>

    Overrides
    FeatureProvider.ResolveStringValueAsync(string, string, EvaluationContext, CancellationToken)
    | Edit this page View Source

    ResolveStructureValueAsync(string, Value, EvaluationContext, CancellationToken)

    Resolves a structured feature flag

    Declaration
    public override Task<ResolutionDetails<Value>> ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string flagKey

    Feature flag key

    Value defaultValue

    Default value

    EvaluationContext context

    OpenFeature.Model.EvaluationContext

    CancellationToken cancellationToken

    The CancellationToken.

    Returns
    Type Description
    Task<ResolutionDetails<Value>>

    OpenFeature.Model.ResolutionDetails<T>

    Overrides
    FeatureProvider.ResolveStructureValueAsync(string, Value, EvaluationContext, CancellationToken)
    | Edit this page View Source

    ShutdownAsync(CancellationToken)

    This method is called when a new provider is about to be used to evaluate flags, or the SDK is shut down. Providers can overwrite this method, if they have special shutdown actions needed.

    Declaration
    public override Task ShutdownAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    The CancellationToken to cancel any async side effects.

    Returns
    Type Description
    Task

    A task that completes when the shutdown process is complete.

    Overrides
    FeatureProvider.ShutdownAsync(CancellationToken)
    | Edit this page View Source

    Track(string, EvaluationContext, TrackingEventDetails)

    Track a user action or application state, usually representing a business objective or outcome. The implementation of this method is optional.

    Declaration
    public override void Track(string trackingEventName, EvaluationContext evaluationContext = null, TrackingEventDetails trackingEventDetails = null)
    Parameters
    Type Name Description
    string trackingEventName

    The name associated with this tracking event

    EvaluationContext evaluationContext

    The evaluation context used in the evaluation of the flag (optional)

    TrackingEventDetails trackingEventDetails

    Data pertinent to the tracking event (Optional)

    Overrides
    FeatureProvider.Track(string, EvaluationContext, TrackingEventDetails)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX