Outbreak Labs

I can do anything I want to. And so can you.

Simplify your configuration with ConfigureAll

I've been using the new Options pattern for configuration in my .net core apps. I like it, but got tired of having to write lines like  

services.Configure<FrobOptions>(Configuration.GetSection("Frob"));

every time I added a new configuration class. I've written a library called ConfigureAll to address this inconvenience. With this library, you can add an attribute to your configuration classes indicating their configuration key, like 

[ConfigurationObject("Frob")]
    public class FrobOptions
    {        
        public string TestValue { get; set; }
    }


then just call

services.ConfigureAll(this.GetType().GetTypeInfo().Assembly, Configuration);

once, instead of having to configure each type individually. For more information, see the GitHub page: https://github.com/SapientGuardian/SapientGuardian.ConfigureAll

Comments are closed