source/FeatureManagement/source/SampleApp/Functions/FeatureFlaggedFunction.cs
/// <summary>
/// Demonstrate how we can use FeatureManager to switch on a feature flag.
///
/// See the integration tests for this method for more on how it works, and how it can be tested.
/// </summary>
Demonstrate how we can use FeatureManager to switch on a feature flag.

See the integration tests for this method for more on how it works, and how it can be tested.
Demonstrate how we can use FeatureManager to switch on a feature flag . See the integration tests for this method for more on how it works and how it can be tested .
[Function(nameof(GetMessageAsync))]
        public async Task<HttpResponseData> GetMessageAsync(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "message")]
            HttpRequestData request)
        {
            var response = request.CreateResponse(HttpStatusCode.OK);
            response.Headers.Add("Content-Type", "text/plain; charset=utf-8");
            var isFeatureEnabled = await FeatureManager.IsEnabledAsync(nameof(FeatureFlags.Names.UseGuidMessage));
            if (isFeatureEnabled)
            {
                response.WriteString(Guid.NewGuid().ToString());
                return response;
            }
            response.WriteString("Static message text");
            return response;
        }
[ Function ( nameof ( GetMessageAsync ) ) ] public async Task < HttpResponseData > GetMessageAsync ( [ HttpTrigger ( AuthorizationLevel . Anonymous , " " , Route = " " ) ] HttpRequestData request ) { var response = request . CreateResponse ( HttpStatusCode . OK ) ; response . Headers . Add ( " " , " " ) ; var isFeatureEnabled = await FeatureManager . IsEnabledAsync ( nameof ( FeatureFlags . Names . UseGuidMessage ) ) ; if ( isFeatureEnabled ) { response . WriteString ( Guid . NewGuid ( ) . ToString ( ) ) ; return response ; } response . WriteString ( " " ) ; return response ; }
Demonstrate how we can use FeatureManager to switch on a feature flag.
Demonstrate how we can use FeatureManager to switch on a feature flag .
// If the feature is enabled, we return a Guid instead of the static message.
HttpRequestData
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "message")]