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 | 230 | 10/22/2024 |
8.2.0-preview-01-m01 | 111 | 9/17/2024 |
8.1.9-preview-02 | 64 | 10/22/2024 |
8.1.9-preview-01 | 268 | 10/4/2024 |
8.1.8 | 225 | 9/23/2024 |
8.1.8-preview-07 | 494 | 9/12/2024 |
8.1.8-preview-06 | 236 | 9/11/2024 |
8.1.8-preview-05 | 92 | 9/10/2024 |
8.1.8-preview-04 | 366 | 8/16/2024 |
8.1.8-preview-03 | 179 | 8/13/2024 |
8.1.8-preview-02 | 106 | 8/13/2024 |
8.1.8-preview-01 | 113 | 8/12/2024 |
8.1.7 | 112 | 8/7/2024 |
8.1.7-preview-09 | 176 | 7/3/2024 |
8.1.7-preview-08 | 106 | 7/2/2024 |
8.1.7-preview-07 | 96 | 6/10/2024 |
8.1.7-preview-06 | 90 | 6/10/2024 |
8.1.7-preview-05 | 111 | 6/6/2024 |
8.1.7-preview-04 | 98 | 6/6/2024 |
8.1.7-preview-03 | 106 | 5/24/2024 |
8.1.7-preview-02 | 91 | 5/10/2024 |
8.1.7-preview-01 | 96 | 5/8/2024 |
8.1.6 | 1,106 | 5/7/2024 |
8.1.6-preview-08 | 65 | 5/2/2024 |
8.1.6-preview-07 | 98 | 4/29/2024 |
8.1.6-preview-06 | 385 | 4/26/2024 |
8.1.6-preview-05 | 102 | 4/24/2024 |
8.1.6-preview-04 | 130 | 4/22/2024 |
8.1.6-preview-03 | 103 | 4/22/2024 |
8.1.6-preview-02 | 195 | 4/17/2024 |
8.1.6-preview-01 | 224 | 4/15/2024 |
8.1.5 | 141 | 4/15/2024 |
8.1.5-preview-15 | 111 | 4/10/2024 |
8.1.5-preview-14 | 137 | 3/20/2024 |
8.1.5-preview-13 | 93 | 3/18/2024 |
8.1.5-preview-12 | 123 | 3/13/2024 |
8.1.5-preview-11 | 102 | 3/13/2024 |
8.1.5-preview-10 | 125 | 3/13/2024 |
8.1.5-preview-09 | 140 | 3/12/2024 |
8.1.5-preview-08 | 92 | 3/12/2024 |
8.1.5-preview-07 | 120 | 3/8/2024 |
8.1.5-preview-06 | 230 | 3/8/2024 |
8.1.5-preview-05 | 104 | 3/7/2024 |
8.1.5-preview-04 | 120 | 3/7/2024 |
8.1.5-preview-03 | 115 | 3/7/2024 |
8.1.5-preview-02 | 150 | 2/28/2024 |
8.1.5-preview-01 | 128 | 2/19/2024 |
8.1.4 | 167 | 2/15/2024 |
8.1.3 | 147 | 2/13/2024 |
8.1.3-preview-07 | 97 | 2/13/2024 |
8.1.3-preview-06 | 101 | 2/12/2024 |
8.1.3-preview-05 | 97 | 2/9/2024 |
8.1.3-preview-04 | 89 | 2/8/2024 |
8.1.3-preview-03 | 95 | 2/7/2024 |
8.1.3-preview-02 | 102 | 2/2/2024 |
8.1.3-preview-01 | 101 | 2/2/2024 |
8.1.2 | 114 | 2/1/2024 |
8.1.2-preview-9 | 106 | 1/22/2024 |
8.1.2-preview-8 | 98 | 1/19/2024 |
8.1.2-preview-7 | 98 | 1/19/2024 |
8.1.2-preview-6 | 74 | 1/19/2024 |
8.1.2-preview-5 | 92 | 1/19/2024 |
8.1.2-preview-4 | 90 | 1/19/2024 |
8.1.2-preview-3 | 89 | 1/18/2024 |
8.1.2-preview-2 | 104 | 1/18/2024 |
8.1.2-preview-16 | 89 | 1/31/2024 |
8.1.2-preview-15 | 91 | 1/31/2024 |
8.1.2-preview-14 | 191 | 1/25/2024 |
8.1.2-preview-13 | 95 | 1/25/2024 |
8.1.2-preview-12 | 101 | 1/23/2024 |
8.1.2-preview-11 | 113 | 1/23/2024 |
8.1.2-preview-10 | 120 | 1/22/2024 |
8.1.2-preview-1 | 97 | 1/18/2024 |
8.1.1 | 151 | 1/18/2024 |
8.1.0 | 117 | 1/18/2024 |
8.0.3 | 158 | 12/29/2023 |
8.0.1 | 139 | 12/14/2023 |
8.0.0 | 165 | 12/7/2023 |
6.0.4.3 | 147 | 12/29/2023 |
6.0.4.2 | 168 | 12/20/2023 |
6.0.4.1 | 239 | 12/19/2023 |
6.0.4 | 163 | 12/4/2023 |
6.0.3.20 | 157 | 11/27/2023 |
6.0.3.19 | 172 | 11/22/2023 |