Skip to content

Application configuration

CesarD edited this page Oct 20, 2022 · 1 revision

One of Monaco's main features is its modularity, and as such, it allows to plug the Application library as part of any executable app to reuse its business logic and easily configure its dependencies for it to function properly. For doing this, Monaco implements an Options pattern to allow easy parameterization of the DI configuration.

This, basically, allows for easier configuration of the Application from any type of assembly you're running it from:

builder.Services
       .ConfigureApplication(options =>
			     {
				  options.EntityFramework.ConnectionString = configuration.GetConnectionString("AppDbContext");
				  options.EntityFramework.EnableEfSensitiveLogging = bool.Parse(configuration["EnableEFSensitiveLogging"] ?? "false");
			     });

Wherever you're pulling the configuration from, be it from the appsettings.json, environment variables, Azure KeyVault or whetever, as long as you can assign the values to the properties exposed by the options parameter, you will be able to feed the required information consistently to the Application layer.