Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

A simple feature toggling library for ASP.NET Core applications. It is a kind of service extension to be able to roll out some custom features. The library also helps to imit the availability of a feature by date.

License

ardacetinkaya/Lib.FeatureConfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚥Lib.FeatureConfig

Build Nuget
Build status NuGet version (Lib.FeatureConfig)

Overview

Feature toggling helps to deliver new features/functions to users quickly without need to change any code. With just small configuration change it helps to reflect change in a feature. Also feature toggling helps A/B testing of an application. Fore more info about feature toggle, check;

Lib.FeatureConfig is a simple(I mean very very simple) service extension for ASP.NET Core applications. It also provides enabling feature for a limited date.

Usage

  1. Add Lib.FeatureConfig Nuget package to ASP.NET Core project. https://www.nuget.org/packages/Lib.FeatureConfig/
dotnet add package Lib.FeatureConfig --version 2.0.0
  1. AddFeatures() service extension to services within ConfigureServices method in Startup.cs
        public void ConfigureServices(IServiceCollection services)
        {
            ...
            ..
            .
            services.AddFeatures();

            services.AddRazorPages()
                .AddNewtonsoftJson();
        }
  1. Add feature(s) info to appsettings.json file as;
  "Features": [
    {
      "Name": "Mars",
      "StartDate": null,
      "EndDate": null
    }
  ]

If StartDate and EndDate is given the feature is set to be enabled within that period. If only StartDate is present, it means that the feature is enabled begining from that date. If only EndDate is present, the feature is enabled until that date.

  1. Add IFeatureService instance to API Controller or Razor Page with built-in DI(Dependency Injection) in ASP.NET Core. And check if a feature is enabled or not with IsEnabled([featureName]) method.
    public class IndexModel : PageModel
    {
        IFeatureService _features;

        public string Planet { get; set; } = "World";
        public IndexModel(IFeatureService features)
        {
            _features = features;
        }
        public void OnGet()
        {
            var test = _features.IsEnabled("Mars");
            if (test)
            {
                Planet = "Mars";
            }
        }
    }
  1. Feel free to fork, open issue or copy all content 😊
  • This repository is also created to demostrate/present manage a project in GitHub, .NET Core development, Azure DevOps pipeline, Nuget.org package management and some development aspects for development teams. If you have any questions or feedbacks, feel free open an issue

About

A simple feature toggling library for ASP.NET Core applications. It is a kind of service extension to be able to roll out some custom features. The library also helps to imit the availability of a feature by date.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages