Encamina.Enmarcha.Data.Cosmos
8.2.0
dotnet add package Encamina.Enmarcha.Data.Cosmos --version 8.2.0
NuGet\Install-Package Encamina.Enmarcha.Data.Cosmos -Version 8.2.0
<PackageReference Include="Encamina.Enmarcha.Data.Cosmos" Version="8.2.0" />
paket add Encamina.Enmarcha.Data.Cosmos --version 8.2.0
#r "nuget: Encamina.Enmarcha.Data.Cosmos, 8.2.0"
// Install Encamina.Enmarcha.Data.Cosmos as a Cake Addin #addin nuget:?package=Encamina.Enmarcha.Data.Cosmos&version=8.2.0 // Install Encamina.Enmarcha.Data.Cosmos as a Cake Tool #tool nuget:?package=Encamina.Enmarcha.Data.Cosmos&version=8.2.0
Data - Cosmos
Cosmos Data project primarily contains Cosmos DB implementations based on the abstractions provided by Encamina.Enmarcha.Data.Abstractions, as well as some other utilities related to Cosmos DB.
Setup
Nuget package
First, install NuGet. Then, install Encamina.Enmarcha.Data.Cosmos from the package manager console:
PM> Install-Package Encamina.Enmarcha.Data.Cosmos
.NET CLI:
First, install .NET CLI. Then, install Encamina.Enmarcha.Data.Cosmos from the .NET CLI:
dotnet add package Encamina.Enmarcha.Data.Cosmos
How to use
In the following example, we will demonstrate how to configure and add an Cosmos DB implementation of the IAsyncRepository interface to the ServiceCollection
, based on the CosmosRepository.
public class Foo
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("text")]
public string Text { get; set; }
}
First, you need to add the CosmosOptions to your project configuration. You can achieve this by using any configuration provider. The followng code is an example of how the settings would appear using the appsettings.json file:
{
// ...
"CosmosOptions": {
"AuthKey": "<Your-AuthKey>", // Authentication key required to connect with Azure Cosmos DB
"Database": "<Your-Database>", // Database name to connect with Azure Cosmos DB
"Endpoint": "<Your-Endpoint>", // Azure Cosmos DB service endpoint to use
// ...
},
"CosmosDBContainerName": "<Your-Cosmos-DB-Container-Name>",
// ...
}
Next, in Program.cs
or a similar entry point file in your project, add the following code:
// Entry point
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
// ...
});
// ...
// Or others configuration providers...
builder.Configuration.AddJsonFile(@"appsettings.json", optional: true, reloadOnChange: true);
builder.Services.AddCosmos(builder.Configuration);
builder.Services.AddScoped<IAsyncRepository<Foo>>(sp => sp.GetRequiredService<ICosmosRepositoryFactory>()
.Create<Foo>(builder.Configuration.GetValue<string>("CosmosDBContainerName")));
And now, you can resolve the IAsyncRepository<Foo>
interface with construction injection:
public class MyClass
{
private readonly IAsyncRepository<Foo> fooRepository;
public MyClass(IAsyncRepository<Foo> fooRepository)
{
this.fooRepository = fooRepository;
}
public async Task TestAddFooAsync(CancellationToken cts)
{
await fooRepository.AddAsync(new Foo() { Text = "Foo1", Id = Guid.NewGuid().ToString()}, cts);
}
}
Within the NuGet package, you will find some extension methods related to Cosmos DB in FeedIteratorExtensions.
Product | Versions 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Azure.Identity (>= 1.12.0)
- CommunityToolkit.Diagnostics (>= 8.2.2)
- Encamina.Enmarcha.Core (>= 8.2.0)
- Encamina.Enmarcha.Data.Abstractions (>= 8.2.0)
- Microsoft.Azure.Cosmos (>= 3.43.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Encamina.Enmarcha.Data.Cosmos:
Package | Downloads |
---|---|
Encamina.Enmarcha.SemanticKernel.Plugins.Chat
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.2.0 | 265 | 10/22/2024 |
8.2.0-preview-01-m01 | 112 | 9/17/2024 |
8.1.9-preview-02 | 65 | 10/22/2024 |
8.1.9-preview-01 | 282 | 10/4/2024 |
8.1.8 | 226 | 9/23/2024 |
8.1.8-preview-07 | 532 | 9/12/2024 |
8.1.8-preview-06 | 239 | 9/11/2024 |
8.1.8-preview-05 | 95 | 9/10/2024 |
8.1.8-preview-04 | 367 | 8/16/2024 |
8.1.8-preview-03 | 180 | 8/13/2024 |
8.1.8-preview-02 | 107 | 8/13/2024 |
8.1.8-preview-01 | 114 | 8/12/2024 |
8.1.7 | 113 | 8/7/2024 |
8.1.7-preview-09 | 177 | 7/3/2024 |
8.1.7-preview-08 | 107 | 7/2/2024 |
8.1.7-preview-07 | 97 | 6/10/2024 |
8.1.7-preview-06 | 91 | 6/10/2024 |
8.1.7-preview-05 | 112 | 6/6/2024 |
8.1.7-preview-04 | 99 | 6/6/2024 |
8.1.7-preview-03 | 107 | 5/24/2024 |
8.1.7-preview-02 | 92 | 5/10/2024 |
8.1.7-preview-01 | 97 | 5/8/2024 |
8.1.6 | 1,137 | 5/7/2024 |
8.1.6-preview-08 | 66 | 5/2/2024 |
8.1.6-preview-07 | 99 | 4/29/2024 |
8.1.6-preview-06 | 388 | 4/26/2024 |
8.1.6-preview-05 | 103 | 4/24/2024 |
8.1.6-preview-04 | 131 | 4/22/2024 |
8.1.6-preview-03 | 105 | 4/22/2024 |
8.1.6-preview-02 | 196 | 4/17/2024 |
8.1.6-preview-01 | 225 | 4/15/2024 |
8.1.5 | 142 | 4/15/2024 |
8.1.5-preview-15 | 112 | 4/10/2024 |
8.1.5-preview-14 | 140 | 3/20/2024 |
8.1.5-preview-13 | 100 | 3/18/2024 |
8.1.5-preview-12 | 124 | 3/13/2024 |
8.1.5-preview-11 | 103 | 3/13/2024 |
8.1.5-preview-10 | 126 | 3/13/2024 |
8.1.5-preview-09 | 141 | 3/12/2024 |
8.1.5-preview-08 | 93 | 3/12/2024 |
8.1.5-preview-07 | 121 | 3/8/2024 |
8.1.5-preview-06 | 231 | 3/8/2024 |
8.1.5-preview-05 | 105 | 3/7/2024 |
8.1.5-preview-04 | 121 | 3/7/2024 |
8.1.5-preview-03 | 116 | 3/7/2024 |
8.1.5-preview-02 | 151 | 2/28/2024 |
8.1.5-preview-01 | 131 | 2/19/2024 |
8.1.4 | 168 | 2/15/2024 |
8.1.3 | 148 | 2/13/2024 |
8.1.3-preview-07 | 102 | 2/13/2024 |
8.1.3-preview-06 | 102 | 2/12/2024 |
8.1.3-preview-05 | 98 | 2/9/2024 |
8.1.3-preview-04 | 90 | 2/8/2024 |
8.1.3-preview-03 | 96 | 2/7/2024 |
8.1.3-preview-02 | 103 | 2/2/2024 |
8.1.3-preview-01 | 102 | 2/2/2024 |
8.1.2 | 115 | 2/1/2024 |
8.1.2-preview-9 | 109 | 1/22/2024 |
8.1.2-preview-8 | 99 | 1/19/2024 |
8.1.2-preview-7 | 99 | 1/19/2024 |
8.1.2-preview-6 | 77 | 1/19/2024 |
8.1.2-preview-5 | 93 | 1/19/2024 |
8.1.2-preview-4 | 91 | 1/19/2024 |
8.1.2-preview-3 | 90 | 1/18/2024 |
8.1.2-preview-2 | 105 | 1/18/2024 |
8.1.2-preview-16 | 90 | 1/31/2024 |
8.1.2-preview-15 | 92 | 1/31/2024 |
8.1.2-preview-14 | 192 | 1/25/2024 |
8.1.2-preview-13 | 96 | 1/25/2024 |
8.1.2-preview-12 | 102 | 1/23/2024 |
8.1.2-preview-11 | 114 | 1/23/2024 |
8.1.2-preview-10 | 121 | 1/22/2024 |
8.1.2-preview-1 | 98 | 1/18/2024 |
8.1.1 | 154 | 1/18/2024 |
8.1.0 | 118 | 1/18/2024 |
8.0.3 | 159 | 12/29/2023 |
8.0.1 | 140 | 12/14/2023 |
8.0.0 | 166 | 12/7/2023 |
6.0.4.3 | 148 | 12/29/2023 |
6.0.4.2 | 169 | 12/20/2023 |
6.0.4.1 | 240 | 12/19/2023 |
6.0.4 | 164 | 12/4/2023 |
6.0.3.20 | 158 | 11/27/2023 |
6.0.3.19 | 173 | 11/22/2023 |