All Projects → existall → SimpleConfig

existall / SimpleConfig

Licence: MIT license
No description or website provided.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to SimpleConfig

Configuration
A module to help other modules have settings
Stars: ✭ 135 (+513.64%)
Mutual labels:  settings
Laravel App Settings
Store settings in database with a manager UI for your Laravel app
Stars: ✭ 220 (+900%)
Mutual labels:  settings
DpdtInject
Highly efficient compile-time general purpose DI container based on C# source generators.
Stars: ✭ 25 (+13.64%)
Mutual labels:  di-container
Licenseplist
A license list generator of all your dependencies for iOS applications
Stars: ✭ 1,996 (+8972.73%)
Mutual labels:  settings
Qtmvvm
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
Stars: ✭ 205 (+831.82%)
Mutual labels:  settings
Control Uwp
🌚🌓Alternative Control Panel for Windows 10
Stars: ✭ 237 (+977.27%)
Mutual labels:  settings
React Native Android Open Settings
Open android settings from your react native app
Stars: ✭ 124 (+463.64%)
Mutual labels:  settings
hypo-container
A dependency injection container.
Stars: ✭ 16 (-27.27%)
Mutual labels:  di-container
Mac
macOS Mojave v. 10.14 setup for developers.
Stars: ✭ 209 (+850%)
Mutual labels:  settings
android-rxlocationsettings
An easy way to ensure the settings before requesting location using RxJava.
Stars: ✭ 43 (+95.45%)
Mutual labels:  settings
Simple Settings
A simple way to manage your project settings.
Stars: ✭ 165 (+650%)
Mutual labels:  settings
Django Environ
Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.
Stars: ✭ 2,425 (+10922.73%)
Mutual labels:  settings
Django Dynamic Preferences
Dynamic global and instance settings for your django project
Stars: ✭ 238 (+981.82%)
Mutual labels:  settings
Dotfiles
Config for vim sublime awesome xmonad etc.
Stars: ✭ 140 (+536.36%)
Mutual labels:  settings
OBS Settings Manager
Backup your OBS Studio profiles and manage them in an easy, user friendly way.
Stars: ✭ 20 (-9.09%)
Mutual labels:  settings
Nova Settings Tool
Laravel Nova tool to view and edit application settings.
Stars: ✭ 131 (+495.45%)
Mutual labels:  settings
Settings View
🔧 Edit Atom settings
Stars: ✭ 226 (+927.27%)
Mutual labels:  settings
Optino
Fully collateralised vanilla and bounded (capped call and floored put) crypto options
Stars: ✭ 16 (-27.27%)
Mutual labels:  options
NSE-Stock-Scanner
National Stock Exchange (NSE), India based Stock screener program. Supports Live Data, Swing / Momentum Trading, Intraday Trading, Connect to online brokers as Zerodha Kite, Risk Management, Emotion Control, Screening, Strategies, Backtesting, Automatic Stock Downloading after closing, live free day trading data and much more
Stars: ✭ 78 (+254.55%)
Mutual labels:  options
python-api
Trading API for Quedex Bitcoin Derivatives Exchange.
Stars: ✭ 20 (-9.09%)
Mutual labels:  options

ExistsForAll

ExistsForAll.SimpleSetting (previously SimpleConfig)

Installation

Install-Package ExistForAll.SimpleSettings

Table of Content

1.Introduction
2.Getting started
3.Building the collection
4.Building Config Interfaces
5.DefaultValue
6.Build Section Binders
7.Extending SimpleConfig

Introduction - or why SimpleConfig was created

With the release of Asp.Net Core and .Net Core Microsoft has introduced IOptions<>. While IOptions<> is a great concept it lacks in implementation. IOptions<> provide a way to insert parameters into your app dynamically.

For example you have an email service that requires some URL to the email server.

public class EmailSender
{
    public EmailSender(string emailServiceUrl, ... )
    {

    }
}

All of the good IOC containers out there will tell you that injecting a string into a service is a bad idea. The best of them won't let you do it.

IOptions<> to the rescue, with IOptions<> you can request the option class that can provide the string you want provided from any data store you want (json file, database and so on).

public class EmailSender
{
    public EmailSender(IOption<EmailProviderConfiguratation> configuration, ... ) { }
}

BUT IOptions<> is not the way to do this.

Why you ask ?

  1. As Uncle Bob said, your application must be independent from frameworks this the application code takes an unnecessary dependency on a framework abstraction, this is a violation of DIP.
  2. In order to inject IOption<SomeClass> SomeClass have to be a concrete class and not an interface.
  3. To use IOption<SomeClass> you must call services.Configure<SomeClass> in the Setup class, this is not scale-able in any way and the last thing we want to do is to manually configure each configuration class.
  4. Registering IOption<> in any other DI container different from Microsoft new DI container won't be a ball park.

For better understanding you can read this explenation from the SimpleInjecor docs.

TL;DR - or what SimpleConfig does?

Remember the IOption<EmailProviderConfiguratation> configuration?

what if we could build an interface like so

public interface IEmailServiceConfig
{
    [DefaultValue("SomeUrl")]
    string ServiceUrl {get; set;}
}

and use it like so

public class EmailSender : IEmailSender
{
   public EmailSender(IEmailServiceConfig emailServiceConfig, ... ) { }

   public void SendEmail(...)
   {
        Send(emailServiceConfig.ServiceUrl, ...);
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].