LaunchDarkly Dotnet Server SDK
Search Results for

    Show / Hide Table of Contents

    Class ConfigurationBuilder

    A mutable object that uses the Builder pattern to specify properties for a Configuration object.

    Inheritance
    object
    ConfigurationBuilder
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: LaunchDarkly.Sdk.Server
    Assembly: LaunchDarkly.ServerSdk.dll
    Syntax
    public sealed class ConfigurationBuilder
    Remarks

    Obtain an instance of this class by calling Builder(string).

    All of the builder methods for setting a configuration property return a reference to the same builder, so they can be chained together.

    Examples
    var config = Configuration.Builder("my-sdk-key")
        .StartWaitTime(TimeSpan.FromSeconds(5))
        .Events(Components.SendEvents().Capacity(50000))
        .Build();

    Methods

    | Edit this page View Source

    ApplicationInfo(ApplicationInfoBuilder)

    Sets the SDK's application metadata, which may be used in the LaunchDarkly analytics or other product features. This object is normally a configuration builder obtained from ApplicationInfo(), which has methods for setting individual metadata properties.

    Declaration
    public ConfigurationBuilder ApplicationInfo(ApplicationInfoBuilder applicationInfo)
    Parameters
    Type Name Description
    ApplicationInfoBuilder applicationInfo

    builder for ApplicationInfo(ApplicationInfoBuilder)

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    | Edit this page View Source

    BigSegments(IComponentConfigurer<BigSegmentsConfiguration>)

    Sets the configuration of the SDK's Big Segments feature.

    Declaration
    public ConfigurationBuilder BigSegments(IComponentConfigurer<BigSegmentsConfiguration> bigSegmentsConfig)
    Parameters
    Type Name Description
    IComponentConfigurer<BigSegmentsConfiguration> bigSegmentsConfig

    a configuration factory object returned by BigSegments(IComponentConfigurer<IBigSegmentStore>)

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    Remarks

    "Big Segments" are a specific type of user segments. For more information, read the LaunchDarkly documentation about user segments: https://docs.launchdarkly.com/home/users/segments

    If you are using this feature, you will normally specify a database implementation that matches how the LaunchDarkly Relay Proxy is configured, since the Relay Proxy manages the Big Segment data.

    By default, there is no implementation and Big Segments cannot be evaluated. In this case, any flag evaluation that references a Big Segment will behave as if no users are included in any Big Segments, and the EvaluationReason associated with any such flag evaluation will have a BigSegmentsStatus of NotConfigured.

    Examples
    // This example uses the Redis integration
    var config = Configuration.Builder(sdkKey)
        .BigSegments(Components.BigSegments(Redis.DataStore().Prefix("app1"))
            .ContextCacheSize(2000))
        .Build();
    | Edit this page View Source

    Build()

    Creates a Configuration based on the properties that have been set on the builder. Modifying the builder after this point does not affect the returned Configuration.

    Declaration
    public Configuration Build()
    Returns
    Type Description
    Configuration

    the configured Configuration object

    | Edit this page View Source

    DataSource(IComponentConfigurer<IDataSource>)

    Sets the implementation of the component that receives feature flag data from LaunchDarkly, using a factory object.

    Declaration
    public ConfigurationBuilder DataSource(IComponentConfigurer<IDataSource> dataSourceConfig)
    Parameters
    Type Name Description
    IComponentConfigurer<IDataSource> dataSourceConfig

    the factory object

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    Remarks

    Depending on the implementation, the factory may be a builder that allows you to set other configuration options as well.

    The default is StreamingDataSource(). You may instead use PollingDataSource(), ExternalUpdatesOnly, or a test fixture such as DataSource(). See those methods for details on how to configure them.

    | Edit this page View Source

    DataStore(IComponentConfigurer<IDataStore>)

    Sets the data store implementation to be used for holding feature flags and related data received from LaunchDarkly.

    Declaration
    public ConfigurationBuilder DataStore(IComponentConfigurer<IDataStore> dataStoreConfig)
    Parameters
    Type Name Description
    IComponentConfigurer<IDataStore> dataStoreConfig

    the factory object

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    Remarks

    The default is InMemoryDataStore, but you may choose to use a custom implementation such as a database integration. For the latter, you will normally use PersistentDataStore(IComponentConfigurer<IPersistentDataStore>) in conjunction with some specific type for that integration.

    This is specified as a factory because the SDK normally manages the lifecycle of the data store; it will create an instance from the factory when an LdClient is created, and dispose of that instance when disposing of the client.

    | Edit this page View Source

    DiagnosticOptOut(bool)

    Set to true to opt out of sending diagnostic events.

    Declaration
    public ConfigurationBuilder DiagnosticOptOut(bool diagnosticOptOut)
    Parameters
    Type Name Description
    bool diagnosticOptOut

    true to disable diagnostic events

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    Remarks

    Unless the diagnosticOptOut field is set to true, the client will send some diagnostics data to the LaunchDarkly servers in order to assist in the development of future SDK improvements. These diagnostics consist of an initial payload containing some details of SDK in use, the SDK's configuration, and the platform the SDK is being run on, as well as payloads sent periodically with information on irregular occurrences such as dropped events.

    | Edit this page View Source

    Events(IComponentConfigurer<IEventProcessor>)

    Sets the implementation of the component that processes analytics events.

    Declaration
    public ConfigurationBuilder Events(IComponentConfigurer<IEventProcessor> eventsConfig)
    Parameters
    Type Name Description
    IComponentConfigurer<IEventProcessor> eventsConfig

    a builder/factory object for event configuration

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    Remarks

    The default is SendEvents(), but you may choose to set it to a customized EventProcessorBuilder, a custom implementation (for instance, a test fixture), or disable events with NoEvents.

    | Edit this page View Source

    Hooks(HookConfigurationBuilder)

    Configures the SDK's user-defined hooks.

    Declaration
    public ConfigurationBuilder Hooks(HookConfigurationBuilder hooksConfig)
    Parameters
    Type Name Description
    HookConfigurationBuilder hooksConfig

    the hook configuration

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    | Edit this page View Source

    Http(IComponentConfigurer<HttpConfiguration>)

    Sets the SDK's networking configuration, using a builder object that is obtained from HttpConfiguration(), which has methods for setting individual HTTP-related properties.

    Declaration
    public ConfigurationBuilder Http(IComponentConfigurer<HttpConfiguration> httpConfig)
    Parameters
    Type Name Description
    IComponentConfigurer<HttpConfiguration> httpConfig

    a builder object for HTTP configuration

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    | Edit this page View Source

    Logging(ILogAdapter)

    Sets the SDK's logging destination.

    Declaration
    public ConfigurationBuilder Logging(ILogAdapter logAdapter)
    Parameters
    Type Name Description
    ILogAdapter logAdapter

    an ILogAdapter for the desired logging implementation

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    Remarks

    This is a shortcut for Logging(Components.Logging(logAdapter)). You can use it when you only want to specify the basic logging destination, and do not need to set other log properties.

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

    Examples

    var config = Configuration.Builder("my-sdk-key") .Logging(Logs.ToWriter(Console.Out)) .Build();

    | Edit this page View Source

    Logging(IComponentConfigurer<LoggingConfiguration>)

    Sets the SDK's logging configuration, using a builder object that is obtained from Logging() which has methods for setting individual logging-related properties.

    Declaration
    public ConfigurationBuilder Logging(IComponentConfigurer<LoggingConfiguration> loggingConfig)
    Parameters
    Type Name Description
    IComponentConfigurer<LoggingConfiguration> loggingConfig

    a builder object for logging configuration

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    Remarks

    As a shortcut for disabling logging, you may use NoLogging instead. If all you want to do is to set the basic logging destination, and you do not need to set other logging properties, you can use Logging(ILogAdapter).

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

    Examples

    var config = Configuration.Builder("my-sdk-key") .Logging(Components.Logging().Level(LogLevel.Warn))) .Build();

    See Also
    Logging()
    Logging(ILogAdapter)
    NoLogging
    Logging(ILogAdapter)
    | Edit this page View Source

    Offline(bool)

    Sets whether or not this client is offline. If true, no calls to Launchdarkly will be made.

    Declaration
    public ConfigurationBuilder Offline(bool offline)
    Parameters
    Type Name Description
    bool offline

    true if the client should remain offline

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    | Edit this page View Source

    SdkKey(string)

    Sets the SDK key for your LaunchDarkly environment.

    Declaration
    public ConfigurationBuilder SdkKey(string sdkKey)
    Parameters
    Type Name Description
    string sdkKey

    the SDK key

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    | Edit this page View Source

    ServiceEndpoints(ServiceEndpointsBuilder)

    Sets the SDK's service URIs, using a configuration builder obtained from ServiceEndpoints().

    Declaration
    public ConfigurationBuilder ServiceEndpoints(ServiceEndpointsBuilder serviceEndpointsBuilder)
    Parameters
    Type Name Description
    ServiceEndpointsBuilder serviceEndpointsBuilder

    the subconfiguration builder object

    Returns
    Type Description
    ConfigurationBuilder

    the main configuration builder

    Remarks

    This overwrites any previous options set with ServiceEndpoints(ServiceEndpointsBuilder). If you want to set multiple options, set them on the same ServiceEndpointsBuilder.

    See Also
    ServiceEndpoints()
    ServiceEndpointsBuilder
    | Edit this page View Source

    StartWaitTime(TimeSpan)

    Sets how long the client constructor will block awaiting a successful connection to LaunchDarkly.

    Declaration
    public ConfigurationBuilder StartWaitTime(TimeSpan startWaitTime)
    Parameters
    Type Name Description
    TimeSpan startWaitTime

    the length of time to wait

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    Remarks

    Setting this to 0 will not block and will cause the constructor to return immediately. The default value is 5 seconds.

    | Edit this page View Source

    WrapperInfo(WrapperInfoBuilder)

    Set the wrapper information.

    Declaration
    public ConfigurationBuilder WrapperInfo(WrapperInfoBuilder wrapperInfo)
    Parameters
    Type Name Description
    WrapperInfoBuilder wrapperInfo

    the wrapper builder

    Returns
    Type Description
    ConfigurationBuilder

    the same builder

    Remarks

    This is intended for use with wrapper SDKs from LaunchDarkly. Additionally, any wrapper SDK may overwrite any application developer provided wrapper information.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX
    OSZAR »