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
<PackageReference Include="StratusCube.Extensions.Configuration.RavenDB" Version="6.2.0" />
paket add StratusCube.Extensions.Configuration.RavenDB --version 6.2.0
#r "nuget: StratusCube.Extensions.Configuration.RavenDB, 6.2.0"
// 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
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 | Versions 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. |
-
net6.0
- Microsoft.Extensions.Configuration (>= 6.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.1)
- Newtonsoft.Json (>= 13.0.1)
- RavenDB.Client (>= 5.3.102)
- System.Reactive.Core (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.