Sparc.Database.Cosmos 7.0.0

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

// Install Sparc.Database.Cosmos as a Cake Tool
#tool nuget:?package=Sparc.Database.Cosmos&version=7.0.0



The Sparc.Database.Cosmos plugin is primarily an implementation of IRepository<T> that uses Azure Cosmos DB via Entity Framework for all of its persistence operations.

Add this plugin to your Features Project if you'd like to use Azure Cosmos DB as your app's database provider.

Get Started with Sparc.Database.Cosmos

In Your Features Project:

  1. Add the Sparc.Database.Cosmos Nuget package: Nuget

  2. Add the following settings to your appsettings.json file:

      "ConnectionStrings": {
        "CosmosDb": "[your Cosmos DB Connection String]"
  3. Create an Entity Framework DbContext class, configuring all root entities as necessary. Example:

     public class MyAppContext : DbContext
      public MyAppContext(DbContextOptions options) : base(options)
      { }
       protected override void OnModelCreating(ModelBuilder builder)
         builder.Entity<User>().HasPartitionKey(x => x.UserId);
  4. Add the following line of code to your Startup.cs file in your Features Project to register the Sparc.Database.Cosmos plugin. Pass in the DbContext class type you created, the connection string from your appsettings.json file, and the name of your database.

    services.AddCosmos<MyAppContext>(Configuration.GetConnectionString("CosmosDb"), "[your Database Name]");
  5. Inject IRepository<T> into any feature that needs to load from or save data to the database. All typically necessary database operations exist within this interface. The Cosmos DB Repository you configured will automatically be used.

More Info

For more information on root entities, or how to use IRepository<T>, see the Sparc.Core documentation.

For an example on using IRepository<T> inside a Feature, see the examples in the Sparc.Features documentation.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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
7.0.0 352 11/7/2022
6.0.8 541 4/11/2022
6.0.7 424 4/8/2022
6.0.6 422 3/28/2022
6.0.5 422 3/9/2022
6.0.2 452 1/10/2022
6.0.1 302 12/17/2021
6.0.0 278 11/19/2021
2.7.0 353 11/9/2021
2.5.1 319 9/1/2021
2.5.0 365 5/6/2021
2.0.18 383 4/8/2021
2.0.11 377 3/9/2021
2.0.8 343 3/9/2021
2.0.7 314 3/9/2021
2.0.6 322 3/9/2021
2.0.5 371 3/3/2021
2.0.1 366 2/22/2021