Boba.Configurations 1.0.0

dotnet add package Boba.Configurations --version 1.0.0
NuGet\Install-Package Boba.Configurations -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Boba.Configurations" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Boba.Configurations --version 1.0.0
#r "nuget: Boba.Configurations, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Boba.Configurations as a Cake Addin
#addin nuget:?package=Boba.Configurations&version=1.0.0

// Install Boba.Configurations as a Cake Tool
#tool nuget:?package=Boba.Configurations&version=1.0.0

Boba.Configurations

Boba.Configurations is a lightweight library designed for .NET projects to simplify the process of retrieving configurations from appsettings.json files.

Getting Started

Boba.Configurations is conveniently available on NuGet. Simply install the provider package corresponding to your target database.

dotnet add package Boba.Configurations

Utilize the --version option to specify a preview version for installation if needed.

Basic Usage

Harnessing the power of Boba.Configurations is straightforward. Follow these steps to get started:

Registration:

Begin by registering Boba.Configurations in your program.cs. Presently, we support SqlServer, necessitating the provision of a connection string. Alternative data store providers are also available.

builder.Services.AddBobaConfigurations(builder.Configuration);
Configuration:

Define your settings class, inheriting from IConfig. Here, you can optionally assign default values to be retrieved in the absence of stored data.

public class EmailConfig : IConfig
{
    public string DefaultFromEmail { get; set; }
    public int Port { get; set; }
    public string UserName { get; set; }
    public string Password { get; set; }
    public SMTPSetting SMTPSetting { get; set; }
}

public class SMTPSetting
{
    public string Host { get; set; }
}

Store your entity mapped as the EmailConfig in appsettings.json.

  "EmailConfig": {
    "DefaultFromEmail": "my.email@gmail.com",
    "Port": 587,
    "SMTPSetting": { "Host": "smtp.gmail.com" },
    "UserName": "my.email@gmail.com",
    "Password": "xxxx cccc dddd yyyy"
  }
Utilization:

Inject the config service into your application and access the values effortlessly.

private readonly EmailConfig _emailConfig;

public YourConstructor(EmailConfig emailConfig)
{
    _emailConfig = emailConfig;
}

Console.WriteLine(_emailConfig.DefaultFromEmail);

Upcoming Features

  • Intuitive User Interface for simplified management.
  • Query caching mechanisms for enhanced performance.
  • Flexible injection options, including Windsor, Unity, Autofac, etc.

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

Versions

The main branch is now on .NET 8.0. Previous versions are not available at this time.

License

This project is licensed under the MIT license.

Support

If you encounter any issues or have questions, please feel free to raise a new issue.

Technologies

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 101 4/30/2024