LaunchDarkly Dotnet Client SDK
Search Results for

    Show / Hide Table of Contents

    Class Components

    Provides configurable factories for the standard implementations of LaunchDarkly component interfaces.

    Inheritance
    object
    Components
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: LaunchDarkly.Sdk.Client
    Assembly: LaunchDarkly.ClientSdk.dll
    Syntax
    public static class Components
    Remarks

    Some of the configuration options in ConfigurationBuilder affect the entire SDK, but others are specific to one area of functionality, such as how the SDK receives feature flag updates or processes analytics events. For the latter, the standard way to specify a configuration is to call one of the static methods in Components (such as StreamingDataSource()), apply any desired configuration change to the object that that method returns (such as InitialReconnectDelay(TimeSpan)), and then use the corresponding method in ConfigurationBuilder (such as DataSource(IComponentConfigurer<IDataSource>)) to use that configured component in the SDK.

    Properties

    | Edit this page View Source

    NoEvents

    Returns a configuration object that disables analytics events.

    Declaration
    public static IComponentConfigurer<IEventProcessor> NoEvents { get; }
    Property Value
    Type Description
    IComponentConfigurer<IEventProcessor>
    Remarks

    Passing this to Events(IComponentConfigurer<IEventProcessor>) causes the SDK to discard all analytics events and not send them to LaunchDarkly, regardless of any other configuration.

    Examples
    var config = Configuration.Builder(mobileKey)
        .Events(Components.NoEvents)
        .Build();
    See Also
    Events(IComponentConfigurer<IEventProcessor>)
    SendEvents()
    | Edit this page View Source

    NoLogging

    A configuration object that disables logging.

    Declaration
    public static LoggingConfigurationBuilder NoLogging { get; }
    Property Value
    Type Description
    LoggingConfigurationBuilder
    Remarks

    This is the same as Logging(LaunchDarkly.Logging.Logs.None).

    Examples
    var config = Configuration.Builder(mobileKey)
        .Logging(Components.NoLogging)
        .Build();
    See Also
    Logging(LoggingConfigurationBuilder)
    Logging()
    Logging(ILogAdapter)
    | Edit this page View Source

    NoPersistence

    A configuration object that disables persistent storage.

    Declaration
    public static PersistenceConfigurationBuilder NoPersistence { get; }
    Property Value
    Type Description
    PersistenceConfigurationBuilder
    Remarks

    This is equivalent to Persistence().MaxCachedUsers(0).

    Examples
    var config = Configuration.Builder(mobileKey)
        .Persistence(Components.NoPersistence)
        .Build();
    See Also
    Persistence(PersistenceConfigurationBuilder)
    Persistence()

    Methods

    | Edit this page View Source

    ApplicationInfo()

    Returns a configurable builder for the SDK's application metadata.

    Declaration
    public static ApplicationInfoBuilder ApplicationInfo()
    Returns
    Type Description
    ApplicationInfoBuilder

    a configuration builder

    Remarks

    Passing this to ApplicationInfo(ApplicationInfoBuilder) after setting any desired properties on the builder, applies this configuration to the SDK.

    Examples
    var config = Configuration.Builder(mobileKey)
        .ApplicationInfo(
            Components.ApplicationInfo().ApplicationID("MyApplication").ApplicationVersion("version123abc")
        )
        .Build();
    | Edit this page View Source

    HttpConfiguration()

    Returns a configuration builder for the SDK's networking configuration.

    Declaration
    public static HttpConfigurationBuilder HttpConfiguration()
    Returns
    Type Description
    HttpConfigurationBuilder

    a builder

    Remarks

    Passing this to Http(HttpConfigurationBuilder) applies this configuration to all HTTP/HTTPS requests made by the SDK.

    Examples
    var config = Configuration.Builder(sdkKey)
        .Http(
            Components.HttpConfiguration()
                .ConnectTimeout(TimeSpan.FromMilliseconds(3000))
        )
        .Build();
    | Edit this page View Source

    Logging()

    Returns a configuration builder for the SDK's logging configuration.

    Declaration
    public static LoggingConfigurationBuilder Logging()
    Returns
    Type Description
    LoggingConfigurationBuilder

    a configurable factory object

    Remarks

    Passing this to Logging(LoggingConfigurationBuilder), after setting any desired properties on the builder, applies this configuration to the SDK.

    For a description of the default behavior, see LoggingConfigurationBuilder.

    For more about how logging works in the SDK, see the LaunchDarkly feature guide.

    Examples
    var config = Configuration.Builder(mobileKey)
        .Logging(Components.Logging().Level(LogLevel.Warn)))
        .Build();
    See Also
    Logging(LoggingConfigurationBuilder)
    Logging(ILogAdapter)
    NoLogging
    | Edit this page View Source

    Logging(ILogAdapter)

    Returns a configuration builder for the SDK's logging configuration, specifying the logging implementation.

    Declaration
    public static LoggingConfigurationBuilder Logging(ILogAdapter adapter)
    Parameters
    Type Name Description
    ILogAdapter adapter

    an ILogAdapter for the desired logging implementation

    Returns
    Type Description
    LoggingConfigurationBuilder

    a configurable factory object

    Remarks

    This is a shortcut for calling Logging() and then Adapter(ILogAdapter), to specify a logging implementation other than the default one. For details about the default implementation, see Logging().

    By default, the minimum log level is Info (that is, Debug logging is disabled). This can be overridden with Level(LogLevel).

    For more about log adapters, see Adapter(ILogAdapter).

    For more about how logging works in the SDK, see the LaunchDarkly feature guide.

    Examples
    var config = Configuration.Builder(mobileKey)
        .Logging(Components.Logging(Logs.ToConsole))
        .Build();
    See Also
    Logging(LoggingConfigurationBuilder)
    Adapter(ILogAdapter)
    Logging()
    NoLogging
    | Edit this page View Source

    Persistence()

    Returns a configuration builder for the SDK's persistent storage configuration.

    Declaration
    public static PersistenceConfigurationBuilder Persistence()
    Returns
    Type Description
    PersistenceConfigurationBuilder

    a builder

    Remarks

    Passing this to Persistence(PersistenceConfigurationBuilder), after setting any desired properties on the builder, applies this configuration to the SDK.

    Examples
    var config = Configuration.Builder(sdkKey)
        .Persistence(
            Components.Persistence().MaxCachedUsers(10)
        )
        .Build();
    See Also
    Persistence(PersistenceConfigurationBuilder)
    PersistenceConfigurationBuilder
    NoPersistence
    | Edit this page View Source

    PollingDataSource()

    Returns a configurable factory for using only polling mode to get feature flag data.

    Declaration
    public static PollingDataSourceBuilder PollingDataSource()
    Returns
    Type Description
    PollingDataSourceBuilder

    a builder for setting polling connection properties

    Remarks

    This is not the default behavior; by default, the SDK uses a streaming connection to receive feature flag data from LaunchDarkly. In polling mode, the SDK instead makes a new HTTP request to LaunchDarkly at regular intervals. HTTP caching allows it to avoid redundantly downloading data if there have been no changes, but polling is still less efficient than streaming and should only be used on the advice of LaunchDarkly support.

    The SDK may still use polling mode sometimes even when streaming mode is enabled, such as when an application is in the background. You do not need to specifically select polling mode in order for that to happen.

    To use only polling mode, call this method to obtain a builder, change its properties with the PollingDataSourceBuilder methods, and pass it to DataSource(IComponentConfigurer<IDataSource>).

    Setting Offline(bool) to true will superseded this setting and completely disable network requests.

    Examples
    var config = Configuration.Builder(mobileKey)
        .DataSource(Components.PollingDataSource()
            .PollInterval(TimeSpan.FromSeconds(45)))
        .Build();
    | Edit this page View Source

    SendEvents()

    Returns a configuration builder for analytics event delivery.

    Declaration
    public static EventProcessorBuilder SendEvents()
    Returns
    Type Description
    EventProcessorBuilder

    a builder for setting event properties

    Remarks

    The default configuration has events enabled with default settings. If you want to customize this behavior, call this method to obtain a builder, change its properties with the EventProcessorBuilder methods, and pass it to Events(IComponentConfigurer<IEventProcessor>).

    To completely disable sending analytics events, use NoEvents instead.

    Examples
    var config = Configuration.Builder(mobileKey)
        .Events(Components.SendEvents()
            .Capacity(5000)
            .FlushInterval(TimeSpan.FromSeconds(2)))
        .Build();
    See Also
    Events(IComponentConfigurer<IEventProcessor>)
    NoEvents
    | Edit this page View Source

    ServiceEndpoints()

    Returns a builder for configuring custom service URIs.

    Declaration
    public static ServiceEndpointsBuilder ServiceEndpoints()
    Returns
    Type Description
    ServiceEndpointsBuilder

    a configuration builder

    Remarks

    Passing this to ServiceEndpoints(ServiceEndpointsBuilder), after setting any desired properties on the builder, applies this configuration to the SDK.

    Most applications will never need to use this method. The main use case is when connecting to a LaunchDarkly Relay Proxy instance. For more information, see ServiceEndpointsBuilder.

    Examples
    var config = Configuration.Builder(mobileKey)
        .ServiceEndpoints(Components.ServiceEndpoints().RelayProxy("http://my-relay-hostname:80"))
        .Build();
    See Also
    ServiceEndpoints(ServiceEndpointsBuilder)
    | Edit this page View Source

    StreamingDataSource()

    Returns a configurable factory for using streaming mode to get feature flag data.

    Declaration
    public static StreamingDataSourceBuilder StreamingDataSource()
    Returns
    Type Description
    StreamingDataSourceBuilder

    a builder for setting streaming connection properties

    Remarks

    By default, the SDK uses a streaming connection to receive feature flag data from LaunchDarkly. To use the default behavior, you do not need to call this method. However, if you want to customize the behavior of the connection, call this method to obtain a builder, change its properties with the StreamingDataSourceBuilder methods, and pass it to DataSource(IComponentConfigurer<IDataSource>).

    The SDK may still use polling mode sometimes even when streaming mode is enabled, such as when an application is in the background.

    Setting Offline(bool) to true will superseded this setting and completely disable network requests.

    Examples
    var config = Configuration.Builder(mobileKey)
        .DataSource(Components.StreamingDataSource()
            .InitialReconnectDelay(TimeSpan.FromMilliseconds(500)))
        .Build();
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX