This file contains hidden or 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.FeatureManagement.Mvc; | |
namespace MusicStore.Web.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
... | |
[FeatureGate(Features.Promotions)] | |
public async Task<IActionResult> Promotions() |
This file contains hidden or 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
namespace MusicStore.Shared.FeatureManagement | |
{ | |
public static class Features | |
{ | |
public const string Promotions = "Promotion"; | |
public const string PromotionDiscounts = "Promotion.Discounts"; | |
public const string UserSuggestions = "Suggestion.User"; | |
} | |
} |
This file contains hidden or 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
@addTagHelper *, Microsoft.FeatureManagement.AspNetCore |
This file contains hidden or 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
@model HomeViewModel | |
@{ | |
ViewData["Title"] = "Home Page"; | |
} | |
<div class="text-center"> | |
<feature name="@Features.PromotionDiscounts" negate="true"><h1 class="display-4">Enjoy the latest music from your favorite artist</h1></feature> | |
<feature name="@Features.PromotionDiscounts"><h1 class="display-4">Enjoy 25% off for selected albums from your favorite artist</h1></feature> | |
... |
This file contains hidden or 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.FeatureManagement.Mvc; | |
namespace MusicStore.Web.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
private readonly ILogger<HomeController> _logger; | |
private readonly IAlbumService _albumService; | |
private readonly IFeatureManager _featureManager; |
This file contains hidden or 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
namespace Microsoft.FeatureManagement | |
{ | |
public enum RequirementType | |
{ | |
Any = 0, // The enabled state will be attained if any feature in the set is enabled. | |
All = 1 // The enabled state will be attained if all features in the set are enabled. | |
} | |
} |
This file contains hidden or 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.FeatureManagement.Mvc; | |
namespace MusicStore.Web.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
... | |
[FeatureGate(RequirementType.All, Features.Promotions, Features.PromotionDiscounts)] | |
public async Task<IActionResult> Promotions() |
This file contains hidden or 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
<div class="container"> | |
... | |
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse"> | |
<ul class="navbar-nav flex-grow-1"> | |
... | |
<feature name="@Features.Promotions, @Features.PromotionDiscounts" requirement="All"> | |
<li class="nav-item"> |
This file contains hidden or 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
{ | |
... | |
"FeatureManagement": { | |
... | |
"Suggestion.User": { | |
"EnabledFor": [ | |
{ | |
"Name": "AlwaysOn" |
This file contains hidden or 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
{ | |
... | |
"FeatureManagement": { | |
... | |
"Suggestion.User": { | |
"EnabledFor": [ | |
{ | |
"Name": "Microsoft.Percentage", |