From df8429272a9fb6404d74d2126d154519887a9f1a Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:09:55 +0200 Subject: [PATCH 1/2] feat(onboarding): dotnet snippet --- .../onboarding/dialog/snippets/dotnet.md | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/onboarding/dialog/snippets/dotnet.md b/frontend/src/component/onboarding/dialog/snippets/dotnet.md index 9f965ba725e6..c67d5c2d7c2d 100644 --- a/frontend/src/component/onboarding/dialog/snippets/dotnet.md +++ b/frontend/src/component/onboarding/dialog/snippets/dotnet.md @@ -8,13 +8,48 @@ dotnet add package Newtonsoft.Json 2\. Initialize Unleash ```csharp using Unleash; +using Unleash.ClientFactory; + +public class Program +{ + public static async Task Main() + { + var settings = new UnleashSettings() + { + AppName = "unleash-onboarding-dotnet", + UnleashApi = new Uri(""), + SendMetricsInterval = TimeSpan.FromSeconds(1), + CustomHttpHeaders = new Dictionary() + { + {"Authorization",Environment.GetEnvironmentVariable("")} + } + }; + + var unleash = new DefaultUnleash(settings); + + while (true) { + Console.WriteLine($"Flag is enabled: {unleash.IsEnabled("")}"); + await Task.Delay(1000); + } + } +} + +``` + +--- +```csharp var settings = new UnleashSettings() { AppName = "unleash-onboarding-dotnet", UnleashApi = new Uri(""), + SendMetricsInterval = TimeSpan.FromSeconds(1), CustomHttpHeaders = new Dictionary() { - {"Authorization","" } + {"Authorization",Environment.GetEnvironmentVariable("UNLEASH_API_KEY")} } }; ``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/unleash-client-dotnet) +- [.NET/C# SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Csharp) From 0fb80a2b02e4e4faa67eda2bb9507bc8c9dee71d Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:25:38 +0200 Subject: [PATCH 2/2] Update dotnet.md --- frontend/src/component/onboarding/dialog/snippets/dotnet.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/component/onboarding/dialog/snippets/dotnet.md b/frontend/src/component/onboarding/dialog/snippets/dotnet.md index c67d5c2d7c2d..c0827a26efb0 100644 --- a/frontend/src/component/onboarding/dialog/snippets/dotnet.md +++ b/frontend/src/component/onboarding/dialog/snippets/dotnet.md @@ -18,10 +18,10 @@ public class Program { AppName = "unleash-onboarding-dotnet", UnleashApi = new Uri(""), - SendMetricsInterval = TimeSpan.FromSeconds(1), + SendMetricsInterval = TimeSpan.FromSeconds(5), CustomHttpHeaders = new Dictionary() { - {"Authorization",Environment.GetEnvironmentVariable("")} + {"Authorization",""} } }; @@ -42,7 +42,6 @@ var settings = new UnleashSettings() { AppName = "unleash-onboarding-dotnet", UnleashApi = new Uri(""), - SendMetricsInterval = TimeSpan.FromSeconds(1), CustomHttpHeaders = new Dictionary() { {"Authorization",Environment.GetEnvironmentVariable("UNLEASH_API_KEY")}