Encamina.Enmarcha.Data.Cosmos
8.1.2-preview-13
See the version list below for details.
dotnet add package Encamina.Enmarcha.Data.Cosmos --version 8.1.2-preview-13
NuGet\Install-Package Encamina.Enmarcha.Data.Cosmos -Version 8.1.2-preview-13
<PackageReference Include="Encamina.Enmarcha.Data.Cosmos" Version="8.1.2-preview-13" />
paket add Encamina.Enmarcha.Data.Cosmos --version 8.1.2-preview-13
#r "nuget: Encamina.Enmarcha.Data.Cosmos, 8.1.2-preview-13"
// Install Encamina.Enmarcha.Data.Cosmos as a Cake Addin #addin nuget:?package=Encamina.Enmarcha.Data.Cosmos&version=8.1.2-preview-13&prerelease // Install Encamina.Enmarcha.Data.Cosmos as a Cake Tool #tool nuget:?package=Encamina.Enmarcha.Data.Cosmos&version=8.1.2-preview-13&prerelease
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
- CommunityToolkit.Diagnostics (>= 8.2.2)
- Encamina.Enmarcha.Core (>= 8.1.2-preview-13)
- Encamina.Enmarcha.Data.Abstractions (>= 8.1.2-preview-13)
- Microsoft.Azure.Cosmos (>= 3.37.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.1)
- 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 | 412 | 10/22/2024 |
8.2.0-preview-01-m01 | 115 | 9/17/2024 |
8.1.9-preview-03 | 68 | 11/19/2024 |
8.1.9-preview-02 | 69 | 10/22/2024 |
8.1.9-preview-01 | 293 | 10/4/2024 |
8.1.8 | 229 | 9/23/2024 |
8.1.8-preview-07 | 650 | 9/12/2024 |
8.1.8-preview-06 | 240 | 9/11/2024 |
8.1.8-preview-05 | 96 | 9/10/2024 |
8.1.8-preview-04 | 368 | 8/16/2024 |
8.1.8-preview-03 | 181 | 8/13/2024 |
8.1.8-preview-02 | 108 | 8/13/2024 |
8.1.8-preview-01 | 115 | 8/12/2024 |
8.1.7 | 116 | 8/7/2024 |
8.1.7-preview-09 | 178 | 7/3/2024 |
8.1.7-preview-08 | 108 | 7/2/2024 |
8.1.7-preview-07 | 98 | 6/10/2024 |
8.1.7-preview-06 | 92 | 6/10/2024 |
8.1.7-preview-05 | 113 | 6/6/2024 |
8.1.7-preview-04 | 100 | 6/6/2024 |
8.1.7-preview-03 | 108 | 5/24/2024 |
8.1.7-preview-02 | 93 | 5/10/2024 |
8.1.7-preview-01 | 98 | 5/8/2024 |
8.1.6 | 1,285 | 5/7/2024 |
8.1.6-preview-08 | 67 | 5/2/2024 |
8.1.6-preview-07 | 100 | 4/29/2024 |
8.1.6-preview-06 | 392 | 4/26/2024 |
8.1.6-preview-05 | 104 | 4/24/2024 |
8.1.6-preview-04 | 132 | 4/22/2024 |
8.1.6-preview-03 | 108 | 4/22/2024 |
8.1.6-preview-02 | 197 | 4/17/2024 |
8.1.6-preview-01 | 226 | 4/15/2024 |
8.1.5 | 145 | 4/15/2024 |
8.1.5-preview-15 | 113 | 4/10/2024 |
8.1.5-preview-14 | 141 | 3/20/2024 |
8.1.5-preview-13 | 101 | 3/18/2024 |
8.1.5-preview-12 | 125 | 3/13/2024 |
8.1.5-preview-11 | 106 | 3/13/2024 |
8.1.5-preview-10 | 127 | 3/13/2024 |
8.1.5-preview-09 | 142 | 3/12/2024 |
8.1.5-preview-08 | 94 | 3/12/2024 |
8.1.5-preview-07 | 122 | 3/8/2024 |
8.1.5-preview-06 | 232 | 3/8/2024 |
8.1.5-preview-05 | 106 | 3/7/2024 |
8.1.5-preview-04 | 122 | 3/7/2024 |
8.1.5-preview-03 | 117 | 3/7/2024 |
8.1.5-preview-02 | 154 | 2/28/2024 |
8.1.5-preview-01 | 132 | 2/19/2024 |
8.1.4 | 173 | 2/15/2024 |
8.1.3 | 151 | 2/13/2024 |
8.1.3-preview-07 | 103 | 2/13/2024 |
8.1.3-preview-06 | 103 | 2/12/2024 |
8.1.3-preview-05 | 99 | 2/9/2024 |
8.1.3-preview-04 | 91 | 2/8/2024 |
8.1.3-preview-03 | 97 | 2/7/2024 |
8.1.3-preview-02 | 104 | 2/2/2024 |
8.1.3-preview-01 | 105 | 2/2/2024 |
8.1.2 | 118 | 2/1/2024 |
8.1.2-preview-9 | 110 | 1/22/2024 |
8.1.2-preview-8 | 100 | 1/19/2024 |
8.1.2-preview-7 | 100 | 1/19/2024 |
8.1.2-preview-6 | 78 | 1/19/2024 |
8.1.2-preview-5 | 94 | 1/19/2024 |
8.1.2-preview-4 | 92 | 1/19/2024 |
8.1.2-preview-3 | 91 | 1/18/2024 |
8.1.2-preview-2 | 106 | 1/18/2024 |
8.1.2-preview-16 | 93 | 1/31/2024 |
8.1.2-preview-15 | 95 | 1/31/2024 |
8.1.2-preview-14 | 195 | 1/25/2024 |
8.1.2-preview-13 | 97 | 1/25/2024 |
8.1.2-preview-12 | 103 | 1/23/2024 |
8.1.2-preview-11 | 115 | 1/23/2024 |
8.1.2-preview-10 | 122 | 1/22/2024 |
8.1.2-preview-1 | 103 | 1/18/2024 |
8.1.1 | 157 | 1/18/2024 |
8.1.0 | 121 | 1/18/2024 |
8.0.3 | 162 | 12/29/2023 |
8.0.1 | 145 | 12/14/2023 |
8.0.0 | 169 | 12/7/2023 |
6.0.4.3 | 151 | 12/29/2023 |
6.0.4.2 | 174 | 12/20/2023 |
6.0.4.1 | 245 | 12/19/2023 |
6.0.4 | 167 | 12/4/2023 |
6.0.3.20 | 163 | 11/27/2023 |
6.0.3.19 | 176 | 11/22/2023 |