StratusCube.Extensions.Configuration.RavenDB 6.2.0

dotnet add package StratusCube.Extensions.Configuration.RavenDB --version 6.2.0                
NuGet\Install-Package StratusCube.Extensions.Configuration.RavenDB -Version 6.2.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="StratusCube.Extensions.Configuration.RavenDB" Version="6.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StratusCube.Extensions.Configuration.RavenDB --version 6.2.0                
#r "nuget: StratusCube.Extensions.Configuration.RavenDB, 6.2.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 StratusCube.Extensions.Configuration.RavenDB as a Cake Addin
#addin nuget:?package=StratusCube.Extensions.Configuration.RavenDB&version=6.2.0

// Install StratusCube.Extensions.Configuration.RavenDB as a Cake Tool
#tool nuget:?package=StratusCube.Extensions.Configuration.RavenDB&version=6.2.0                

StratusCube.Extensions.Configuration.RavenDB

.NET CodeQL

Use RavenDB as a configuration provider in dotnet.

The package will let you use RavenDB as a configuration provider. Either a collection or an entire database may be used as a provider. The provider can also make use of Collection or Database subscriptions to reload the configuration changes.

Getting Started

Add the package to your project from nuget.

dotnet add package StratusCube.Extensions.Configuration.RavenDB

The RavenDBConfigurationExtensions class resides in the namespace Microsoft.Extensions.Configuration. In most new web projects the namespace will not need to be specified in the Program.cs file.

Usage

The following is an example implementation. In the Program.cs you can add the following:

Program.cs Boilerplate

//. Document store to use for the config
using Microsoft.Extensions.Configuration;

IDocumentStore configStore = new DocumentStore {
    Database = "MyDatabase" ,
    Urls = new[] { "http://localhost:8080" } ,
};

var builder = WebApplication.CreateBuilder(args);

Add Single Raven Document

builder.Configuration.AddRavenDocument(
    documentStore: configStore ,
    //. the document ID to use for the configurations
    documentId: "MyDocumentID" ,
    //. if true a subscriber will be used to notify when the collection has changed
    //. and if so load the new configuration values
    reloadOnChange: true ,
    //. optionally add a logger, in this case the logger will grab the
    //. configuration section of logging and add a console provider
    config => config
        .AddConfiguration(builder.Configuration.GetSection("Logging"))
        .AddConsole()
);

Add Raven Collection Source

builder.Configuration.AddRavenDbCollection(
    documentStore: configStore ,
    //. the collection to use for the configurations
    collectionName: "MyCollection" ,
    //. if true a subscriber will be used to notify when the collection has changed
    //. and if so load the new configuration values
    reloadOnChange: true ,
    //. if true then the collection will be prefixed to the configuration keys
    //. true: [MyCollection:Foo:Field]
    //. false: [Foo:Field]
    useCollectionPrefix: true ,
    //. optionally add a logger, in this case the logger will grab the
    //. configuration section of logging and add a console provider
    loggerConfig: config => config
        .AddConfiguration(builder.Configuration.GetSection("Logging"))
        .AddConsole()
);

Add Raven Database

builder.Configuration.AddRavenDb(
    //. The database specified in the IDocumentStore will be used
    //. for the configurations
    documentStore: configStore ,
    //. if true a subscriber will be used to notify when the collection has changed
    //. and if so load the new configuration values
    reloadOnChange: true ,
    //. optionally add a logger, in this case the logger will grab the
    //. configuration section of logging and add a console provider
    config => config
        .AddConfiguration(builder.Configuration.GetSection("Logging"))
        .AddConsole()
);

Additional Resources

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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
6.2.0 451 5/11/2022
6.1.0 414 5/10/2022
6.0.1 480 5/10/2022 6.0.1 is deprecated.
6.0.0 502 5/9/2022 6.0.0 is deprecated.