/openfeature-dotnet-server

An OpenFeature provider for the LaunchDarkly dotnet server SDK.

Primary LanguageC#OtherNOASSERTION

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

This provider allows for using LaunchDarkly with the OpenFeature SDK for .NET.

This provider is designed primarily for use in multi-user systems such as web servers and applications. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.

This provider is a beta version and should not be considered ready for production use while this message is visible.

LaunchDarkly overview

LaunchDarkly is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. Get started using LaunchDarkly today!

Twitter Follow

Supported .NET versions

This version of the SDK is built for the following targets:

  • .NET 6.0: runs on .NET 6.0 and above.
  • .NET Framework 4.7.1: runs on .NET Framework 4.7.1 and above.
  • .NET Standard 2.0: runs in any project that is targeted to .NET Standard 2.x rather than to a specific runtime platform.

Getting started

Installation

dotnet add LaunchDarkly.ServerSdk
dotnet add LaunchDarkly.OpenFeature.ServerSdk
dotnet add OpenFeature

Usage

using LaunchDarkly.OpenFeature.ServerProvider;
using LaunchDarkly.Sdk.Server;

var config = Configuration.Builder("my-sdk-key")
    .StartWaitTime(TimeSpan.FromSeconds(10))
    .Build();

var ldClient  = new LdClient(config);
var provider = new Provider(ldClient);

OpenFeature.SDK.OpenFeature.Instance.SetProvider(provider);

Refer to the SDK reference guide for instructions on getting started with using the SDK.

For information on using the OpenFeature client please refer to the OpenFeature Documentation.

OpenFeature Specific Considerations

When evaluating a User with the LaunchDarkly Server-Side SDK for .NET a string key attribute would normally be required. When using OpenFeature the targetingKey attribute should be used instead of key. If a key attribute is provided in the EvaluationContext, then it will be discarded in favor of targetingKey. If a targetingKey is not provided, or if the EvaluationContext is omitted entirely, then the defaultValue will be returned from OpenFeature evaluation methods.

Other fields normally included in a User may be added to the EvaluationContext. Any custom attributes can be added to the top level of the evaluation context, and they will operate as if they were custom attributes on an User. Attributes which are typically top level on an LDUser should be of the same types that are specified for a User or they will not operate as intended.

If a top level custom attribute is defined on the EvaluationContext, then that will be a custom attribute inside custom for a User.

Learn more

Check out our documentation for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the complete reference guide for this SDK.

The authoritative description of all properties and methods is in the TypeScript documentation.

Contributing

We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out our documentation for a complete list.
  • Explore LaunchDarkly