This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.FeatureManagement; | |
static async Task Main(string[] args) | |
{ | |
var connectionString = Environment.GetEnvironmentVariable("ConnectionString"); | |
IConfigurationRoot configuration = | |
new ConfigurationBuilder() | |
.AddAzureAppConfiguration(options => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Azure.Functions.Worker; | |
using Microsoft.Azure.Functions.Worker.Http; | |
using Microsoft.Extensions.Configuration.AzureAppConfiguration; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.FeatureManagement; | |
using System.Net; | |
namespace FeatureFlagIsolatedFunctionsApp | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.Hosting; | |
using Microsoft.FeatureManagement; | |
var host = new HostBuilder() | |
.ConfigureAppConfiguration(builder => | |
{ | |
// Read connection string from environment variable | |
string connectionString = Environment.GetEnvironmentVariable("ConnectionString", EnvironmentVariableTarget.User)!; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.Http; | |
using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes; | |
using Microsoft.Extensions.Configuration.AzureAppConfiguration; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.FeatureManagement; | |
using Microsoft.OpenApi.Models; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Azure.Functions.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.FeatureManagement; | |
using System; | |
[assembly: FunctionsStartup(typeof(FeatureFlagFunction.Startup))] | |
namespace FeatureFlagFunction | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.FeatureManagement; | |
[Route("api/[controller]")] | |
[ApiController] | |
public class FeatureFlagController : ControllerBase | |
{ | |
private readonly IFeatureManager _featureManager; | |
public FeatureFlagController(IFeatureManager featureManager) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Initialize | |
dotnet user-secrets init | |
## Add New ConnectionString | |
dotnet user-secrets set ConnectionStrings:AppConfig "{App-Config-Service-Connection-String}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.Configuration.AzureAppConfiguration; | |
using Microsoft.FeatureManagement; | |
// Below code is shown as top level statements | |
// It should be present inside Main method if top level statements are not enabled. | |
var builder = WebApplication.CreateBuilder(args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeBusinessService | |
{ | |
private readonly IFeatureFlagService _featureFlagService; | |
public SomeBusinessService(IFeatureFlagService featureFlagService) | |
{ | |
_featureFlagService = featureFlagService; | |
} | |
public async Task SomeFunctionality() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------------------------------------------- | |
// File - Program.cs | |
// ----------------------------------------------------- | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.Hosting; | |
var host = new HostBuilder() | |
.ConfigureAppConfiguration(builder => | |
{ | |
string cs = Environment.GetEnvironmentVariable("ConnectionString", EnvironmentVariableTarget.User)!; |