Code Monkey home page Code Monkey logo

lib.featureconfig's Introduction

πŸš₯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 1.0.3
  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

lib.featureconfig's People

Contributors

ardace avatar ardacetinkaya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.