RavenDB.DependencyInjection 2.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package RavenDB.DependencyInjection --version 2.0.2                
NuGet\Install-Package RavenDB.DependencyInjection -Version 2.0.2                
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="RavenDB.DependencyInjection" Version="2.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RavenDB.DependencyInjection --version 2.0.2                
#r "nuget: RavenDB.DependencyInjection, 2.0.2"                
#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 RavenDB.DependencyInjection as a Cake Addin
#addin nuget:?package=RavenDB.DependencyInjection&version=2.0.2

// Install RavenDB.DependencyInjection as a Cake Tool
#tool nuget:?package=RavenDB.DependencyInjection&version=2.0.2                

<img src="https://github.com/JudahGabriel/RavenDB.DependencyInjection/blob/master/RavenDB.DependencyInjection/nuget-icon.png?raw=true" width="50px" height="50px" /> RavenDB.DependencyInjection

Dependency Injection package for using RavenDB with ASP.NET Core.

This package lets you configure a RavenDB DocumentStore and create a singleton for it in the dependency injection container. Additionally, you can configure an IAsyncDocumentSession (or it's synchronous equivalent) to be created per scope.

Getting Started:

Install the RavenDB.DependencyInjection library through NuGet.

Install-Package RavenDB.DependencyInjection

Usage:

Add a RavenSettings section to your appsettings.json:

"RavenSettings": {
	"Urls": [
		"http://live-test.ravendb.net"
	],
	"DatabaseName": "Northwind",
	"CertFilePath": "",
	"CertPassword": ""
},

Note that CertFilePath is optional. If you use a certificate to connect to your database, this should be a path relative to the content root.

Then in Startup.cs, tell Raven to use this database and add it to the DI container:

public void ConfigureServices(IServiceCollection services)
{
    // 1. Grab our RavenSettings object from appsettings.json.
    services.Configure<RavenSettings>(Configuration.GetSection("RavenSettings"));

    // 2. Add an IDocumentStore singleton.
    services.AddRavenDbDocStore();

    // 3. Add a scoped IAsyncDocumentSession. For the sync version, use .AddRavenSession().
    services.AddRavenDbAsyncSession(); 
}

Now you're cooking! Your controllers and services can now have IDocumentStore, IAsyncDocumentSession, or IDocumentSession injected into them. 😎

View the Sample project to see it all in action.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on RavenDB.DependencyInjection:

Package Downloads
RavenDB.Identity

The simple and easy RavenDB Identity provider for ASP.NET Core. Use Raven to store your users and logins with just a few lines of code.

Dafitech.Common.Library

Common library has functions and methods that attends to requirements and programming style on Dafitech projects.

Dafitech.Common.GlobalDomain

Dafitech common global domain classes and DTOs

Dafitech.Common.DataAccess

Dafitech database access classes and methods.

BccPay.Core.DataAccess

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.1 22,616 1/12/2024
5.0.0 328 1/12/2024
4.0.2 174,357 4/1/2021
4.0.1 834 3/30/2021
4.0.0 15,494 7/24/2020
3.1.0 11,367 11/13/2019
3.0.0 9,022 4/5/2019
2.0.3 7,106 3/11/2019
2.0.2 1,144 2/28/2019
2.0.1 1,863 2/28/2019
2.0.0 1,117 2/28/2019
1.0.0 2,049 6/28/2016
1.0.0-rc2 1,557 6/27/2016

Overloads to AddRavenDbSession to accept existing DocumentStore.