Giter VIP home page Giter VIP logo

dynamic-appsettings's Introduction

Dynamicly Edit AppSettings From Database Realtime

Since the constants in appsettings take up a lot of space in the service layer over time, it is aimed to provide a more organized development environment by keeping these constants in a table on the database.

Kullanım/Örnekler

Services Layer

private readonly ConfigurationRepository _configurationRepository;
private readonly Dictionary<string, object> _appSettings;

 public ConfigurationService(ConfigurationRepository configurationRepository)
    {
        _configurationRepository = configurationRepository;
        _appSettings = _configurationRepository.ConfigurationList().Result;
    }
    
    public bool GetValue<T>(string key, ref T value)
    {
        if (_appSettings.TryGetValue(key, out var result))
        {
            value = (T)result;
            return true;
        }
        else
        {
            return false;
        }
    }

Ekran Görüntüleri

Uygulama Ekran Görüntüsü

You can change AppSettings value from database

MainController

private readonly ConfigurationService _configurationService;

public Main(IConfiguration configuration, ConfigurationService configurationService)
{
    _configurationService = configurationService;

    // This is the property that I want to change dynamically 
    //from Database Example : Propert100
    
    configurationService.GetValue<string>("Property100", ref _property100);
}

dynamic-appsettings's People

Contributors

mertcanduldul avatar

Stargazers

 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.