IEvangelist.Azure.CosmosRepository 1.0.4

.NET Standard 2.0
There is a newer version of this package available.
See the version list below for details.
dotnet add package IEvangelist.Azure.CosmosRepository --version 1.0.4
NuGet\Install-Package IEvangelist.Azure.CosmosRepository -Version 1.0.4
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="IEvangelist.Azure.CosmosRepository" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IEvangelist.Azure.CosmosRepository --version 1.0.4
#r "nuget: IEvangelist.Azure.CosmosRepository, 1.0.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install IEvangelist.Azure.CosmosRepository as a Cake Addin
#addin nuget:?package=IEvangelist.Azure.CosmosRepository&version=1.0.4

// Install IEvangelist.Azure.CosmosRepository as a Cake Tool
#tool nuget:?package=IEvangelist.Azure.CosmosRepository&version=1.0.4

NuGet

Azure Cosmos DB Repository .NET SDK

This package wraps the NuGet: Microsoft.Azure.Cosmos package, exposing a simple dependency-injection enabled IRepository<T> interface. The repository is responsible for all of the create, read, update, and delete (CRUD) operations on objects where T : Item. The Item type adds several properties, one which is a globally unique identifier defined as:

[JsonProperty("id")]
public string Id { get; set; } = Guid.NewGuid().ToString();

Additionally, a type property exists which indicates the subclass name (this is used for filtering implicitly on your behalf):

[JsonProperty("type")]
public string Type { get; set; }

Finally, a partition key properpty is used internally to manage partitioning on your behalf.

Getting started

  1. Create an Azure Cosmos DB SQL resource.

  2. Obtain the resource connection string from the Keys blade, be sure to get a connection string and not the key - these are different. The connection string is a compound key and endpoint URL.

  3. Call AddCosmosRepository and provide the apps configuration object:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddCosmosRepository(Configuration);
    }
    

    The optional setupAction allows consumers to manually configure the RepositoryOptions object:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddCosmosRepository(Configuration,
            options => 
            {
                options.CosmosConnectionString = "< connection string >";
                options.ContainerId = "data-store";
                options.DatabaseId = "samples";
            });
    }
    
  4. Define your object graph, objects must inherit Item, for example:

    using Microsoft.Azure.CosmosRepository;
    
    public class Person : Item
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }
    
  5. Ask for an instance of IRepository<TItem>, in this case the TItem is Person:

    using Microsoft.Azure.CosmosRepository;
    
    public class Consumer
    {
        readonly IRepository<Person> _repository;
    
        public Consumer(IRepository<Person> repository) =>
            _respository = repository;
    
        // Use the repo...
    }
    
  6. Perform any of the operations on the _repository instance, create Person records, update them, read them, or delete.

  7. Enjoy!

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on IEvangelist.Azure.CosmosRepository:

Package Downloads
IEvangelist.Azure.CosmosRepository.AspNetCore

This client library enables client applications to connect to Azure Cosmos via a repository pattern around the official Azure Cosmos .NET SDK. Azure Cosmos is a globally distributed, multi-model database service. For more information, refer to http://azure.microsoft.com/services/cosmos-db/.

IEvangelist.Azure.CosmosEventSourcing

This client library enables client applications to connect to Azure Cosmos and use it as an event sourcing store.

AIC.Core.Data.CosmosDb

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on IEvangelist.Azure.CosmosRepository:

Repository Stars
bradygaster/Contoso.Online.Orders
The .NET 5 version of Contoso Online Orders
Version Downloads Last updated
7.0.1 347 1/22/2023
7.0.0 529 1/4/2023
3.7.0 24,203 8/14/2022
3.6.0 8,550 7/23/2022
3.5.5 7,339 6/9/2022
3.5.4 5,044 5/18/2022
3.5.3 13,383 4/7/2022
3.5.2 3,047 3/24/2022
3.5.1 3,550 3/17/2022
3.5.0 2,296 3/14/2022
3.4.1 573 3/11/2022
3.4.0 490 3/11/2022
3.3.0 698 3/10/2022
3.2.0 632 3/9/2022
3.1.0 582 3/7/2022
3.0.3 1,057 3/5/2022
3.0.2 704 3/5/2022
3.0.0 1,465 3/2/2022
2.12.1 18,266 2/2/2022
2.12.0 1,393 2/1/2022
2.12.0-pre1 316 1/21/2022
2.11.0 3,995 1/5/2022
2.10.1 1,019 1/4/2022
2.10.0 225 12/27/2021
2.9.0 203 12/22/2021
2.8.0 2,833 12/15/2021
2.7.1 302 12/15/2021
2.7.0 3,188 11/15/2021
2.6.0 1,107 11/3/2021
2.5.3 2,632 11/1/2021
2.5.2 980 10/22/2021
2.5.1 353 10/18/2021
2.5.0 2,994 9/23/2021
2.3.0 1,083 8/18/2021
2.2.0 818 7/20/2021
2.1.9 2,549 6/11/2021
2.1.6 1,479 5/10/2021
2.1.5 2,644 2/11/2021
2.1.4 3,688 2/1/2021
2.1.3 24,994 12/11/2020
2.1.2 306 12/2/2020
2.1.1 939 11/19/2020
2.1.0 1,173 11/10/2020
2.0.3 425 10/23/2020
2.0.2 500 10/12/2020
2.0.1 308 10/12/2020
2.0.0 365 10/9/2020
1.0.5 430 10/8/2020
1.0.4 447 10/7/2020
1.0.1 358 10/2/2020
1.0.0 336 10/1/2020
0.0.2-preview 234 9/30/2020
0.0.1-preview 246 9/17/2020